Sha256: 4f28d9e5e941b8a793934f6d59f52fa02f5639676ba4b1649ca316f42ff84b26

Contents?: true

Size: 1.28 KB

Versions: 14

Compression:

Stored size: 1.28 KB

Contents

module SimpleDeploy
  class StackAttributeFormater

    def initialize(args)
      @config = args[:config]
      @environment = args[:environment]
      @region = @config.region @environment
      @logger = @config.logger
    end

    def updated_attributes(attributes)
      updates = []
      attributes.each do |attribute|
        key = attribute.keys.first
        if artifact_names.include? key
          updates << cloud_formation_url(attribute)
          @logger.info "Adding artifact attribute: #{cloud_formation_url(attribute)}"
        end
      end
      attributes + updates
    end

    def artifact_names
      @config.artifacts
    end
    
    def cloud_formation_url attribute
      name = attribute.keys.first
      id = attribute[name]
      a = @config.artifacts.select { |a| a['name'] == name }.first

      bucket_prefix = @config.artifact_bucket_prefix name
      cloud_formation_url = @config.artifact_cloud_formation_url name

      artifact = Artifact.new :name          => name,
                              :id            => id,
                              :region        => @region,
                              :config        => @config,
                              :bucket_prefix => bucket_prefix

      { cloud_formation_url => artifact.endpoints['s3'] }
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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