Rails 1.1 and "freeze_gems"

I’m on OS X Tiger, and just upgraded my gems. I also ran ‘rake
rails:update’.

After that, I ran “rake freeze_gems”, I recieve the following:

=====================
Freezing to the gems for Rails 1.1.0
rm -rf vendor/rails
mkdir -p vendor/rails
cd vendor/rails
Unpacked gem: ‘activesupport-1.3.0’
mv activesupport-1.3.0 activesupport
Unpacked gem: ‘activerecord-1.14.0’
mv activerecord-1.14.0 activerecord
Unpacked gem: ‘actionpack-1.12.0’
mv actionpack-1.12.0 actionpack
Unpacked gem: ‘actionmailer-1.2.0’
mv actionmailer-1.2.0 actionmailer
Unpacked gem: ‘actionwebservice-1.1.0’
mv actionwebservice-1.1.0 actionwebservice
ERROR: While executing gem … (ArgumentError)
Illformed requirement [=#<Gem::Specification name=rails
version=1.1.0>]
rake aborted!
exit

Is this a bug, or am I missing something…?

I thought it was just me. FWIW I ran rake again (OS X 10.4.5) with the
trace option set and got the following:

/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/user_interaction.rb:162:in
exit' /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/user_interaction.rb:162:interminate_interaction’
(eval):3:in terminate_interaction' /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/cmd_manager.rb:71:inrun’
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/gem_runner.rb:13:in run' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/tasks/framework.rake:30 /opt/local/lib/ruby/1.8/fileutils.rb:121:inchdir’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:657:in chdir' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/tasks/framework.rake:24 /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:inexecute’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:in
execute' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:202:ininvoke’
/opt/local/lib/ruby/1.8/thread.rb:135:in synchronize' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:ininvoke’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1719:in run' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1719:inrun’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.0/bin/rake:7
/opt/local/bin/rake:18

Eventually I gave up and ran “rake rails:freeze:edge REVISION=4091”
which to my knowledge is effectively the same thing.

Thanks for the pointer, Ashley. I’ll give that a try to get by for
the time being.

Can anyone else out there get “rake freeze_gems” to work at all on any
platform for Rails 1.1?

Hi,

I created a new migration with “script/generate migration”, but when I
try to run it with “rake migrate” it looks like the old migration runs
again (which generates an error since it tries to create a table that’s
there).

How does Rails figure out which migration to run? Can I explicitly run a
specific migration to work around the problem? What might have caused it
in the first place?

This happened after I upgraded to Rails 1.1 so I am wondering whether
this could have something to do with it.

Thanks for any help!
Ingo W.

Check out
http://dev.rubyonrails.org/ticket/4458

This fixed it for me.

Michael G. wrote:

Thanks for the pointer, Ashley. I’ll give that a try to get by for
the time being.

Can anyone else out there get “rake freeze_gems” to work at all on any
platform for Rails 1.1?

On Sun, 2006-04-02 at 22:51 +0200, Ingo W. wrote:

Hi,

I created a new migration with “script/generate migration”, but when I
try to run it with “rake migrate” it looks like the old migration runs
again (which generates an error since it tries to create a table that’s
there).

How does Rails figure out which migration to run?


The ‘version’ column of the ‘schema_info’ table in your appropriate db

Can I explicitly run a
specific migration to work around the problem?


I suppose if you manually change the ‘version’ of the ‘schema info’ -
never tried it myself

What might have caused it
in the first place?


  • never successfully migrated that db
  • restored db from a dump that didn’t have ‘schema_info’ table
  • deleted schema_info table
    probably others

This happened after I upgraded to Rails 1.1 so I am wondering whether
this could have something to do with it.


perhaps, perhaps not.

did you do ‘rake rails:update’ to your rails app after you upgraded
rails?

Craig

You can do “rake migrate VERSION=4”… but that doesn’t necessarily
fix the problem, because if it thinks its currently on a different
version to what it is, it still won’t work.

The problem could have been caused by an error in your migration code.
When you run it and it’s interrupted midway through, it’ll stop
between versions, so even if you subsequently fix the code, it’ll
still cause an error. In my experience, Rails 1.1 is better at
detecting errors in the migration code before it actually runs it, but
it’s still not perfect. If your code is stuck between versions, there
are two ways you can fix it:

  1. Delete everything and then run rake migrate again. This is fine if
    you’re in development and don’t have lots of data in the tables (other
    than data created by migration), but if you do have data, this can be
    a problem.

  2. Find out what version the code is breaking at (rake migrate
    –trace) then manually do what you need to in the database to complete
    the migrate or roll back to the previous version.

Hope this helps.
-Nathan

You don’t give a copy of the error, but I’ll throw you a hint:
0XX_create_foo.rb and 0YY_create_foo.rb both define a class
CreateFoo. Migrations go strange when this happens. Rename the
newer one and change the defined class name to match.

(If that’s your problem, of course :wink:

-Rob

Rob B. http://agileconsultingllc.com
[email protected]
+1 513-295-4739