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.

Vendor gem failing rake gems:build

#2721

I've got a problem with building vendored gems. If the gem is not also system-installed, it fails to build the gem. The error displayed is:

mathie@Tullibardine golflinks (master) $ rake gems:build --trace
(in /Users/mathie/Development/Rubaidh/ruby/rails_apps/golflinks)
** Invoke gems:build (first_time)
** Execute gems:build
rake aborted!
undefined method `full_name' for nil:NilClass
/Users/mathie/Development/Rubaidh/ruby/rails_apps/golflinks/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:287:in `unpacked_gem_directory'
/Users/mathie/Development/Rubaidh/ruby/rails_apps/golflinks/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:291:in `unpacked_specification_filename'
/Users/mathie/Development/Rubaidh/ruby/rails_apps/golflinks/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:174:in `build'
/Users/mathie/Development/Rubaidh/ruby/rails_apps/golflinks/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb:11:in `__send__'
/Users/mathie/Development/Rubaidh/ruby/rails_apps/golflinks/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb:11:in `to_proc'
/Users/mathie/Development/Rubaidh/ruby/rails_apps/golflinks/vendor/rails/railties/lib/tasks/gems.rake:23:in `each'
/Users/mathie/Development/Rubaidh/ruby/rails_apps/golflinks/vendor/rails/railties/lib/tasks/gems.rake:23
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

The solution seems to be to make sure that the gem's specification can successfully be loaded by always adding the load path before attempting to build the gem. This seems somewhat convoluted, but is the only approach I tried that actually works. So, attached is a patch that makes it work.

Reported by Graeme Mathieson · May 26th, 2009 @ 04:36 PM

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

Activity

  1. David Dollar
  2. David Dollar
    David Dollar

    Forgot to add, but +1

    May 27th, 2009 @ 05:40 PM

  3. Matt Jones
    Matt Jones

    The real issue here was the the environment wasn't loaded, and therefore gemspecs weren't being pulled from vendor/gems. The patch in #2773 incorporates a fix for this, by explicitly loading the .specification file from the directory passed to GemDependency.from_directory_name.

    June 6th, 2009 @ 11:17 PM

  4. Graeme Mathieson
    Graeme Mathieson

    I'm happy for this ticket to be closed alongside #2773 being resolved.

    June 9th, 2009 @ 05:31 AM

  5. Repository
    Repository
    • State changed from new to committed

    (from [2c3d2906b255b1cb3aeb5d3abb9fe2dcb2872c28]) Fix several issues with the 2.3.2 gem loader.

    Incorporates the following:

    • migrates back small change to gems:build:force from bfc1609a501fc3ed442685819de5bcdb5fbada1c to finish closing #2266.

    • unrolls to_proc calls in gems.rake, to match the change in master.

    • fixes #2722 by passing the options hash to dependencies during build. (includes a test)

    • fixes #2721 by loading the specification directly in from_directory_name. Adds an option to opt-out of specification loading when needed (in gems:refresh_specs, for instance). Includes tests.

    • fixes #2679 by refreshing specs for all frozen gems rather than just gems loaded from the environment.

    • fixes #2678 by passing the options hash to dependencies during unpack.

    Signed-off-by: Michael Koziarski michael@koziarski.com
    http://github.com/rails/rails/commit/2c3d2906b255b1cb3aeb5d3abb9fe2...

    June 9th, 2009 @ 08:58 AM

  6. Repository
    Repository

    (from [41a94048e55e082f373e19d9fcee311860aaba9e]) Fix several issues with the 2.3.2 gem loader.

    Incorporates the following:

    • migrates back small change to gems:build:force from bfc1609a501fc3ed442685819de5bcdb5fbada1c to finish closing #2266.

    • unrolls to_proc calls in gems.rake, to match the change in master.

    • fixes #2722 by passing the options hash to dependencies during build. (includes a test)

    • fixes #2721 by loading the specification directly in from_directory_name. Adds an option to opt-out of specification loading when needed (in gems:refresh_specs, for instance). Includes tests.

    • fixes #2679 by refreshing specs for all frozen gems rather than just gems loaded from the environment.

    • fixes #2678 by passing the options hash to dependencies during unpack.

    Signed-off-by: Michael Koziarski michael@koziarski.com
    http://github.com/rails/rails/commit/41a94048e55e082f373e19d9fcee31...

    June 9th, 2009 @ 08:58 AM