lib/capistrano/tasks/passenger.cap in capistrano-passenger-0.1.0 vs lib/capistrano/tasks/passenger.cap in capistrano-passenger-0.1.1
- old
+ new
@@ -10,20 +10,23 @@
end
on roles(fetch(:passenger_roles)), in: fetch(:passenger_restart_runner), wait: fetch(:passenger_restart_wait), limit: fetch(:passenger_restart_limit) do
with fetch(:passenger_environment_variables) do
within(release_path) do
if restart_with_touch.nil?
- passenger_version = capture(:passenger, '-v').match(/\APhusion Passenger version (.*)$/)[1]
+ passenger_version = capture(:passenger, '-v').match(/^Phusion Passenger (Enterprise )?version (.*)$/)[2]
restart_with_touch = Gem::Version.new(passenger_version) < Gem::Version.new('4.0.33')
end
if restart_with_touch
execute :mkdir, '-p', release_path.join('tmp')
execute :touch, release_path.join('tmp/restart.txt')
else
- restart_with_sudo = fetch(:passenger_restart_with_sudo) ? :sudo : nil
- arguments = SSHKit::Command.new(*[*fetch(:passenger_restart_command).split(" ").collect(&:to_sym), fetch(:passenger_restart_options)]).to_s
- execute *[restart_with_sudo, arguments].compact
+ restart_command = fetch(:passenger_restart_command).split(" ").collect(&:to_sym) << fetch(:passenger_restart_options)
+ if fetch(:passenger_restart_with_sudo)
+ # We preprocess the command with SSHKit::Command to allow 'passenger-config' to be transformed with the command map.
+ restart_command = [:sudo, SSHKit::Command.new(*restart_command).to_s]
+ end
+ execute *restart_command
end
end
end
end
end