lib/capistrano/twingly/tasks/upstart.rake in capistrano-twingly-2.3.0 vs lib/capistrano/twingly/tasks/upstart.rake in capistrano-twingly-2.4.0
- old
+ new
@@ -23,21 +23,32 @@
end
namespace :foreman do
desc 'Upload Procfile to server'
task :upload_procfile do
- on roles(:app) do
- upload! 'tmp/Procfile', "#{fetch(:deploy_to)}/current/Procfile"
+ on roles(:app) do |host|
+ upload! "tmp/Procfile_#{host.name}", "#{fetch(:deploy_to)}/current/Procfile"
end
end
desc 'Generate Procfile'
task :generate_procfile do
Dir.mkdir('tmp') unless Dir.exist?('tmp')
- File.open('tmp/Procfile', 'w') do |conf|
- fetch(:procfile_contents).each_line do |line|
- conf.puts "#{line.chomp} 2>&1 | logger -t #{fetch(:app_name)}"
+ procfile_contents = fetch(:procfile_contents)
+
+ on roles(:app) do |host|
+ procfile_contents_string =
+ if procfile_contents.is_a?(Hash)
+ procfile_contents.fetch(host.hostname)
+ else
+ procfile_contents
+ end
+
+ File.open("tmp/Procfile_#{host.hostname}", 'w') do |conf|
+ procfile_contents_string.each_line do |line|
+ conf.puts "#{line.chomp} 2>&1 | logger -t #{fetch(:app_name)}"
+ end
end
end
end
end