class Edict::Command

Public Class Methods

shell() click to toggle source
# File lib/edict/command.rb, line 13
def self.shell
  @shell ||= Caliph.new
end

Public Instance Methods

action() click to toggle source
# File lib/edict/command.rb, line 40
def action
  to_run = build_command
  to_run = add_env(to_run)
  result = run_command(to_run)
  check_result(result)
end
add_env(command) click to toggle source
# File lib/edict/command.rb, line 25
def add_env(command)
  env_hash.each_pair do |name, value|
    command.set_env(name, value)
  end
  command
end
build_command() click to toggle source
# File lib/edict/command.rb, line 21
def build_command
  cmd(*command)
end
check_result(result) click to toggle source
# File lib/edict/command.rb, line 36
def check_result(result)
  result.must_succeed!
end
run_command(command) click to toggle source
# File lib/edict/command.rb, line 32
def run_command(command)
  caliph_shell.run(command)
end
setup() click to toggle source
# File lib/edict/command.rb, line 17
def setup
  self.caliph_shell = Edict::Command.shell if field_unset?(:caliph_shell)
end