1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Add support for :sudo variable to specify path to sudo (closes #4578)

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@4566 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2006-07-06 04:40:28 +00:00
parent 61fc449867
commit 0ce0b8f562
2 changed files with 13 additions and 1 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* Add support for :sudo variable to specify path to sudo (closes #4578) [timothee.peignier@tryphon.org]
* Make previous_release return nil if there are no previous releases (closes #4959) [bdabney@cavoksolutions.com]
* Uncache releases list after update_code is called so that newly released dir is included (closes #3766) [Jamis Buck]

View file

@ -266,6 +266,12 @@ module Capistrano
# Like #run, but executes the command via <tt>sudo</tt>. This assumes that
# the sudo password (if required) is the same as the password for logging
# in to the server.
#
# Also, this module accepts a <tt>:sudo</tt> configuration variable,
# which (if specified) will be used as the full path to the sudo
# executable on the remote machine:
#
# set :sudo, "/opt/local/bin/sudo"
def sudo(command, options={}, &block)
block ||= default_io_proc
@ -274,7 +280,7 @@ module Capistrano
# prompts from that host.
prompt_host = nil
run "sudo #{command}", options do |ch, stream, out|
run "#{sudo_command} #{command}", options do |ch, stream, out|
if out =~ /^Password:/
ch.send_data "#{password}\n"
elsif out =~ /try again/
@ -436,6 +442,10 @@ module Capistrano
end
private
def sudo_command
configuration[:sudo] || "sudo"
end
def define_method(name, &block)
metaclass.send(:define_method, name, &block)