Search code examples
ruby-on-railsrubyrake

Cannot build simple rake task


I created a task lib/tasks/initiate.rake with the code

namespace :initiate do
  desc "initiate bundle install"
  task :initiate do
    `bundle install`
  end
end

And I keep getting the following response:

$ rake initiate
warning: parser/current is loading parser/ruby22, which recognizes
warning: 2.2.3-compliant syntax, but you are running 2.2.1.
rake aborted!
Don't know how to build task 'initiate'

(See full trace by running task with --trace)

What's going on?


Solution

  • You have to use rake <namespace>:<task>.

    In your case that would be rake initiate:initiate