I’m running 11.10 Oneric, but am having a problem upgrading from default
Ruby 1.8 to recommended 1.9.
Here’s a local file, Test2.rb:
class Test2
puts “hello, from Test2!”
end
And here’s Test.rb:
require ‘Test2’
puts RUBY_VERSION
The important line is the first one: the require.
I can run from 1.8 fine:
% ruby1.8 < Test.rb
hello, from Test2!
1.8.7
But from 1.9.3…
% ruby1.9.1 < Test.rb
internal:lib/rubygems/custom_require:29:in require': no such file to load -- Test2 (LoadError) from <internal:lib/rubygems/custom_require>:29:in
require’
from -:1:in `’
Non-local requires are fine:
% ruby1.9.1 << EOF
require ‘rubygems’
EOF
% ruby1.8 << EOF
require ‘rubygems’
EOF
Same problem running irb, where here I’m manually switching between Ruby
versions, and it works with 1.8 but not 1.9:
% irb
irb(main):001:0> puts RUBY_VERSION
1.8.7
=> nil
irb(main):002:0> require ‘Test2’
hello, from Test2!
=> true
irb(main):003:0> exit
% sudo update-alternatives --config ruby
[sudo] password for djconnel:
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).
Selection Path Priority Status
- 0 /usr/bin/ruby1.8 50 auto mode
1 /usr/bin/ruby1.8 50 manual mode
2 /usr/bin/ruby1.9.1 10 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby
(ruby) in manual mode.
% irb
irb(main):001:0> puts RUBY_VERSION
1.9.2
=> nil
irb(main):002:0> require ‘Test2’
LoadError: no such file to load – Test2
from internal:lib/rubygems/custom_require:29:in require' from <internal:lib/rubygems/custom_require>:29:in
require’
from (irb):2
from /usr/bin/irb:12:in `’
irb(main):003:0> exit
% sudo update-alternatives --config ruby
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).
Selection Path Priority Status
0 /usr/bin/ruby1.8 50 auto mode
1 /usr/bin/ruby1.8 50 manual mode
- 2 /usr/bin/ruby1.9.1 10 manual mode
Press enter to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/ruby1.8 to provide /usr/bin/ruby
(ruby) in manual mode.
% irb
irb(main):001:0> puts RUBY_VERSION
1.8.7
=> nil
irb(main):002:0> require ‘Test2’
hello, from Test2!
=> true
Any help?
thanks!
Dan