I’m trying to create a new app from scratch, with rails 1.2.2. I have
updated gem, rails, and rake all to their most recent versions. But I
still get this whenever I try to run any rake task, for example:
I’m trying to create a new app from scratch, with rails 1.2.2. I have
updated gem, rails, and rake all to their most recent versions. But I
still get this whenever I try to run any rake task, for example:
dhcp-123-193:~/Sites/foosball asa$ rake --tasks --trace
(in /Users/asa/Sites/foosball)
rake aborted!
undefined method `gem’ for main:Object
/Users/asa/Sites/foosball/config/boot.rb:29
I can run the console, and start the mongrel server, I just can’t use
rake.
This is weird, since all of them execute boot.rb.
“gem” was introduced in a very recent RubyGems release (perhaps even
the last one). That release is installed because the server starts
just fine. So a posteriori it must be happening that rake is not
using that release for whatever reason.
Could you please investigate a bit that hypothesis? Can you for
instance check the shebang in script/server and see whether the
interpreter and rake live in different bin directories? Perhaps rake
uses a different interpreter?
I can run the console, and start the mongrel server, I just can’t use
rake.
This is weird, since all of them execute boot.rb.
“gem” was introduced in a very recent RubyGems release (perhaps even
the last one). That release is installed because the server starts
just fine. So a posteriori it must be happening that rake is not
using that release for whatever reason.
Could you please investigate a bit that hypothesis? Can you for
instance check the shebang in script/server and see whether the
interpreter and rake live in different bin directories? Perhaps rake
uses a different interpreter?
– fxn
Correct – rake was using /usr/bin/ruby, while everyone else was using
/usr/local/bin/ruby (or /usr/bin/env ruby).
Changed rake to use the right ruby, and changed it to “gem” from
“require_gem”, and all works fine with no errors.
Thanks!
Asa
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.