Module: RatDeployer::Commands::Deploy

Extended by:
RatDeployer::Command
Defined in:
lib/rat_deployer/commands/deploy.rb

Overview

This command runs ‘compose pull` and `compose up -d` for the given services. Adittionally, notifies to slack if configured to do so.

Defined Under Namespace

Modules: Extension

Class Method Summary collapse

Methods included from RatDeployer::Command

colorize_warning, do_run, put_error, put_heading, put_warning, run

Class Method Details

.deploy(*services) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/rat_deployer/commands/deploy.rb', line 29

def self.deploy(*services)
  if services.any?
    services_str = services.join(' ')
    Compose.perform("pull #{services_str}")
    Compose.perform("up -d --no-deps --force-recreate #{services_str}")
  else
    Compose.perform('pull')
    Compose.perform('up -d')
  end
end

.perform(*services) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rat_deployer/commands/deploy.rb', line 16

def self.perform(*services)
  Notifier.notify_deploy_start
  deploy(*services)
  Notifier.notify_deploy_end
rescue StandardError => e
  Notifier.notify <<-STR.strip_heredoc
    Failed deploy on #{Config.env}
    Reason:
      #{e.message}
  STR
  raise e
end