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.9.0 lib/heirloom/archive/uploader.rb
heirloom-0.8.3 lib/heirloom/archive/uploader.rb
heirloom-0.8.2 lib/heirloom/archive/uploader.rb
heirloom-0.8.1 lib/heirloom/archive/uploader.rb
heirloom-0.8.0 lib/heirloom/archive/uploader.rb
heirloom-0.7.4 lib/heirloom/archive/uploader.rb
heirloom-0.7.3 lib/heirloom/archive/uploader.rb
heirloom-0.7.3rc2 lib/heirloom/archive/uploader.rb
heirloom-0.7.3rc1 lib/heirloom/archive/uploader.rb
heirloom-0.7.2 lib/heirloom/archive/uploader.rb
heirloom-0.7.2rc2 lib/heirloom/archive/uploader.rb
heirloom-0.7.2rc1 lib/heirloom/archive/uploader.rb
heirloom-0.7.1 lib/heirloom/archive/uploader.rb
heirloom-0.7.0 lib/heirloom/archive/uploader.rb
heirloom-0.7.0rc1 lib/heirloom/archive/uploader.rb
heirloom-0.6.1 lib/heirloom/archive/uploader.rb
heirloom-0.6.0rc1 lib/heirloom/archive/uploader.rb
heirloom-0.5.0rc4 lib/heirloom/archive/uploader.rb
heirloom-0.5.0rc3 lib/heirloom/archive/uploader.rb
heirloom-0.5.0rc2 lib/heirloom/archive/uploader.rb