Sha256: b425a7f378273c5a7f15765a04f5e32877299766f511debd27bc2aa205c6992c

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

module EbDeployer
  class Component
    attr_reader :name

    def initialize(name, env, creation_opts, eb_settings, eb_driver)
      @name = name
      @env = env
      @eb_driver = eb_driver
      @creation_opts = creation_opts
      @eb_settings = eb_settings
    end

    def cname_prefix
      @creation_opts[:cname_prefix] || default_cname_prefix
    end

    def deploy(version_label, strategy_name, eb_settings)
      strategy = create_strategy(strategy_name)
      strategy.deploy(version_label, eb_settings + @eb_settings)
    end

    def new_eb_env(suffix=nil, cname_prefix_overriding=nil)
      EbEnvironment.new(@env.app_name,
                        [@env.name, @name, suffix].compact.join('-'),
                        @eb_driver,
                        @creation_opts.merge(:cname_prefix => cname_prefix_overriding || cname_prefix))
    end

    private

    def default_cname_prefix
      [@env.app_name, @env.name, @name].join('-')
    end

    def create_strategy(strategy_name)
      DeploymentStrategy.create(self, strategy_name)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eb_deployer-0.4.1 lib/eb_deployer/component.rb