2013-12-21 41 views
0
bundle exec cap production deploy 

最後我得到這個錯誤Capistrano的:不知道如何建設任務 '部署:重啓'

ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux] 
cap aborted! 
Don't know how to build task 'deploy:restart' 

deploy.rb

namespace :deploy do 

    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     # Your restart mechanism here, for example: 
     execute :touch, release_path.join('tmp/restart.txt') 
    end 
    end 

    after :publishing, :restart 

end 

Capistrano的3.0

回答

3

解決。

set :pty, true 

set :keep_releases, 1 

namespace :deploy do 

    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     # Your restart mechanism here, for example: 
     execute :touch, release_path.join('tmp/restart.txt') 
    end 
    end 

    after :restart, :clear_cache do 
    on roles(:web), in: :groups, limit: 3, wait: 10 do 
     # Here we can do anything such as: 
     # within release_path do 
     # execute :rake, 'cache:clear' 
     # end 
    end 
    end 

    after :finishing, 'deploy:cleanup' 


end 
+2

這是否意味着您無法刪除這兩個默認任務?我刪除了它們,因爲我沒有使用它們。 –

相關問題