Sha256: cbfa258d42086936c1bc9b7bd3587ffed5503d457c022ea2ad050810c850f276

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 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

2 entries across 2 versions & 1 rubygems

Version Path
opsworks_rolling_deploy-0.1.4 lib/opsworks_rolling_deploy/commands/deploy_command.rb
opsworks_rolling_deploy-0.1.3 lib/opsworks_rolling_deploy/commands/deploy_command.rb