2015-05-29 50 views
1

我得到這個錯誤的任務,當我運行:如何打造「generate_secret_token」

rake generate_secret_token 

rake aborted! 
Don't know how to build task 'generate_secret_token' 
/usr/local/rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval' 
/usr/local/rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>' 
(See full trace by running task with --trace) 

當我運行完整跟蹤

rake generate_secret_token --trace 

這就是我得到;

/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/task_manager.rb:62:in `[]' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:149:in `invoke_task' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `each' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:75:in `run' 
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/bin/rake:33:in `<top (required)>' 
/usr/local/rvm/gems/ruby-2.1.3/bin/rake:23:in `load' 
/usr/local/rvm/gems/ruby-2.1.3/bin/rake:23:in `<main>' 
/usr/local/rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval' 
/usr/local/rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>' 
+0

添加rake任務代碼 –

+0

即時試圖遷移的數據庫。 – mawz

+0

你想運行遷移或任務嗎? –

回答

1

檢查您的耙子任務具有以下格式:

namespace :your_namespace do 
    desc 'Description for rake task' 
    task generate_secret_token: :environment do 
    end 
end 

當運行rake任務,運行爲 '耙命名空間:generate_secret_token'

+0

謝謝@Adnan的DevOps,我是安倍晉三,加入這個我Rake文件運行的任務「命名空間:formsgen做 遞減‘生成祕密令牌’ 任務generate_secret_token:環境做 結束 結束 」 – mawz

+0

好啊好啊,這幫助你的事業。你能否接受這個答案,如果它解決了你的問題 –

+0

耶!我還有很多東西要學。這個網站對像我這樣的人來說是一個很大的幫助。乾杯! – mawz

1
rake db:migrate 

此命令用於運行你的數據庫遷移。

rake task_name 

該命令用於運行你寫的lib您的rake任務/任務文件夾

+0

謝謝@ user123的幫助。按照adnan的建議,我可以通過向Rakefile添加一個任務來運行。 我感謝你的幫助。 – mawz