class Tara::Shell

@private

Public Class Methods

exec(command) click to toggle source
# File lib/tara/shell.rb, line 6
def self.exec(command)
  output = %x(#{command})
  $stderr.puts(%(#{command}: #{output})) if ENV['TARA_DEBUG']
  unless $?.success?
    raise ExecError, %(Command `#{command}` failed with output: #{output})
  end
  output
rescue Errno::ENOENT => e
  raise ExecError, %(Command `#{command}` failed with output: #{e.message})
end
exec_with_env(command, env) click to toggle source
# File lib/tara/shell.rb, line 17
def self.exec_with_env(command, env)
  self.exec(env.map { |k, v| [k, v].join('=') }.join(' ') << ' ' << command)
end