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.

rake gems:refresh_specs not working as expected...

#2978
  1. create new rails project
  2. unpack a gem manually in vendor/gems
cd vendor/gems
gem unpack test_gem
  1. run rake gems:refresh_specs

Reported by Adam S · July 31st, 2009 @ 07:09 AM

State: duplicate
Milestone: none
Assigned to: Ryan Bigg Ryan Bigg
Importance: none

Activity

  1. Adam S
    Adam S

    Sorry should specify a little more info:

    Rails 2.3.3, Ruby 1.8.6

    Error trace:

    rake gems:refresh_specs --trace
    (in /Users/adam/dev/temp/testing)
    ** Invoke gems:refresh_specs (first_time)
    ** Execute gems:refresh_specs
    rake aborted!
    undefined method `installed_source_index' for #<Gem::SourceIndex:0x331e04>
    /Users/adam/.gem/ruby/1.8/gems/rails-2.3.3/lib/rails/gem_dependency.rb:217:in `refresh'
    /Users/adam/.gem/ruby/1.8/gems/rails-2.3.3/lib/tasks/gems.rake:53
    /Users/adam/.gem/ruby/1.8/gems/rails-2.3.3/lib/tasks/gems.rake:53:in `each'
    /Users/adam/.gem/ruby/1.8/gems/rails-2.3.3/lib/tasks/gems.rake:53
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
    /Users/adam/.gem/ruby/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'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
    /Users/adam/.gem/ruby/1.8/gems/rake-0.8.7/bin/rake:31
    /usr/bin/rake:19:in `load'
    /usr/bin/rake:19
    

    July 31st, 2009 @ 07:10 AM

  2. Matt Jones
    Matt Jones
    • Assigned user set to Matt Jones

    I noticed this a couple days back, but hadn't gotten around to ticketing it. The issue only occurs when running from Rails installed as a gem, so it's easy to miss when testing against edge in vendor/rails.

    In the meantime, as in the classic doctor joke - "don't do that". refresh_specs was a hack to deal with the fact that the very first version of gem freezing wrote bogus specs in some cases. If there's a gem that doesn't unpack correctly using gems:unpack, that would be a much more interesting bug than this...

    July 31st, 2009 @ 07:53 AM

  3. Adam S
    Adam S

    Sure... I fixed this myself. I deleted the self-unpacked gem and rake gems:unpacked it.

    But it had me slightly stumped and annoyed for a bit...

    I wanted to unpack the gem so I could modify it, and didn't actually want any of the other gems unpacked.

    I personally think the whole "specs" thing is a little nebulous... I can't find this mysterious 'specs list' which gets out of sync...

    Why not just use the gemspec in the dir and compare against the desired version?

    -Adam

    July 31st, 2009 @ 09:28 AM

  4. Matt Jones
    Matt Jones

    If you just want to unpack one gem, you can select it by passing the GEM= option to gems:unpack. The specifications are stored in each gem's directory, in a file called .specification - gemspecs would have been better, and making vendor/gems a real gem repo would have been even better. See #1128 Fix config.gem bugs and add more tests for some discussion on that issue...

    July 31st, 2009 @ 09:44 AM

  5. Choon Keat Chew
    Choon Keat Chew

    Try

    --- /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb   2009-10-13 23:36:08.000000000 +0800
    +++ /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb.new   2009-10-13 23:35:58.000000000 +0800
    @@ -214,8 +214,8 @@
    
         def refresh
           Rails::VendorGemSourceIndex.silence_spec_warnings = true
    -      real_gems = Gem.source_index.installed_source_index
    -      exact_dep = Gem::Dependency.new(name, "= #{specification.version}")
    +      real_gems = Rails::VendorGemSourceIndex.new(Gem.source_index).installed_source_index
    +      exact_dep = Gem::Dependency.new(name, specification && "= #{specification.version}")
           matches = real_gems.search(exact_dep)
           installed_spec = matches.first
           if frozen?
    

    October 13th, 2009 @ 04:40 PM

  6. David Trasbo
    David Trasbo
    • Assigned user changed from Matt Jones to Ryan Bigg

    Can be closed - see above.

    June 20th, 2010 @ 04:31 PM

  7. Ryan Bigg
    Ryan Bigg
    • State changed from new to duplicate

    June 21st, 2010 @ 02:01 AM