Sha256: 1af1907e7741573fc4baec47fa261ca8fb1c21159826b4b45c615a4897e269e1

Contents?: true

Size: 583 Bytes

Versions: 20

Compression:

Stored size: 583 Bytes

Contents

require 'fog/aws'
require 'fog/local' if ENV['FOG_LOCAL']

module Shipitron
  class FetchBucket
    include Metaractor

    required :name

    def call
      if ENV['FOG_LOCAL']
        Logger.debug 'Using fog local storage'
        storage = Fog::Storage.new provider: 'Local', local_root: '/fog'
        context.bucket = storage.directories.create(key: name)
      else
        storage = Fog::Storage.new provider: 'AWS', use_iam_profile: true
        context.bucket = storage.directories.get(name)
      end
    end

    private
    def name
      context.name
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
shipitron-1.4.1 lib/shipitron/fetch_bucket.rb
shipitron-1.4.0 lib/shipitron/fetch_bucket.rb
shipitron-1.3.2 lib/shipitron/fetch_bucket.rb
shipitron-1.3.1 lib/shipitron/fetch_bucket.rb
shipitron-1.3.0 lib/shipitron/fetch_bucket.rb
shipitron-1.2.1 lib/shipitron/fetch_bucket.rb
shipitron-1.2.0 lib/shipitron/fetch_bucket.rb
shipitron-1.1.0 lib/shipitron/fetch_bucket.rb
shipitron-1.0.1 lib/shipitron/fetch_bucket.rb
shipitron-1.0.0 lib/shipitron/fetch_bucket.rb
shipitron-0.4.1 lib/shipitron/fetch_bucket.rb
shipitron-0.4.0 lib/shipitron/fetch_bucket.rb
shipitron-0.3.5 lib/shipitron/fetch_bucket.rb
shipitron-0.3.4 lib/shipitron/fetch_bucket.rb
shipitron-0.3.3 lib/shipitron/fetch_bucket.rb
shipitron-0.3.1 lib/shipitron/fetch_bucket.rb
shipitron-0.3.0 lib/shipitron/fetch_bucket.rb
shipitron-0.2.2 lib/shipitron/fetch_bucket.rb
shipitron-0.2.1 lib/shipitron/fetch_bucket.rb
shipitron-0.2.0 lib/shipitron/fetch_bucket.rb