Sha256: 0daa503b8935ddc858e81e71793b9fbbe8aee7b59fbb544cc40ebe9247f4a28a

Contents?: true

Size: 1005 Bytes

Versions: 1

Compression:

Stored size: 1005 Bytes

Contents

module Opsicle
  class Deploy
    attr_reader :client

    def initialize(environment)
      @environment = environment
      @client = Client.new(environment)
    end

    def execute(options={})
      response = client.run_command('deploy')

      if options[:browser]
        open_deploy(response[:deployment_id])
      end

      if options[:monitor]
        @monitor = Opsicle::Monitor::App.new(@environment, options)

        begin
          @monitor.start
        rescue => e
          say "<%= color('Uh oh, an error occurred while starting the Opsicle Stack Monitor.', RED) %>"
          say "<%= color('Use --trace to view stack trace.', RED) %>"

          if options.trace
            raise
          end
        end
      end
    end

    def open_deploy(deployment_id)
      if deployment_id
        exec "open 'https://console.aws.amazon.com/opsworks/home?#/stack/#{client.config.opsworks_config[:stack_id]}/deployments'"
      else
        puts 'deploy failed'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opsicle-0.2.1 lib/opsicle/commands/deploy.rb