Sha256: 72d3505256669dd358932e6abc64a2704ff97255fd4e9eab6d990eaa5ad4915c

Contents?: true

Size: 872 Bytes

Versions: 11

Compression:

Stored size: 872 Bytes

Contents

module SimpleDeploy
  class Artifact

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

      @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

11 entries across 11 versions & 1 rubygems

Version Path
simple_deploy-0.6.3 lib/simple_deploy/artifact.rb
simple_deploy-0.6.2 lib/simple_deploy/artifact.rb
simple_deploy-0.6.1 lib/simple_deploy/artifact.rb
simple_deploy-0.6.0 lib/simple_deploy/artifact.rb
simple_deploy-0.5.6 lib/simple_deploy/artifact.rb
simple_deploy-0.5.5 lib/simple_deploy/artifact.rb
simple_deploy-0.5.4 lib/simple_deploy/artifact.rb
simple_deploy-0.5.3 lib/simple_deploy/artifact.rb
simple_deploy-0.5.2 lib/simple_deploy/artifact.rb
simple_deploy-0.5.1 lib/simple_deploy/artifact.rb
simple_deploy-0.5.0 lib/simple_deploy/artifact.rb