This project is archived and is in readonly mode.

#2978 ✓duplicate
Adam S

rake gems:refresh_specs not working as expected...

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

  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

Comments and changes to this ticket

  • Adam S

    Adam S July 31st, 2009 @ 07:10 AM

    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:in `each'
    /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'
    /usr/bin/rake:19:in `load'
  • Matt Jones

    Matt Jones July 31st, 2009 @ 07:53 AM

    • 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...

  • Adam S

    Adam S July 31st, 2009 @ 09:28 AM

    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?


  • Matt Jones

    Matt Jones July 31st, 2009 @ 09:44 AM

    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 for some discussion on that issue...

  • Choon Keat Chew

    Choon Keat Chew October 13th, 2009 @ 04:40 PM


    --- /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/   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 =, "= #{specification.version}")
    +      real_gems =
    +      exact_dep =, specification && "= #{specification.version}")
           matches =
           installed_spec = matches.first
           if frozen?
  • David Trasbo

    David Trasbo June 20th, 2010 @ 04:31 PM

    • Assigned user changed from “Matt Jones” to “Ryan Bigg”

    Can be closed - see above.

  • Ryan Bigg

    Ryan Bigg June 21st, 2010 @ 02:01 AM

    • State changed from “new” to “duplicate”
  • csnk

    csnk May 18th, 2011 @ 08:22 AM

    • Importance changed from “” to “”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>