Sha256: 8747064a976a407d67f75c02efd3f26882ca31f37065c664533e2c0a9304fb6b

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 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
      args[0] = "echo \"#{args[0].gsub('"', '\\"')}\" | #{sudo} su - #{fetch(:runner, nil)}"
      run *args.push(options), &block
    end
  end
  Capistrano::Configuration.send :include, Invocation
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
joekhoobyar-capistrano-extensions-0.0.1 lib/capistrano_extensions/invocation.rb