Created attachment 609931 [details] Example Ruby project with Gemfile and gemspec Description of problem: Bundler can't locate 'rake' gem when you have Gemfile with the 'gemspec' and you do 'require "rake"' in that gemspec (to use FileList for example). Version-Release number of selected component (if applicable): Fedora 17 + How reproducible: Run 'rake -T' or 'bundle exec rake -T' in the attached example. Steps to Reproduce: 1. Install rubygem-rake and rubygem-bundler 2. Download attached tar and extract it into folder 3. $ bundle 4. $ rake -T 5. $ bundle exec rake -T Actual results: • ~/test › rake -T --trace rake aborted! There was a LoadError while evaluating test-gem.gemspec: cannot load such file -- rake from /home/mfojtik/test/test-gem.gemspec:1:in `<main>' Does it try to require a relative path? That doesn't work in Ruby 1.9. /usr/share/gems/gems/bundler-1.0.21/lib/bundler.rb:252:in `rescue in rescue in block in load_gemspec' /usr/share/gems/gems/bundler-1.0.21/lib/bundler.rb:240:in `rescue in block in load_gemspec' /usr/share/gems/gems/bundler-1.0.21/lib/bundler.rb:236:in `block in load_gemspec' /usr/share/gems/gems/bundler-1.0.21/lib/bundler.rb:234:in `chdir' /usr/share/gems/gems/bundler-1.0.21/lib/bundler.rb:234:in `load_gemspec' • ~/test › bundle exec rake There was a LoadError while evaluating test-gem.gemspec: cannot load such file -- rake from /home/mfojtik/test/test-gem.gemspec:1:in `<main>' Does it try to require a relative path? That doesn't work in Ruby 1.9. Expected results: Bundler should require the 'rake' from test-gem.gemspec. Additional info:
Note that it works when I use 'rbenv' or on other platforms, like OSX or Ubuntu. This bug seems to be entirely related to Fedora.
Also just for the record, the only known workaround for now is to remove 'rake' from gemspec and replace FileList with Dir. That does not fix the original problem that many project use FileList in gemspec and they will be unhappy that their code behave different on Fedora.
Since rake is gem and since you depend on Rake, you should add it into your .gemspec. It will not work on older Fedoras nor Ruby 1.8 in general. And yes, with Ruby 1.9, this is exceptional behavior of Fedora, with lengthy discussion here: http://bugs.ruby-lang.org/issues/6124
Could you explain what you mean with 'add it into your .gemspec' ?
You should add "s.add_development_dependency('rake')" into your list of dependencies.