Sha256: e78cf77d25752d4b6d367b37b31d1ac19b13f5d0d92880f1d0864d00efb3c43f

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require 'clamp'
require 'opsworks_rolling_deploy/services/deploy_service'
require 'json'
module OpsworksRollingDeploy
  module Commands
    class DeployCommand < Clamp::Command
      option "--aws-id", "AWS_ACCESS_KEY_ID", "aws access key id", environment_variable: "AWS_ACCESS_KEY_ID"
      option "--aws-secret", "AWS_SECRET_ACCESS_KEY", "aws secret access key", environment_variable: "AWS_SECRET_ACCESS_KEY"

      option "--stack", "STACK_NAME", "the stack name", required: true
      option "--app", "APP_NAME", "the application name", required: true
      option "--layer", "LAYER_NAME", "the layer name", required: false

      option "--command", "COMMAND", "the command to be executed by opsworks", default: 'deploy'
      option "--command-args", "COMMAND_ARGS", "the args to the command to be executed by opsworks as JSON (e.g. '{\"migrate\":[\"true\"]}'", default: '{}'

      option "--pretend", :flag, "pretend execution"
      option "--verbose", :flag, "display aws commands"
      option "--exclude", "PATTERN" , "wildcard pattern to exclude hosts", multivalued: true

      def execute
        OpsworksRollingDeploy.set_verbose(verbose?)
        OpsworksRollingDeploy.set_auth_default(aws_id, aws_secret) if aws_id
        Services::DeployService.new.deploy(stack, layer, app, command, JSON.parse(command_args), pretend?, exclude_list)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opsworks_rolling_deploy-0.1.5 lib/opsworks_rolling_deploy/commands/deploy_command.rb