简体   繁体   中英

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?

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

In your case that would be rake initiate:initiate

You can run:

rake -T | grep initiate

To find out the proper namespace plus name you should be using to run that task.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM