Sha256: c787237c45e88eed6016756b042f8d0ca54c2742f2972b387232be6cda790aa8

Contents?: true

Size: 836 Bytes

Versions: 3

Compression:

Stored size: 836 Bytes

Contents

require 'heirloom'

module SimpleDeploy
  class Artifact

    attr_accessor :metadata

    def initialize(args)
      @region = args[:region]
      @config = args[:config]
      @artifact = Heirloom::Artifact.new :config => @config.artifact_repository

      self.metadata = @artifact.show :name => args[:name],
                                     :id   => args[:id]
    end

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

    def s3_url
      key = "#{@region}-s3-url"
      metadata[key] ? metadata[key].first : nil
    end

    def http_url
      key = "#{@region}-http-url"
      metadata[key] ? metadata[key].first : nil
    end

    def https_url
      key = "#{@region}-https-url"
      metadata[key] ? metadata[key].first : nil
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_deploy-0.1.2 lib/simple_deploy/artifact.rb
simple_deploy-0.1.1 lib/simple_deploy/artifact.rb
simple_deploy-0.1.0 lib/simple_deploy/artifact.rb