Reputation: 77
I'm using Ubuntu version 12.04.02, Ruby 1.8.7, Gems 1.8.15, trying to do TestFirst.org's Learn Ruby (http://testfirst.org/learn_ruby).
The folder where I store all the files for the course is located on my computer in /home/topher/ruby/learn_ruby-master.
I've followed the instructions to go into the folder labeled 00_hello within the larger folder and create an empty text document called "hello.rb" in the 00_hello folder. Then I go into the terminal, navigate to ~/ruby/learn_ruby-master/00_hello and type:
rake
First I got this error message:
(in /home/topher/ruby/learn_ruby-master) rake aborted! undefined method `gem' for main:Object
(See full trace by running task with --trace)
I did some searching and found a thread on Stack Overflow where someone recommended deleting the line in the rake file that said:
gem 'rspec', '~2'
I did so (or rather, commented it out to be on the safe side) and got a different error message on running "rake":
(in /home/topher/ruby/learn_ruby-master) rake aborted! no such file to load -- rspec/core/rake_task
(See full trace by running task with --trace)
How do I fix this?
Upvotes: 3
Views: 4117
Reputation: 16722
That learning project requires bundler. You know this because at the project's root path there is a file called Gemfile
So in order to continue, first install bundler then run bundle install
then rake
:
$ gem install bundler rubygems-bundler --no-rdoc --no-ri
$ bundle install
$ rake
Prefer a newer Ruby version like 2.0.0 rather than 1.8.7. You can use rvm to get everything setup for you. As a bonus you won't need to install bunder nor rubygems since they are included since ruby 1.9
$ \curl -sSL https://get.rvm.io | bash -s stable
$ source ~/.rvm/scripts/rvm
$ rvm requirements
$ rvm install 2.0.0
$ rvm use --default 2.0.0
Upvotes: 2