Skip to content

Commit

Permalink
Made sudo into an option for deploy and defaulted to false to maintai…
Browse files Browse the repository at this point in the history
…n backward compatibility
  • Loading branch information
mm53bar authored and kenn committed Mar 27, 2012
1 parent 3229759 commit b7997f0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/sunzi/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ def create(project = 'sunzi')
do_create(project)
end

desc "deploy [user@host:port] [role] [using_sudo]", "Deploy sunzi project"
def deploy(target, role = nil, using_sudo = false)
do_deploy(target, role, using_sudo)
desc "deploy [user@host:port] [role] [--sudo]", "Deploy sunzi project"
method_options :sudo => false
def deploy(target, role = nil)
do_deploy(target, role, options.sudo?)
end

desc "compile", "Compile sunzi project"
Expand Down Expand Up @@ -47,8 +48,8 @@ def do_create(project)
template "templates/create/roles/web.sh", "#{project}/roles/web.sh"
end

def do_deploy(target, role, using_sudo)
sudo = 'sudo ' if using_sudo == 'true'
def do_deploy(target, role, force_sudo)
sudo = 'sudo ' if force_sudo
user, host, port = parse_target(target)
endpoint = "#{user}@#{host}"

Expand Down

0 comments on commit b7997f0

Please sign in to comment.