Class: BbDeploy::Deployer

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/bb_deploy/deployer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

#chat_broadcast, logger, #slack

Constructor Details

#initialize(phase) ⇒ Deployer

Returns a new instance of Deployer.



14
15
16
17
18
# File 'lib/bb_deploy/deployer.rb', line 14

def initialize(phase)
  BbDeploy::Config.configure_from_yaml('config/deploy.yml')
  BbDeploy::Config.set_heroku_fields!(phase)
  @phase = phase
end

Instance Attribute Details

#phaseObject (readonly)

Returns the value of attribute phase.



12
13
14
# File 'lib/bb_deploy/deployer.rb', line 12

def phase
  @phase
end

Instance Method Details

#deploy!Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bb_deploy/deployer.rb', line 25

def deploy!
  BbDeploy::Git.check_git_status!
  check_access!
  staging_checks if phase == 'staging'
  prompt = "Do you want to deploy #{current_branch} to #{BbDeploy::Config.application_name} #{phase}?"
  if phase == 'production'
    do_deploy if BbDeploy::Task.ask(prompt, required_response: 'production', important: true)
  else
    do_deploy if BbDeploy::Task.ask(prompt)
  end
end