Sha256: 021bff64d1728c89f34e4246fa1d0ba78f52ee3e1984259c46e95a471fa4438a

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

module EbDeployer
  class Application
    def initialize(name, eb_driver, s3_driver)
      @name = name
      @eb_driver = eb_driver
      @s3_driver = s3_driver
      raise "application name can only contain any combination of uppercase letters, lowercase letters, numbers, dashes (-)" unless @name =~ /^[a-zA-Z0-9.-]+$/
    end

    def create_version(version_label, package)
      create_application_if_not_exists

      package = Package.new(package, @name + "-packages", @s3_driver)
      package.upload

      unless @eb_driver.application_version_labels.include?(version_label)
        @eb_driver.create_application_version(@name, version_label, package.source_bundle)
      end
    end

    def delete
      if @eb_driver.application_exists?(@name)
        @eb_driver.environment_names_for_application(@name).each do |env|
          @eb_driver.delete_environment(@name, env)
        end

        @eb_driver.delete_application(@name)
      end
    end

    private

    def create_application_if_not_exists
      unless @eb_driver.application_exists?(@name)
        @eb_driver.create_application(@name)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eb_deployer-0.2.5 lib/eb_deployer/application.rb
eb_deployer-0.2.4 lib/eb_deployer/application.rb
eb_deployer-0.2.3 lib/eb_deployer/application.rb
eb_deployer-0.2.2 lib/eb_deployer/application.rb