Class: EyProCli

Inherits:
Thor
  • Object
show all
Defined in:
lib/ey_pro_cli.rb

Instance Method Summary collapse

Instance Method Details

#deploy ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ey_pro_cli.rb', line 23

def deploy
  check_for_updates unless options["no-update-check"]
  environment = core_environment_for(options)
  app = core_application_for(options)

  deploy_options = {}
  deploy_options.merge!(ref: options[:ref]) if options[:ref]
  deploy_options.merge!(migrate_command: options[:migrate]) if options[:migrate]
  deploy_options.merge!(migrate_command: '') if options["no-migrate"]
  request = environment.deploy(app, deploy_options)

  puts "Deploy started to environment: #{environment.name} with application: #{app.name}"
  if options[:stream]
    request.subscribe { |m| print m["message"] if m.is_a?(Hash) }
    puts "" # fix console output from stream
  else
    request.ready!
  end

  if request.successful
    puts "Deploy successful!"
  else
    abort "Deploy failed!"
  end
end