Permalink
Browse files

Made sudo into an option for deploy and defaulted to false to maintai…

…n backward compatibility
  • Loading branch information...
1 parent 3229759 commit b7997f0ad34def27ac6777a6dfad0f09c136f92f @mm53bar mm53bar committed with Mar 26, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/sunzi/cli.rb
View
@@ -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"
@@ -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}"

0 comments on commit b7997f0

Please sign in to comment.