Sha256: 7331e64cf1fae92cb71b03d21d07ce0396303d38a9512ad078a9ba171c33b349

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

module Heirloom

  class ArtifactUploader

    def initialize(args)
      @config = args[:config]
      @name = args[:name]
      @id = args[:id]
      @logger = @config.logger
    end

    def upload(args)
      file = args[:file]
      key_name = "#{@id}.tar.gz"
      bucket_prefix = args[:bucket_prefix]
      public_readable = args[:public_readable]

      @config.regions.each do |region|
        bucket = "#{bucket_prefix}-#{region}"

        s3_uploader = Uploader::S3.new :config => @config,
                                       :logger => @logger,
                                       :region => region

        s3_uploader.upload_file :bucket          => bucket,
                                :file            => file,
                                :id              => @id,
                                :key_folder      => @name,
                                :key_name        => key_name,
                                :name            => @name,
                                :public_readable => public_readable
      end
      @logger.info "Upload complete."
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heirloom-0.1.4 lib/heirloom/artifact/artifact_uploader.rb