2013-12-21 37 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

这是否意味着您无法删除这两个默认任务?我删除了它们,因为我没有使用它们。 –

相关问题