Bugs item #29114, was opened at 2011-04-04 23:22
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=29114&group_id=126

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Daniel DeLeo (danielsdeleo)
>Assigned to: Eric Hodel (drbrain)
Summary: older gems interfere with loading paths from external gems

Initial Comment:
I'm seeing this issue with the Chef project. In the current release version, we 
have a bunch of files under chef/knife/whatever.rb In the current prerelease 
version, we have plugin support using Gem.find_files (thanks for the patch 
guys!), so we've moved much of this code out to separate gems. We strip the 
paths we get back from Gem.find_files to the normal relative paths (e.g., 
chef/knife/ec2_server_create) so that we can uniq them and rely on rubygems to 
load the latest version of the gem.

The problem I'm seeing is this:
Chef 0.9.14 has a file 'chef/knife/ec2_instance_data'
Chef 0.10.0 does not have this file.
the knife-ec2 plugin *does* have a file 'chef/knife/ec2_instance_data'

When I have both Chef 0.9.14 and Chef 0.10 installed and Chef 0.10 attempts to 
`require 'chef/knife/ec2_instance_data'`  it gets a LoadError


/Users/ddeleo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:57:in
 `require': no such file to load -- chef/knife/ec2_instance_data (LoadError)
        from 
/Users/ddeleo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:57:in
 `rescue in require'
        from 
/Users/ddeleo/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in
 `require'
        from 
/Users/ddeleo/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.0.beta.6/lib/chef/knife/core/subcommand_loader.rb:39:in
 `block in load_commands'
# etc.
If I run `gem which chef/knife/ec2_instance_data`, I see that rubygems prefers 
the one in the old version of chef: 

gem which chef/knife/ec2_instance_data
/Users/ddeleo/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.9.14/lib/chef/knife/ec2_instance_data.rb

When I uninstall the old version of chef, so that I have only the 0.10 beta, 
then chef 0.10 can successfully require the 'chef/knife/ec2_instance_data' 
file, and `gem which` reports that the file is located in the knife-ec2 gem.

----------------------------------------------------------------------

Comment By: Daniel DeLeo (danielsdeleo)
Date: 2011-04-04 23:27

Message:
Forcing activation of the plugin gem (e.g., knife-ec2 in the example) works 
around the error, though extracting the gem name is messy to say the least.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=29114&group_id=126
_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to