Sha256: 137be6cbe21a2d91d9e07cb03b3443a6ac0888eb04be7725228e6339634f1fec

Contents?: true

Size: 662 Bytes

Versions: 1

Compression:

Stored size: 662 Bytes

Contents

require 'English'

module S3Repo
  ##
  # Base object, used to provide common attributes
  class Base
    def initialize(params = {})
      @options = params
    end

    private

    def run(cmd)
      results = `#{cmd} 2>&1`
      return results if $CHILD_STATUS.success?
      raise "Failed running #{cmd}:\n#{results}"
    end

    def targets
      @targets ||= @options[:targets] || ['x86_64']
    end

    def bucket
      @options[:bucket] || raise('No bucket given')
    end

    def client
      @options[:client] ||= Client.new(@options)
    end

    def file_cache
      @file_cache ||= @options[:file_cache] || Cache.new(@options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
s3repo-3.0.1 lib/s3repo/base.rb