Sha256: dc7ee91277f69a4ec14e1405594ad6c590b4cdb0a9e23d1cee3588bbb907c55e

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'active_support/core_ext/module/attribute_accessors'
require 'logger'

begin
  require 'syslog_logger'
rescue LoadError
  $stderr.puts "SyslogLogger isn't available"
end

module Box
  module Release

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

    @@logger = default_logger
    mattr_accessor :logger

    @@install_command = nil
    mattr_accessor :install_command

    @@download_directory = "/tmp"
    mattr_accessor :download_directory

    class ExecutionError < StandardError; end

    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

  end
end

require 'box/release/loader'
require 'box/release/downloader'
require 'box/release/base'
require 'box/release/memory'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
box-release-0.0.4 lib/box/release.rb
box-release-0.0.3 lib/box/release.rb