here’s a function
def rubygems_version
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
end
1.8.6
irb(main):005:0* rubygems_version
=> “1.3.0”
1.9
irb(main):001:0> def rubygems_version
irb(main):002:1> Gem::RubyGemsVersion if defined?
Gem::RubyGemsVersion
irb(main):003:1> end
=> nil
hmm.
I guess it’s because of the way that 1.9 ‘auto integrates’ gems?
irb19
defined? Gem::RubyGemsVersion
=> nil
require ‘rubygems’
=> false
defined? Gem::RubyGemsVersion
=> nil
Gem::RubyGemsVersion
=> “1.3.0”
defined? Gem::RubyGemsVersion
=> “constant”
After this point the rubygems_version method works in 1.9
-=R
Another 1.9 gems difference [?]
/Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/rails-2.1.0/lib/rails/plugin/locator.rb:81:in
map': private method
specification’ called for
#Rails::GemDependency:0x139ba24 (NoMethodError)
doesn’t happen in 1.8
(both with gems v 1.3)
Thanks.
-=R
=> “1.3.0”
defined? Gem::RubyGemsVersion
=> “constant”
After this point the rubygems_version method works in 1.9
I’ve seen this too; it’s especially annoying as it stops rails from
booting out of the box.
The fix is easy though. In boot.rb, change:
unless rubygems_version >= ‘0.9.4’
into:
unless (rubygems_version || Gem::RubyGemsVersion) >= ‘0.9.4’
I’d be very interested in hearing the explanation for this weird
behaviour!
On Oct 11, 2008, at 19:41 PM, Roger P. wrote:
=> “1.3.0”
defined? Gem::RubyGemsVersion
=> “constant”
After this point the rubygems_version method works in 1.9
Something seems to be preventing defined?'s const_missing from being
handled properly. I’ll look into it.