Module: Box::Release

Defined in:
lib/box/release.rb,
lib/box/release/cli.rb,
lib/box/release/base.rb,
lib/box/release/loader.rb,
lib/box/release/memory.rb,
lib/box/release/version.rb,
lib/box/release/downloader.rb

Defined Under Namespace

Modules: Base Classes: CLI, Downloader, ExecutionError, Loader, Memory

Constant Summary collapse

VERSION =
"0.0.4"
@@logger =
default_logger
@@install_command =
nil
@@download_directory =
"/tmp"

Class Method Summary collapse

Class Method Details

.default_loggerObject



13
14
15
16
17
18
19
# File 'lib/box/release.rb', line 13

def self.default_logger
  if defined?(SyslogLogger)
    SyslogLogger.new("box-release")
  else
    Logger.new($stdout)
  end
end

.execute!(command) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/box/release.rb', line 32

def self.execute!(command)
  logger.debug "execute '#{command}'"
  output = `#{command} 2>&1`
  logger.debug output unless output.empty?

  if $? != 0
    raise ExecutionError.new("Command failed: #{command} (error code #{$?})")
  end

  true
end