Sha256: 3149272ebd456a7208ccb7b1a9cd6436c4c6253be3c304f2ded8b1f2395a45e9

Contents?: true

Size: 1.94 KB

Versions: 6

Compression:

Stored size: 1.94 KB

Contents

require 'trollop'

module SimpleDeploy
  module CLI
    class Deploy
      def deploy
        opts = Trollop::options do
          version SimpleDeploy::VERSION
          banner <<-EOS

Execute deployment on given stack(s).

simple_deploy deploy -n STACK_NAME -n STACK_NAME -e ENVIRONMENT

EOS
          opt :help, "Display Help"
          opt :attributes, "= seperated attribute and it's value", :type  => :string,
                                                                   :multi => true
          opt :environment, "Set the target environment", :type => :string
          opt :force, "Force a deployment to proceed"
          opt :log_level, "Log level:  debug, info, warn, error", :type    => :string,
                                                                  :default => 'info'
          opt :name, "Stack name(s) of stack to deploy", :type => :string,
                                                         :multi => true
          opt :quiet, "Quiet, do not send notifications"
        end

        CLI::Shared.valid_options? :provided => opts,
                                   :required => [:environment, :name]

        logger = SimpleDeployLogger.new :log_level => opts[:log_level]

        new_attributes = CLI::Shared.parse_attributes :attributes => opts[:attributes],
                                                      :logger     => logger
        opts[:name].each do |name|
          notifier = Notifier.new :stack_name  => name,
                                  :environment => opts[:environment],
                                  :logger      => logger

          stack = Stack.new :environment => opts[:environment],
                            :name        => name,
                            :logger      => logger

          stack.update(:attributes => new_attributes) if new_attributes.any?
          stack.deploy opts[:force]

          notifier.send_deployment_complete_message unless opts[:quiet]
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
simple_deploy-0.4.5 lib/simple_deploy/cli/deploy.rb
simple_deploy-0.4.5.rc.0 lib/simple_deploy/cli/deploy.rb
simple_deploy-0.4.4 lib/simple_deploy/cli/deploy.rb
simple_deploy-0.4.3 lib/simple_deploy/cli/deploy.rb
simple_deploy-0.4.2 lib/simple_deploy/cli/deploy.rb
simple_deploy-0.4.1 lib/simple_deploy/cli/deploy.rb