远程文件任务
警告:remote_file
已弃用,并在 Capistrano 3.7.0 中被移除
remote_file
任务允许将远程文件的存在设置为先决条件。这些任务可以根据需要依赖于本地文件。在此实现中,我们假设正在处理共享路径中的文件。
例如,此任务可用于确保要链接的文件在运行 check:linked_files 任务之前存在
namespace :deploy do
namespace :check do
task :linked_files => 'config/newrelic.yml'
end
end
remote_file 'config/newrelic.yml' => '/tmp/newrelic.yml', roles: :app
file '/tmp/newrelic.yml' do |t|
sh "curl -o #{t.name} https://rpm.newrelic.com/accounts/xx/newrelic.yml"
end