lib/capistrano_extensions/invocation.rb in joekhoobyar-capistrano-extensions-0.0.3 vs lib/capistrano_extensions/invocation.rb in joekhoobyar-capistrano-extensions-0.0.5
- old
+ new
@@ -1,7 +1,15 @@
-module CapistranoExtension
+module CapistranoExtensions
+
module Invocation
+ def local_run(*args, &block)
+ args.pop if Hash===args.last
+ args = args.first
+ logger.debug "executing locally: #{args}"
+ system args
+ end
+
def sudo_as(*args, &block)
options = Hash===args.last ? args.pop.dup : {}
options[:as] = fetch(:runner, nil)
sudo *args.push(options), &block
end
@@ -15,12 +23,11 @@
def sudo_su_to(*args, &block)
options = Hash===args.last ? args.pop.dup : {}
options[:shell] = false
cmd = args[0].gsub(/[$\\`"]/) { |m| "\\#{m}" }
args[0] = "echo \"#{cmd}\" | #{sudo} su - #{fetch(:runner, nil)}"
- #args[0] = "echo \"#{.gsub('"', '\\"')}\" | #{sudo} su - #{fetch(:runner, nil)}"
run *args.push(options), &block
end
end
+
Capistrano::Configuration.send :include, Invocation
end
-