Sha256: cb5698d64b49d3b85713cfbd405407d310ec7174a974c294ecdb26e08c07ced2

Contents?: true

Size: 948 Bytes

Versions: 15

Compression:

Stored size: 948 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

15 entries across 15 versions & 1 rubygems

Version Path
simple_deploy-0.4.5 lib/simple_deploy/artifact.rb
simple_deploy-0.4.5.rc.0 lib/simple_deploy/artifact.rb
simple_deploy-0.4.4 lib/simple_deploy/artifact.rb
simple_deploy-0.4.3 lib/simple_deploy/artifact.rb
simple_deploy-0.4.2 lib/simple_deploy/artifact.rb
simple_deploy-0.4.1 lib/simple_deploy/artifact.rb
simple_deploy-0.4.0 lib/simple_deploy/artifact.rb
simple_deploy-0.3.7 lib/simple_deploy/artifact.rb
simple_deploy-0.3.6 lib/simple_deploy/artifact.rb
simple_deploy-0.3.5 lib/simple_deploy/artifact.rb
simple_deploy-0.3.4 lib/simple_deploy/artifact.rb
simple_deploy-0.3.3 lib/simple_deploy/artifact.rb
simple_deploy-0.3.2 lib/simple_deploy/artifact.rb
simple_deploy-0.3.1 lib/simple_deploy/artifact.rb
simple_deploy-0.3.0 lib/simple_deploy/artifact.rb