Method: ThorSsh::Actions#as_user

Defined in:
lib/thor-ssh/actions.rb

#as_user(username, options = {}) ⇒ Object

As user takes a block and runs the code inside the block as the specified user. All actions are run as the user

Parameters

username<String>

Who to run as

options<String>

A hash of options for how to get to this user

Options

:shell - Boolean, should this be invoked in the shell for the user



56
57
58
59
60
61
# File 'lib/thor-ssh/actions.rb', line 56

def as_user(username, options={})
  old_run_as_user = @run_as_user
  @run_as_user = username
  yield
  @run_as_user = old_run_as_user
end