Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

gems:unpack:dependencies attempting to unpack Rails gems

#1123

Running rake gems:unpack:dependencies in an application that sets RAILS_GEM_VERSION to a less-recent version than installed (eg 2.1.0 when 2.1.1 is installed) gives an error when a gem with a dependency on rails is present.

Longer example:

Hobo 0.8.2 gem depends on Rails, >=2.1

Add config.gem 'hobo' to environment.rb

Run rake gems:unpack:dependencies --trace, and get this:


** Invoke gems:unpack:dependencies (first_time)
** Invoke gems:unpack (first_time)
** Invoke gems:base (first_time)
** Execute gems:base
** Invoke environment (first_time)
** Execute environment
** Execute gems:unpack
Unpacked gem: '/Users/mattjones/hobo/apps/agility0.8/vendor/gems/hobo-0.8.2'
** Execute gems:unpack:dependencies
Unpacked gem: '/Users/mattjones/hobo/apps/agility0.8/vendor/gems/hobosupport-0.8.2'
Unpacked gem: '/Users/mattjones/hobo/apps/agility0.8/vendor/gems/hobofields-0.8.2'
Unpacked gem: '/Users/mattjones/hobo/apps/agility0.8/vendor/gems/rails-2.1.1'
Unpacked gem: '/Users/mattjones/hobo/apps/agility0.8/vendor/gems/mislav-will_paginate-2.3.2'
Unpacked gem: '/Users/mattjones/hobo/apps/agility0.8/vendor/gems/rails-2.1.1'
Unpacked gem: '/Users/mattjones/hobo/apps/agility0.8/vendor/gems/rake-0.8.1'
rake aborted!
can't activate activesupport (= 2.1.1, runtime), already activated activesupport-2.1.0
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:142:in `activate'
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:49:in `gem'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/rails/gem_dependency.rb:32:in `add_load_paths'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/tasks/gems.rake:57
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/tasks/gems.rake:56:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/tasks/gems.rake:56
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/tasks/gems.rake:54:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/tasks/gems.rake:54
...

Several issues:

  • some gems are getting unpacked more than once. This is a tricky bit involving Array, eql? and friends. I have a patch, will post shortly.

  • unpacking rake will not work (at least not without major environment tweaking). Should this be a special case?

  • and last but not least, the command grabs rails-2.1.1 from the gems, not the currently active version. Line 106 of gem_dependency.rb (2-1-stable) appears to be the culprit; it assumes that the most recent gem matching the spec is intended, ignoring versions that may already be loaded.

Finally, should gem:unpack ever be unpacking Rails? That would seem to be a duplication of the freezing functionality.

Reported by Matt Jones · September 27th, 2008 @ 08:53 AM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none