Bug 854526 - Bundler does not find rake in $LOAD_PATH when using gemspec
Summary: Bundler does not find rake in $LOAD_PATH when using gemspec
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: rubygem-bundler
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Vít Ondruch
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-05 09:21 UTC by Michal Fojtik
Modified: 2012-09-06 07:16 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-05 09:52:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Example Ruby project with Gemfile and gemspec (1.24 KB, application/x-gzip)
2012-09-05 09:21 UTC, Michal Fojtik
no flags Details

Description Michal Fojtik 2012-09-05 09:21:59 UTC
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:

Comment 1 Michal Fojtik 2012-09-05 09:27:23 UTC
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.

Comment 2 Michal Fojtik 2012-09-05 09:35:02 UTC
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.

Comment 3 Vít Ondruch 2012-09-05 09:52:39 UTC
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

Comment 4 Michal Fojtik 2012-09-05 10:41:38 UTC
Could you explain what you mean with 'add it into your .gemspec' ?

Comment 5 Vít Ondruch 2012-09-06 07:16:11 UTC
You should add "s.add_development_dependency('rake')" into your list of dependencies.


Note You need to log in before you can comment on or make changes to this bug.