ERROR: 'rake/rdoctask' is obsolete and no longer supported - ruby-on-rails

Out of the blue, I started getting the following error message:
(in /Users/me/.rvm/gems/ruby-1.9.3-p125#mysql2/gems/rails-0.9.5)
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
/Users/me/.rvm/gems/ruby-1.9.3-p125#mysql2/gems/rails-0.9.5/Rakefile:3:in `<top (required)>'
When I do rails s (in my development environment terminal - Mac Mountain Lion). This application is in production, so I went to the production environment, did a bundle show, and modified my Gemfile, to harcode the gems versions.
Here's what I have now on my my local development environment (what's producing the error message).
actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
annotate (2.4.1.beta1)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bootstrap-datepicker-rails (0.6.15)
bootstrap-sass (2.0.2)
builder (3.0.4)
bundler (1.1.3)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.1)
commonjs (0.2.6)
devise (2.0.4)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
factory_girl (3.2.0)
factory_girl_rails (3.2.0)
hike (1.2.1)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (2.0.2)
json (1.7.1)
less (2.2.2)
less-rails (2.2.6)
libv8 (3.3.10.4)
mail (2.4.4)
mime-types (1.21)
multi_json (1.6.1)
mysql2 (0.3.11)
nokogiri (1.5.6)
orm_adapter (0.0.7)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.3)
railties (3.2.3)
rake (10.0.3)
rdoc (3.4)
rest-client (1.6.7)
rspec (2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
sass (3.2.7)
sass-rails (3.2.5)
sprockets (2.1.3)
stripe (1.7.0)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.5)
tinymce-rails (3.4.8)
treetop (1.4.12)
twitter-bootstrap-rails (2.1.0)
tzinfo (0.3.37)
uglifier (1.2.4)
warden (1.1.1)
webrat (0.7.1)
I researched Stackoverflow and the web, and none of the suggestions worked (changing the rake gem version to something different. like 0.8.7, etc., editing my app Rakefile to suppress deprecation errors, etc.). I also added rdoc and in my Rakefile, I required 'rdoc/task'
Still, the same error.

Just to help anyone else who has had this hassle.
If you are like me, then your problem is that the current version of rails is 4 and you are wanting to use an older version like 3.0.7
If you install rails fresh to learn it ,say, and the tutorial you are using is for a 3.0.x version of rails OR your job requires the use of the older version of rails.. then you can get into this hole.
In my case I got a 3.0.7 rails project dumped on me and was told to learn rails and make some enhancements to this code.
so, I just started learning rails and was following the tutorial until I got this error when doing a 'rake db:migrate'
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `require'
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `<top (required)>'
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `load'
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `block in <top (required)>'
This happened cos I was using an older version of rails.. in my case 3.0.7
If you run a 'bundle show', like I did then, you may see that you are using the rake version 10.0.0 or something like that...and you need to be running rake 0.9.2 ... which is where the problem is coming from..
The solution for me was to (a) add a gem to my gemfile and (b) to a bundle install
So, in my gemfile I added:
gem 'rake', '0.9.2'
Then did a
'bundle install'
Got this message:
You have requested:
rake = 0.9.2
The bundle currently has rake locked at 10.1.0.
Try running `bundle update rake`
And so I did that...
bundle update rake.
And that went fine.
then when I did the'rake db:migrate' it just worked.
Hope this helps somebody.
Vida.
PS: if you are new to rails, like me, and you inherit an older rails app then for gods sake NEVER run 'bundle update' or you will enter a world of pain. That command updates all your gems to the very latest versions and you end up with a load of problems with incompatibilities. The only way out of it is if you are lucky enough to have git installed and can do a 'git checkout' to go back...

I struck with this same problem when try to install gems by the command rake gems:install my rails version is rails2.3.2 and i have rvm installed.
my gem list is,
actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
bundler (1.3.5)
rails (2.3.2)
rake (10.0.4)
rubygems-bundler (1.1.1)
rvm (1.11.3.7)
so uninstalled the rake by the command
rvm use ruby-1.8.7-p371#global && gem uninstall rake -v 10.0.4
then i installed rake of older version
rvm use ruby-1.8.7-p371#global && gem install rake -v 0.8.7
now rake gems:install works fine
hope it may help some one!

Upgrading to rails 4.0.0 I got the same error.
rails -v
(in /Users/oma/.rvm/gems/ruby-2.0.0-p247/gems/rails-0.9.5)
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
/Users/oma/.rvm/gems/ruby-2.0.0-p247/gems/rails-0.9.5/Rakefile:3:in `<top (required)>'
(See full trace by running task with --trace)
To upgrade, I removed the version number in Gemfile
source 'https://rubygems.org'
gem 'rails' # NO VERSION
and did bundle update as I thought this would pick the last. But somehow, I got rails 0.9.5. It feels like some practical joke, really, lol
$ gem list rails
rails (4.0.1.rc2, 4.0.0, 0.9.5)
I can't tell you with 100% certainty that this was the cause, but we were two people, working on the same branch and seeing the same error. The fix worked for both of us. Simply
specify rails version!
$gem uninstall rails -v 0.9.5
Gemfile
source 'https://rubygems.org'
gem 'rails', '4.0.0'
then bundle, run rails -v, giggle (or cry) and get back to producing

Take a look at similar problem solution on StackOverflow
Another option is to use (example taken from Redmine Rakefile)
require 'rdoc'
require 'rdoc/task'
Instead of
require 'rake/testtask'
require 'rake/rdoctask'

The following works for me using ruby 1.9.3p448 (2013-06-27 revision 41675):
1) Use rake version 10.1.0 (put following in your Gemfile):
gem 'rake', '10.1.0'
(Note you can likely use another version, but the line number below might change.)
2) Comment line 54 of your Rakefile and replace it as follows:
#require 'rake/rdoctask'
gem 'rdoc', ">= 2.4.2"
require 'rdoc/task'
3) Test
$ bundle install
$ bundle exec rake

Related

installing rails 4.2 on ruby 2.2.0 using RVM generates "Your Ruby version is 2.2.0, but your Gemfile specified 2.1.5"

This is an update for the problem mentioned below:
I just found out that there is a Gemfile and Gemfile.lock in the root directory i.e system Home directory, and when ever i create a new gemset i believe it uses this gemfile. After installing rails in a newly created gemset, when check the rails version or try to create a new app, it shows the error Your ruby version is 2.2.0, but your Gemfile specifies 2.1.5, cause the Gemfile file in my home directory contains that ruby version, and if delete that Gemfile, and try to create a new rails app, it searches for that Gemfile.
I am current going through a hard time. I was starting a new project in ruby 2.2.0 and rails 4.2.0 and started by creating a gemset using RVM inside my project folder.
created gemset.
$rvm use ruby-2.2.0#myapp --ruby-version --create
Installed latest rails
$gem install rails
After that i checked the rails version just to verify
$rails -v
but instead i get a notification saying Your Ruby version in 2.2.0 but your Gemfile specified 2.1.5. I also don't have my application folder yet, cause i get the same output if i try to $rails new .
Following are the RVM related outputs
My RVM version is 1.26.10.
rvm gemset list
gemsets for ruby-2.2.0 (found in /Users/samy/.rvm/gems/ruby-2.2.0)
(default)
global
student-portal
=> myapp
gem list for global gemset
bigdecimal (1.2.7, 1.2.6)
bundler (1.7.13)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.3)
json (1.8.2, 1.8.1)
mini_portile (0.6.2)
minitest (5.5.1, 5.4.3)
nokogiri (1.6.6.2)
power_assert (0.2.2)
psych (2.0.12, 2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.0.9, 3.0.8)
gem list for myapp gemset
actionmailer (4.2.0)
actionpack (4.2.0)
actionview (4.2.0)
activejob (4.2.0)
activemodel (4.2.0)
activerecord (4.2.0)
activesupport (4.2.0)
arel (6.0.0)
bigdecimal (1.2.7, 1.2.6)
builder (3.2.2)
bundler (1.7.13)
bundler-unload (1.0.2)
erubis (2.7.0)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
globalid (0.3.2)
hike (1.2.3)
i18n (0.7.0)
io-console (0.4.3)
json (1.8.2, 1.8.1)
loofah (2.0.1)
mail (2.6.3)
mime-types (2.4.3)
mini_portile (0.6.2)
minitest (5.5.1, 5.4.3)
multi_json (1.10.1)
nokogiri (1.6.6.2)
power_assert (0.2.2)
psych (2.0.12, 2.0.8)
rack (1.6.0)
rack-test (0.6.3)
rails (4.2.0)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.5)
rails-html-sanitizer (1.0.1)
railties (4.2.0)
rake (10.4.2)
rdoc (4.2.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
sprockets (2.12.3)
sprockets-rails (2.2.4)
test-unit (3.0.9, 3.0.8)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
tzinfo (1.2.2)
which ruby gives
/Users/samy/.rvm/rubies/ruby-2.2.0/bin/ruby
which rails gives
/Users/samy/.rvm/gems/ruby-2.2.0#myapp/bin/rails
the file contains
#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'railties' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
gem 'railties', version
load Gem.bin_path('railties', 'rails', version)
I tried removing and reinstalling RVM but i did not work.
Also i tried making app with ruby 2.1.5 with different gemset and all, but there i get different error when i try to do rails new app. i get the Could not find slop-3.6.0 in any of the sources
Run 'bundle install' to install missing gems., but once i do the bundle install i cannot run the rails new app command as it notifies
Can't initialize a new Rails application within the directory
of another, please change to a non-Rails directory first.
Any help would be greatly appreciated. If you need any more info i am ready to provide it.
Thanks in advance.
Cheers.
I had similar issues and restarting from scratch using this guide helped a lot. Though it seemed yet another guide, I found it to be a bit more systematic and detailed than the others.
Rails Apps Guide: Install Ruby on Rails ยท Ubuntu Linux
Alternatively, try Rails Apps Guide: Updating to Rails 4.2
Note:
Rails is not just a Ruby gem, it is a complex and rapidly evolving
ecosystem. It is important to set up your development environment with
the most current version of all the gems that are needed for
development.

Rake abort error

OK, so I'm doing the following Ruby tutorial: https://github.com/alexch/learn_ruby
and I have saved all the files under c:/learn_ruby
When I run rake in the directory: "00_hello" I get the following error:
c:\learn_ruby\00_hello>rake
(in c:/learn_ruby)
rake aborted!
Could not find 'rspec' (~> 2) - did find: [rspec-3.0.0]
Checked in 'GEM_PATH=C:/Users/******/.gem/ruby/1.9.1;C:/Ruby193/lib/ruby/gems/1
.9.1', execute `gem env` for more information
my current gem list is:
bigdecimal (1.1.0)
diff-lcs (1.2.5)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.5)
rspec (3.0.0)
rspec-core (3.0.2)
rspec-expectations (3.0.2)
rspec-mocks (3.0.2)
rspec-support (3.0.2)
rubygems-update (2.3.0)
I am new at Ruby, so can someone please help a noob out? I tried installing rspec 2.0.0, but got a different error.
The error message
Could not find 'rspec' (~> 2)
means that it is looking for rspec in the 2.x range. Usually this means you have a Gemfile which specifies gem 'rspec', '~> 2'. The ~> ties it to the same version "family"; see the bundler docs for more information.
Usually the solution is to type
bundle install
which will make sure your prerequisites are met.

Rails can not find rake gem?

Started learning ruby on rails today, after spending the half day fixing the other errors, I am stuck at the following: When I enter the following command in the terminal: " bundle exec rake db:migrate" or "rails server" it gives me the following error:
Could not find rake-0.9.2 in any of the sources
Run bundle install to install missing gems.
I ran bundle install rake (Both with version number and without) and it says it has been installed to ./rake. When I run the command it gives me the same error again. No Idea how to fix this, so any help is wholeheartedly appreciated. I am using ruby 1.9.2 and rails 3.0.9 in the directory the App is located in with RVM. Thanks in advance for any help.
EDIT:
* LOCAL GEMS *
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.29)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using bundler (1.0.15)
Using rdoc (3.8)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using sqlite3-ruby (1.2.5)
EDIT2: This has been fixed: Try using rvm and go back to ruby 1.8.7 instead of 1.9.2. This fixed it for me. Don't forget to install rails again (sudo gem install rails while already on 1.8.7) if you have only installed rails for 1.9.2.]
First, you should unlock the Gemfile
[root#localhost ~]#cd yourapplication [root#localhost
yourapplication]#bundle unlock
Then, edit your Gemfile, add gem rake
[root#localhost yourapplication]#vi Gemfile
+ gem 'rake', '0.9.2'
Then, update bundle
[root#localhost yourapplication]#bundle update
I guess you tried already gem install rake but it should come with rails anyway.
Well, what fl00r said in comments above, or show us the output of gem list --local

Rails: Help with rake aborted error!

I have been trying to run the rake db:migrate command but it ain't working. I uninstalled and installed the gem but no luck. I read somewhere the o.9 wasn't stable and that 0.8.7 was ok. I tried it but I got an error also..
For now the error is
Fayimora-Femi-Baloguns-MacBook-Pro:sample_app fayimora$ bundle exec rake db:migrate
/Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /usr/local in PATH, mode 040777
(in /Users/fayimora/Sites/rails_projects/sample_app)
DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from /Users/fayimora/Sites/rails_projects/sample_app/config/application.rb:12)
DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from /Users/fayimora/Sites/rails_projects/sample_app/config/application.rb:12)
rake aborted!
undefined method `prerequisites' for nil:NilClass
/Users/fayimora/Sites/rails_projects/sample_app/Rakefile:7
(See full trace by running task with --trace)
My gem list is
Fayimora-Femi-Baloguns-MacBook-Pro:sample_app fayimora$ bundle
Using rake (0.8.7)
Using ZenTest (4.5.0)
Using multi_json (1.0.3)
Using activesupport (3.1.0.rc4)
Using bcrypt-ruby (2.1.4)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0.rc4)
Using erubis (2.7.0)
Using rack (1.3.1)
Using rack-cache (1.0.2)
Using rack-mount (0.8.1)
Using rack-test (0.6.0)
Using hike (1.1.0)
Using tilt (1.3.2)
Using sprockets (2.0.0.beta.10)
Using tzinfo (0.3.29)
Using actionpack (3.1.0.rc4)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.3.0)
Using actionmailer (3.1.0.rc4)
Using arel (2.1.3)
Using activerecord (3.1.0.rc4)
Using activeresource (3.1.0.rc4)
Using autotest (4.4.6)
Using sys-uname (0.8.5)
Using autotest-fsevent (0.2.4)
Using autotest-growl (0.2.9)
Using autotest-rails-pure (4.1.2)
Using bundler (1.0.15)
Using coffee-script-source (1.1.1)
Using execjs (1.2.0)
Using coffee-script (2.2.0)
Using diff-lcs (1.1.2)
Using rack-ssl (1.3.2)
Using rdoc (3.8)
Using thor (0.14.6)
Using railties (3.1.0.rc4)
Using jquery-rails (1.0.12)
Using json (1.5.3)
Using nokogiri (1.5.0)
Using rails (3.1.0.rc4)
Using rspec-core (2.0.0.beta.18)
Using rspec-expectations (2.0.0.beta.18)
Using rspec-mocks (2.0.0.beta.18)
Using rspec (2.0.0.beta.18)
Using webrat (0.7.3)
Using rspec-rails (2.0.0.beta.18)
Using sass (3.1.4)
Using sass-rails (3.1.0.rc.4)
Using spork (0.9.0.rc8)
Using sqlite3 (1.3.3)
Using uglifier (1.0.0)
Contents of Rakefile
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
# require 'rake/dsl_definition'
require File.expand_path('../config/application', __FILE__)
SampleApp::Application.load_tasks
Please any help would be apprecible. Been having a real hard time learning rails.
The bug with Rake 0.9.2 is fixed. Try using Rake 0.9.2 by adding it to your Gemfile and run
bundle update rake.
I wouldn't use Rails 3.1 RCs besides experimenting or checking your gems for compatibility. Rails 3.0.9 is pretty stable and widely supported.
Edit: https://github.com/rails/rails/issues/1197
The problem is related to a gem not being compatible with Rails 3.1. Try to remove rspec from your Gemfile, bundle install, and run your rake tasks.

Could not find builder-2.1.2 in any of the sources

I'm following the Getting Started with Rails guide, but I ran into a problem:
bash-4.1$ bundle install
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.24)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.7)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.7)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using sqlite3-ruby (1.3.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
bash-4.1$ rake db:create
(in /Users/user/Documents/blog)
Could not find builder-2.1.2 in any of the sources
Try running `bundle install`.
bash-4.1$ bundle show builder
/Users/user/.gem/ruby/1.8/gems/builder-2.1.2
I also tried installing Builder as a RubyGem, but that didn't change a thing.
Try running it through bundle exec to make sure all of the gems specified in your Gemfile are available at their correct versions: bundle exec rake db:create
You can verify the installed gem is visible to bundle like this:
bundle show builder
/usr/lib/ruby/gems/1.8/gems/builder-2.1.2
I have the same problem though, bundle exec rake still fails to see the installed gem.
My version of rake (installed at /usr/bin/rake) was pointing at an old version of Ruby 1.8.
Modify the first line of rake to point at the correct version of Ruby. You can also clear out the bundle cache under the 'vendor' directory or move bundle to another local directory:
bundle install --path gems
On the command line, locate your default 'ruby' and 'rake' commands and check the version of Ruby:
which ruby
which rake
ruby -v
In /usr/bin/rake (line #1):
#!/opt/local/bin/ruby

Resources