Sha256: 8d6e420e13511248de3e554161db29f5433a0ecd0351b762217123ab5c58793e

Contents?: true

Size: 918 Bytes

Versions: 3

Compression:

Stored size: 918 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]
      @domain = @config.artifact_domain @name

      @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}/#{@domain}/#{@key}"
    end

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

    def https_url
      "https://#{s3_endpoints[@region]}/#{@bucket}/#{@domain}/#{@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

3 entries across 3 versions & 1 rubygems

Version Path
simple_deploy-0.4.8 lib/simple_deploy/artifact.rb
simple_deploy-0.4.7 lib/simple_deploy/artifact.rb
simple_deploy-0.4.6 lib/simple_deploy/artifact.rb