lib/mascherano/tasks/foreman.cap in mascherano-1.0.2 vs lib/mascherano/tasks/foreman.cap in mascherano-1.0.3

- old
+ new

@@ -2,43 +2,45 @@ desc <<-DESC Export the Procfile to upstart. You can override any of these defaults by setting the variables shown below. + set :foreman_cmd, "foreman" set :foreman_format, "upstart" set :foreman_location, "/etc/init" set :foreman_port, 5000 set :foreman_root, -> { release_path } set :foreman_procfile, -> { release_path.join('Procfile') } set :foreman_app, -> { fetch(:application) } set :foreman_user, -> { fetch(:user) } set :foreman_log, -> { shared_path.join('log') } - set :foreman_pids, -> { shared_path.join('pids') } + set :foreman_pids, false set :foreman_concurrency, false set :foreman_sudo, false set :foreman_roles, :all DESC task :export do on roles(fetch(:foreman_roles)) do within release_path do - concurrency = fetch(:foreman_concurrency) - sudo = fetch(:foreman_sudo) + concurrency = fetch(:foreman_concurrency) + foreman_sudo = fetch(:foreman_sudo) + foreman_pids = fetch(:foreman_pids) args = [fetch(:foreman_format), fetch(:foreman_location)] args << %Q(-f #{fetch(:foreman_procfile)}) args << %Q(-p #{fetch(:foreman_port)}) args << %Q(-d #{fetch(:foreman_root)}) args << %Q(-a #{fetch(:foreman_app)}) args << %Q(-u #{fetch(:foreman_user)}) args << %Q(-l #{fetch(:foreman_log)}) - args << %Q(-r #{fetch(:foreman_pids)}) + args << %Q(-r #{fetch(:foreman_pids)}) if foreman_pids args << %Q(-c #{concurrency}) if concurrency - cmd = "foreman export #{args.join(' ')}" + cmd = "#{fetch(:foreman_cmd)} export #{args.join(' ')}" - if sudo + if foreman_sudo execute "sudo su - -c '#{cmd}'" else execute cmd end end @@ -46,18 +48,19 @@ end end namespace :load do task :defaults do + set :foreman_cmd, "foreman" set :foreman_format, "upstart" set :foreman_location, "/etc/init" set :foreman_port, 5000 set :foreman_root, -> { release_path } set :foreman_procfile, -> { release_path.join('Procfile') } set :foreman_app, -> { fetch(:application) } set :foreman_user, -> { fetch(:user) } set :foreman_log, -> { shared_path.join('log') } - set :foreman_pids, -> { shared_path.join('pids') } + set :foreman_pids, false set :foreman_concurrency, false set :foreman_sudo, false set :foreman_roles, :all end end