in Rails

rake freeze_gems fails because rails gem is not installed

that the code is not picking up the right version for rails.

A quick look at:

gem list

receals that I have:

rails (1.0.0)
    Web-application framework with template engine, control-flow layer, and ORM.

rails_analyzer_tools (1.1.0)
    Tools for analyzing the performance of web sites.

And 1.1.0 is exactly what it shows as my version of rails. Well, again, I beg to differ!

The quick and dirty fix:

edit /usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/tasks/framework.rake

and hardcode the version:

rails = if version = ENV[‘VERSION’]
        Gem.cache.search(‘rails’, “= #{version}”).first
      else
        Gem.cache.search(‘rails’).sort_by { |g| g.version }.last
      end
version ||= rails.version
version  = ‘1.0’  #HARDCODE VERSION

Now, freezing rails works as expected:

rake freeze_gems

An other solution may be what Michael Gorsuch did.

  • Related Content by Tag