rake aborted! undefined local variable or method
In a fresh new Ubuntu machine, I have installed ruby with
sudo apt-get install ruby1.8
and then installed rubygem1.8 with :
sudo apt-get install rubygems
and after that installed rails3.2.8 with :
gem install rails
The procedure was very simple. But here comes the problem. When I tried checking the version of rake with rake --trace -version I got the following error:
rake aborted!
undefined local variable or method `rsion' for #<Rake::Application:0xb72c731c>
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:316:in `standard_rake_options'
/usr/lib/ruby/1.8/optparse.rb:1298:in `eval'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:316:in `standard_rake_options'
/usr/lib/ruby/1.8/optparse.rb:1298:in `call'
/usr/lib/ruby/1.8/optparse.rb:1298:in `parse_in_order'
/usr/lib/ruby/1.8/optparse.rb:1254:in `catch'
/usr/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order'
/usr/lib/ruby/1.8/optparse.rb:1248:in `order!'
/usr/lib/ruby/1.8/optparse.rb:1339:in `permute!'
/usr/lib/ruby/1.8/optparse.rb:1360:in `parse!'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:425:in `handle_options'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:74:in `init'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:72:in `init'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:64:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19Is it the problem due to I have installed straight from ubuntu apt-get package manager ?
21 Answer
rake --version will output the rake version you have installed. Or in short style: rake -V. See the documentation for rake (read below on how to do that).
You used a single dash in front of a long style command. If you use a single dash, all following letters will be treated as individual command line options.
For example rake -h will show you a list of possible command line options and rake -Vvt prints out the version of rake, activates message logging to standard output and enables tracing with full backtrace. That means, the combined short style options -V, -v and -t are passed to the programm. In your case, you tried to execute rake with the options -v, -e, -r, -s, -i, -o and -n. That worked for -v (verbose) and -e (execute code), but rsion could not be found.rake --Vvt would search for an option with the name Vvt, and rake --version searches for an option with the name version.
Be aware that this is all convention, it's up to the programmer to obey these or net. To get a list of all documented command line options of your programm use man programm for the manpage and programm -h or programm --help for a short documentation, replace "programm" with, for example, rake, to see the options for rake.