Sha256: 48cbef0ef5c73c71d0eb5e508633430a941cec8682d0ccdea296c64c17c95e05

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

require 'opsworks/deployment'

module OpsWorks
  module CLI
    module Subcommands
      module Deploy
        # rubocop:disable MethodLength
        # rubocop:disable CyclomaticComplexity
        def self.included(thor)
          thor.class_eval do
            desc 'deploy APP [--stack STACK]', 'Deploy an OpsWorks app'
            option :stack, type: :array
            def deploy(name)
              fetch_keychain_credentials unless env_credentials?
              stacks = parse_stacks(options.merge(active: true))
              deployments = stacks.map do |stack|
                next unless (app = stack.find_app_by_name(name))
                say "Deploying to #{stack.name}..."
                stack.deploy_app(app)
              end
              deployments.compact!
              OpsWorks::Deployment.wait(deployments)
              unless deployments.all?(&:success?)
                failures = []
                deployments.each_with_index do |deployment, i|
                  failures << stacks[i].name unless deployment.success?
                end
                fail "Deploy failed on #{failures.join(', ')}"
              end
            end
          end
        end
        # rubocop:enable CyclomaticComplexity
        # rubocop:enable MethodLength
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opsworks-cli-0.2.4 lib/opsworks/cli/subcommands/deploy.rb
opsworks-cli-0.2.3 lib/opsworks/cli/subcommands/deploy.rb
opsworks-cli-0.2.2 lib/opsworks/cli/subcommands/deploy.rb