Class: Capistrano::DataPlaneApi::Deploy::Group
- Inherits:
-
Object
- Object
- Capistrano::DataPlaneApi::Deploy::Group
- Defined in:
- lib/capistrano/data_plane_api/deploy/group.rb
Overview
Class which deploys the app to all servers in a particular HAProxy backend/group.
Class Method Summary collapse
Instance Method Summary collapse
-
#call ⇒ Boolean?
Whether the deployment has been successful.
-
#initialize(args) ⇒ Group
constructor
A new instance of Group.
Constructor Details
#initialize(args) ⇒ Group
Returns a new instance of Group.
18 19 20 21 |
# File 'lib/capistrano/data_plane_api/deploy/group.rb', line 18 def initialize(args) @args = args @deployment_stats = DeploymentStats.new end |
Class Method Details
.call(args) ⇒ void
This method returns an undefined value.
12 13 14 |
# File 'lib/capistrano/data_plane_api/deploy/group.rb', line 12 def call(args) new(args).call end |
Instance Method Details
#call ⇒ Boolean?
Returns Whether the deployment has been successful.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/capistrano/data_plane_api/deploy/group.rb', line 24 def call @backend = ::Capistrano::DataPlaneApi.find_backend(@args.group) @servers = servers(@backend) start_deployment success = nil @servers.each do |server| server_stats = @deployment_stats[server.name] puts COLORS.bold.blue("Deploying the app to `#{server.stage}` -- `#{@backend.name}:#{server.name}`") puts @args.humanized_deploy_command(server.stage) puts next if @args.test? server_stats.start_time = ::Time.now deploy_command = @args.deploy_command(server.stage) success = system deploy_command server_stats.end_time = ::Time.now server_stats.success = success next if success puts COLORS.bold.red("Command `#{deploy_command}` failed") break end return if @args.test? finish_deployment(success: success) print_summary success end |