Sha256: fd6168f3a32d138632554a655004414d9ce7d9dade1a428f103137e859dd0e64

Contents?: true

Size: 896 Bytes

Versions: 9

Compression:

Stored size: 896 Bytes

Contents

module SimpleDeploy
  class Artifact

    def initialize(args)
      @bucket_prefix = args[:bucket_prefix]
      @config = args[:config]
      @id = args[:id]
      @name = args[:name]
      @region = args[:region]

      @bucket = "#{@bucket_prefix}-#{@region}"
      @key = "#{@id}.tar.gz"
    end

    def endpoints
      {
        's3' => s3_url,
        'http' => http_url,
        'https' => https_url
      }
    end

    private

    def s3_url
      "s3://#{@bucket}/#{@name}/#{@key}"
    end

    def http_url
      "http://#{s3_endpoints[@region]}/#{@bucket}/#{@name}/#{@key}"
    end

    def https_url
      "https://#{s3_endpoints[@region]}/#{@bucket}/#{@name}/#{@key}"
    end

    def s3_endpoints
      {
        'us-east-1' => 's3.amazonaws.com',
        'us-west-1' => 's3-us-west-1.amazonaws.com',
        'us-west-2' => 's3-us-west-2.amazonaws.com'
      }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
simple_deploy-0.2.8 lib/simple_deploy/artifact.rb
simple_deploy-0.2.7 lib/simple_deploy/artifact.rb
simple_deploy-0.2.6 lib/simple_deploy/artifact.rb
simple_deploy-0.2.5 lib/simple_deploy/artifact.rb
simple_deploy-0.2.4 lib/simple_deploy/artifact.rb
simple_deploy-0.2.3 lib/simple_deploy/artifact.rb
simple_deploy-0.2.2 lib/simple_deploy/artifact.rb
simple_deploy-0.2.1 lib/simple_deploy/artifact.rb
simple_deploy-0.2.0 lib/simple_deploy/artifact.rb