Sha256: 94eff254f17db41cc581ba67079df18b4d65dcd31afab78a590899a236cce524

Contents?: true

Size: 1.28 KB

Versions: 26

Compression:

Stored size: 1.28 KB

Contents

module Heirloom

  class Uploader

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

    def upload(args)
      heirloom_file = args[:file]
      bucket_prefix = args[:bucket_prefix]
      regions = args[:regions]
      public_readable = args[:public_readable]

      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            => heirloom_file,
                                :id              => @id,
                                :key_folder      => @name,
                                :key_name        => "#{@id}.tar.gz",
                                :name            => @name,
                                :public_readable => public_readable

        s3_uploader.add_endpoint_attributes :bucket     => bucket,
                                            :id         => @id,
                                            :name       => @name
      end
      @logger.info "Upload complete."
    end

  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
heirloom-0.5.0rc1 lib/heirloom/archive/uploader.rb
heirloom-0.4.1rc1 lib/heirloom/archive/uploader.rb
heirloom-0.4.0 lib/heirloom/archive/uploader.rb
heirloom-0.3.1 lib/heirloom/archive/uploader.rb
heirloom-0.3.0 lib/heirloom/archive/uploader.rb
heirloom-0.3.0.rc1 lib/heirloom/archive/uploader.rb