我正在使用Mina (Capistrano 的一种更简单的替代方案)current
来部署我的 ruby 网站,并且在更新符号链接后我正在尝试运行一些任务。
到目前为止,这是我的 deploy.rb 文件中的内容:
desc "Deploys the current version to the server."
task :deploy => :environment do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
to :launch do
invoke :restart
end
end
end
desc "Manually restart Thin web server"
task :restart do
in_directory "#{deploy_to}/current" do
queue! %[bundle exec thin restart -C "#{thin_yml}"]
end
end
我的问题是,当 Mina 遇到问题时to :launch
,current
符号链接尚未更新,因此要么它不存在(如果它是该项目的第一次部署),要么它仍然指向 n-1 版本(因此,服务器使用项目的过时版本)。
:restart
因此,一旦新版本被移动到发布目录并且当前版本symlink
已经更新,我希望能够调用我的任务。