This project is archived and is in readonly mode.
script/server make an error in Ruby 1.9 because of defined? method's change
-
Carlos Paramio
- Tag changed from ruby1.9 to 2.2, railties, ruby1.9
I can reproduce this. I think it is more that rubygems are automatically loaded by Ruby 1.9, but only the first time a gem (or rubygem itself) is used. So when Ruby 1.9 evaluates "defined? Gem::RubyGemsVersion" the first time, it returns nil, even when the Gem module is already available. Ex:
$ irb1.9
defined? Gem::RubyGemsVersion => nil Gem::RubyGemsVersion => "1.2.0.1824" defined? Gem::RubyGemsVersion => "constant"
Here is a (possibly) simpler patch to make it work with both Ruby stable and unstable versions:
--- environments/boot.rb.old 2008-11-04 17:00:31.000000000 +0100 +++ environments/boot.rb 2008-11-04 17:02:44.000000000 +0100 70c70
< Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
Gem::RubyGemsVersion rescue nil -
Carlos Paramio
Ooops. Sorry, I forgot the <code> tags.
The example:
$ irb1.9 >> defined? Gem::RubyGemsVersion => nil >> Gem::RubyGemsVersion => "1.2.0.1824" >> defined? Gem::RubyGemsVersion => "constant"The patch:
--- environments/boot.rb.old 2008-11-04 17:00:31.000000000 +0100 +++ environments/boot.rb 2008-11-04 17:02:44.000000000 +0100 70c70 < Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion --- > Gem::RubyGemsVersion rescue nil -
Carlos Paramio
- Tag changed from 2.2, railties, ruby1.9 to 2.2, patch, railties, ruby1.9, ruby19
I used "git diff" to create the patch, but checking the contributions guide, it seems that the preferred format is the output of "git format-patch", so I've included the new patch file that substitutes the first one, with extension ".diff" as it appears at the guide. My apologize for any inconvenience.
-
Carlos Paramio
- Assigned user set to Jeremy Kemper
Michael Koziarski said at the rails-core mailing list:
Jeremy's been keeping an eye on our 1.9 compatibility, and he's the best one to pipe up with a reply. However my understanding is that several 1.9 changes have broken 2.2 support (test related assertions f.ex) and we'll likely be holding off till 2.3 before we ship a '1.9 friendly' release.
Jeremy, can you confirm this please? Thanks!
-
Jeremy Kemper
- Milestone cleared.
- State changed from new to committed
Rails 2.2 is Ruby 1.9-friendly also, with some caveats, such as using the test-unit gem instead of minitest.
8412200f90c239cbf12bb32b5246d0104306f6c2
