Module: DeltaCapistrano::Configuration::Actions::RunInShell

Included in:
Capistrano::Configuration
Defined in:
lib/delta_capistrano/configuration/actions/run_in_shell.rb

Instance Method Summary collapse

Instance Method Details

#in_a_shell_as(user, cmd = "") {|command_array| ... } ⇒ Object

Yields:

  • (command_array)


8
9
10
11
12
13
14
15
16
# File 'lib/delta_capistrano/configuration/actions/run_in_shell.rb', line 8

def in_a_shell_as(user, cmd = "")
  command_array = array_of_commands
  
  command_array << cmd
  
  yield command_array  if block_given?

  sudo "su - #{user} sh -c '#{command_array.joined_by_semi_colon}'"
end