Sha256: db25170962a9e3b9bd5d56300ca0044883ac0d1d19c55e05eb4aa6d2b0b91701
Contents?: true
Size: 863 Bytes
Versions: 2
Compression:
Stored size: 863 Bytes
Contents
module CapistranoExtension module Invocation def sudo_as(*args, &block) options = Hash===args.last ? args.pop.dup : {} options[:as] = fetch(:runner, nil) sudo *args.push(options), &block end def sudo_su(*args, &block) options = Hash===args.last ? args.pop.dup : {} args[0] = "su #{fetch(:runner, nil)} -c '#{args[0]}'" sudo *args.push(options), &block end 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
joekhoobyar-capistrano-extensions-0.0.2 | lib/capistrano_extensions/invocation.rb |
joekhoobyar-capistrano-extensions-0.0.3 | lib/capistrano_extensions/invocation.rb |