Capistrano - undefined method `map' - ruby

I am using capistrano through Magentify. I am using RVM as a regular user on archlinux. I have it using Ruby 2.0.0 and I ran gem install magentify in a gemset I defined for this purpose. It installed Capistrano 3.0.1 and a about 9 other gems. When I set the recipe, I tried
cap -T
and it writes
cap aborted!
undefined method `map' for :except:Symbol
/home/dirtymikeandtheboys/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/nonrails.rb:24:in `block in <top (required)>'
I also tried cap deploy with the same result (not sure what I expected.) How do I get started trying to fix this?
Edit: ran --trace with command cap -T:
cap aborted!
undefined method `map' for :except:Symbol
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:304:in `set_arg_names'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task_manager.rb:29:in `define_task'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:360:in `define_task'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/dsl_definition.rb:32:in `task'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/nonrails.rb:24:in `block in <top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task_manager.rb:196:in `in_namespace'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/dsl_definition.rb:104:in `namespace'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/nonrails.rb:7:in `<top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/mage.rb:1:in `load'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/mage.rb:1:in `<top (required)>'
/home/dirtymike/public_html/project/Capfile:3:in `load'
/home/dirtymike/public_html/project/Capfile:3:in `<top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:637:in `raw_load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:94:in `block in load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:93:in `load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/capistrano-3.0.1/lib/capistrano/application.rb:22:in `load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:77:in `block in run'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/capistrano-3.0.1/lib/capistrano/application.rb:12:in `run'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/capistrano-3.0.1/bin/cap:3:in `<top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/cap:23:in `load'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/cap:23:in `<main>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `eval'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `<main>'

EDIT
This is fixed in version 0.0.7 of the Gem. I submitted a patch and it now forces to Capistrano 2.X, which is the only compatible version. The original answer was wrong, the problem was not with Rake.
Original Answer
It seems that the problem is with Rake and not with Capistrano. You may need to, either use an older version of rake (possibly 0.9.6), or update the Magentify gem to work with rake 10. Maybe you can open an issue on that repo.
EDIT
Confirmed: It works with rake 0.9.6.
You can add this Gemfile to your project:
source 'http://rubygems.org'
gem 'rake', '~> 0.9'
gem 'magentify'
and then running it like bundle exec cap -T

Related

rubocop will not run getting errors related to cookstyle

I am getting this when I run a barebones rubocop.
gem list | egrep 'rubocop|cookstyle'
cookstyle (7.10.0)
rubocop (1.12.1, 1.12.0)
rubocop-ast (1.4.1)
rubocop-performance (1.10.2)
The error follows upon running rubocop with no parameters:
Unable to activate cookstyle-7.10.0, because rubocop-1.12.1 conflicts with rubocop (= 1.12.0)
/Users/stuartcracraft/.rvm/rubies/ruby-2.5.9/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:2298:in `raise_if_conflicts'
/Users/stuartcracraft/.rvm/rubies/ruby-2.5.9/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:1415:in `activate'
/Users/stuartcracraft/.rvm/rubies/ruby-2.5.9/lib/ruby/site_ruby/2.5.0/rubygems.rb:224:in `rescue in try_activate'
/Users/stuartcracraft/.rvm/rubies/ruby-2.5.9/lib/ruby/site_ruby/2.5.0/rubygems.rb:217:in `try_activate'
/Users/stuartcracraft/.rvm/rubies/ruby-2.5.9/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:123:in `rescue in require'
/Users/stuartcracraft/.rvm/rubies/ruby-2.5.9/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:34:in `require'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/config_loader_resolver.rb:17:in `block (2 levels) in resolve_requires'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/config_loader_resolver.rb:13:in `each'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/config_loader_resolver.rb:12:in `tap'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/config_loader.rb:45:in `load_file'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/config_loader.rb:106:in `configuration_from_file'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/config_store.rb:69:in `for_dir'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/config_store.rb:48:in `for_pwd'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/cli.rb:128:in `apply_default_formatter'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/lib/rubocop/cli.rb:40:in `run'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/exe/rubocop:13:in `block in <top (required)>'
/Users/stuartcracraft/.rvm/rubies/ruby-2.5.9/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/gems/rubocop-1.12.1/exe/rubocop:12:in `<top (required)>'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/bin/rubocop:23:in `load'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/bin/rubocop:23:in `<main>'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/bin/ruby_executable_hooks:22:in `eval'
/Users/stuartcracraft/.rvm/gems/ruby-2.5.9/bin/ruby_executable_hooks:22:in `<main>'
I tried removing either rubocop version but got the same error.
I am trying to find a way to lint chef ruby code, hence the above attempt.
If anyone sees anything in the above errors or has another linter with a smoother
install, please let me know.
Thanks.
Stuart
Version conflicts are typically resolved with bundler. Try bundle exec rubocop.

I'm trying to run a rake test ruby / sinatra and its telling me rake aborted! I'm not sure what to do

Here is the what my terminal is showing me..
user#Users-MacBook-Pro palindrome_app % bundle exec rake test
/Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/mustermann-1.1.1/lib/mustermann.rb:73:in `new': Hash can't be coerced into Mustermann::Pattern (TypeError)
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/mustermann-1.1.1/lib/mustermann.rb:70:in `block in new'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/mustermann-1.1.1/lib/mustermann.rb:70:in `map'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/mustermann-1.1.1/lib/mustermann.rb:70:in `new'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1641:in `compile'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1629:in `compile!'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1271:in `error'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1839:in `<class:Base>'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:894:in `<module:Sinatra>'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:22:in `<top (required)>'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/main.rb:1:in `require'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/main.rb:1:in `<top (required)>'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra.rb:1:in `require'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra.rb:1:in `<top (required)>'
from /Users/user/Desktop/repos/palindrome_app/app.rb:1:in `require'
from /Users/user/Desktop/repos/palindrome_app/app.rb:1:in `<top (required)>'
from /Users/user/Desktop/repos/palindrome_app/test/test_helper.rb:3:in `require_relative'
from /Users/user/Desktop/repos/palindrome_app/test/test_helper.rb:3:in `<top (required)>'
from /Users/user/Desktop/repos/palindrome_app/test/site_pages_test.rb:1:in `require_relative'
from /Users/user/Desktop/repos/palindrome_app/test/site_pages_test.rb:1:in `<top (required)>'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb:17:in `require'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb:17:in `block in <main>'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb:5:in `select'
from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb:5:in `<main>'
rake aborted!
Command failed with status (1)
/Users/user/.rbenv/versions/3.0.0/bin/bundle:23:in `load'
/Users/user/.rbenv/versions/3.0.0/bin/bundle:23:in `<main>'
Tasks: TOP => test
(See full trace by running task with --trace)
tl;dr: Upgrade sinatra to version 2.1.0. (Or, downgrade ruby to v2.7.)
You are running old gem versions (in particular, sinatra v2.0.3), with the latest version of ruby (v3.0.0). You may run into various compatibility problems by doing that, because you could be missing crucial ruby 3.0 compatibility updates from those libraries.
There are various mentions of ruby 2.7+ keyword deprecation fixes in the sinatra changelog.
Specifically, this error:
gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1629:in `compile!'
Was fixed by this change in this PR, which shipped as part of sinatra v2.0.8. Also, additional fixes were added as part of the v2.1.0 release.

Creating a gem from a Capistrano task

I have a capistrano task I am trying to make into a gem so I can use it in multiple projects. The repository for this gem is located here:
https://github.com/FoamFactory/capistrano-monorepo-assets/tree/jwir3/initial-commit
I essentially used https://github.com/sheharyarn/capistrano-rake as a basis for creating my gem.
I've tested the actual rake script, but I'm actually not importing it into the project right now. Instead, I'm trying to get it to actually import the gem successfully. When I add the gem to my Gemfile as such:
gem 'capistrano-monorepoassets','0.0.6', path: "~/Source/capistrano-monorepo-assets/pkg"
Run bundle install, then attempt to import it using the following in my Capfile:
require 'capistrano/monorepoassets'
I get an error when I run cap --tasks --trace:
cap aborted!
LoadError: cannot load such file -- capistrano/monorepoassets
/home/scottj/Source/foamfactory/designsystem/Capfile:37:in `require'
/home/scottj/Source/foamfactory/designsystem/Capfile:37:in `<top (required)>'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/rake_module.rb:29:in `load'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/rake_module.rb:29:in `load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:703:in `raw_load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:104:in `block in load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:103:in `load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:82:in `block in run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:80:in `run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/capistrano-3.11.0/lib/capistrano/application.rb:14:in `run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/capistrano-3.11.0/bin/cap:3:in `<top (required)>'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/cap:23:in `load'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/cap:23:in `<main>'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `eval'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `<main>
I can't seem to get it to load the module using require, which is where I'm stuck. Can someone tell me what I'm doing incorrectly?
So this actually was happening because I didn't understand that bundle install doesn't support installing local gems by specifying the path in the Gemfile. This question actually covers the problem, and, more specifically, the answer here solved it for me.

uninitialized constant Syck error when running jekyll

Using jekyll, I get the following error when run command bundle exec jekyll serve --watch,
bundler: failed to load command: jekyll (/home/admin/.rbenv/versions/2.3.8/bin/jekyll)
NameError: uninitialized constant Syck
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/safe_yaml-0.9.7/lib/safe_yaml/syck_node_monkeypatch.rb:42:in `<top (required)>'
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/safe_yaml-0.9.7/lib/safe_yaml.rb:200:in `require'
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/safe_yaml-0.9.7/lib/safe_yaml.rb:200:in `<module:YAML>'
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/safe_yaml-0.9.7/lib/safe_yaml.rb:132:in `<top (required)>'
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/jekyll-1.3.0/lib/jekyll.rb:21:in `require'
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/jekyll-1.3.0/lib/jekyll.rb:21:in `<top (required)>'
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/jekyll-1.3.0/bin/jekyll:7:in `require'
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/jekyll-1.3.0/bin/jekyll:7:in `<top (required)>'
/home/admin/.rbenv/versions/2.3.8/bin/jekyll:22:in `load'
/home/admin/.rbenv/versions/2.3.8/bin/jekyll:22:in `<top (required)>'
/home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/runner.rb:385:in `block in require_program': program version required (Commander::Runner::CommandError)
from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/runner.rb:384:in `each'
from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/runner.rb:384:in `require_program'
from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/runner.rb:52:in `run!'
from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/delegates.rb:8:in `run!'
from /home/admin/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/commander-4.1.6/lib/commander/import.rb:10:in `block in <top (required)>'
I guess that the few line relating to jekyll-1.3.0 tells us that there is a path problem somewhere.
To update your gems with bundle update
and do a rehash with rbenv rehash
It looks like you're using Jekyll version 1.3.0, which is about 5 years old at this point. Syck was removed from Ruby 2.0.0, so I think you'll need to use a newer version of Jekyll or use the Syck gem to bridge the gap. https://github.com/ruby/syck

Why can't i get rake db:migrate to work for ruby.railstutorial.org

I decided to go through the tutorial. After I create a new app and add new user:string email:string and then perform rake db:migrate in the app directory, I get this output:
rake aborted!
undefined method `task' for #<DemoApp::Application:0x00000100e49e08>
/usr/local/rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
/Users/zigloo99/rails_projects/demo_app/Rakefile:7:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:78:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:61:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:59:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/bin/rake:31:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `<main>'
I am using RVM too ruby 1.9.2 and rails 3.0.7 as in the tutorial.
Any thoughts?
This is happening because the latest version of Rake (0.9.0) is broken on Rails 3.0 applications and we are currently awaiting a solid fix.
Right now, a way around this error is to add this line above the load_tasks line in your application's Rakefile:
<AppName>::Application.send :include, ::Rake::DSL if defined?(::Rake::DSL)
Another solution is to require rake 0.8.7 in your Gemfile before starting a new rails project.
# Gemfile
gem 'rake', '0.8.7', :require => 'rake'
then run bundle install

Resources