class Bcome::System::Local

Public Instance Methods

command(raw_command) click to toggle source
# File lib/objects/system/local.rb, line 29
def command(raw_command)
  ::Bcome::Command::Local.run(raw_command)
end
execute_command(raw_command, print_out_command = false) click to toggle source
# File lib/objects/system/local.rb, line 7
def execute_command(raw_command, print_out_command = false)
  puts "\n> #{raw_command}".bc_blue + "\n" if print_out_command

  local_command = command(raw_command)
  if local_command.failed? && !in_console_session?
    # we fail fast if we're not in a console session
    raise Bcome::Exception::FailedToRunLocalCommand, "#{raw_command}. Error: " + local_command.stderr
  end

  local_command
end
in_console_session?() click to toggle source
# File lib/objects/system/local.rb, line 19
def in_console_session?
  ::Bcome::Workspace.instance.console_set?
end
local_user() click to toggle source
# File lib/objects/system/local.rb, line 23
def local_user
  result = command('whoami')
  result.stdout =~ /(.+)\n/
  Regexp.last_match(1)
end