Sha256: 15f54d685f6ef1a7f09089567b6830ede0def0614b7ab87cceafc9b1ad9742f3

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

module Phase
  module CLI
    class Deploy < Command

      command :deploy do |c|
        c.syntax = "phase deploy <environment_name> <version_number>"

        c.description = <<-EOS.strip_heredoc
          Builds and deploys code to the specified <environment_name>, which may be
          any environment configured in the Phasefile.
        EOS

        c.action do |args, options|
          new(args, options).run
        end
      end

      attr_reader :env_name, :version_number

      def initialize(args, options)
        super

        fail "must specify both environment and version number" unless args.count >= 2

        @env_name       = args[0]
        @version_number = args[1]

        fail "must specify environment"    unless env_name
        fail "must specify version number" unless version_number
      end

      def run
        environment = config.deploy.environments.find { |e| e.name == env_name }
        fail "unknown environment: '#{env_name}'" unless environment

        deployment = Deploy::Deployment.new(environment, version_tag: version_number)
        deployment.execute!
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
phase-1.0.2 lib/phase/cli/deploy.rb
phase-1.0.0.rc1 lib/phase/cli/deploy.rb
phase-0.0.17 lib/phase/cli/deploy.rb
phase-0.0.16.1 lib/phase/cli/deploy.rb
phase-0.0.16 lib/phase/cli/deploy.rb