Class: HR_Deploy::PushCodeTask

Inherits:
Task
  • Object
show all
Defined in:
lib/hr_deploy/tasks/push_code_task.rb

Instance Attribute Summary

Attributes inherited from Task

#end_time, #error, #start_time

Instance Method Summary collapse

Methods inherited from Task

#initialize, #successful?

Constructor Details

This class inherits a constructor from HR_Deploy::Task

Instance Method Details

#reversal_instructionObject



25
26
27
28
29
30
31
# File 'lib/hr_deploy/tasks/push_code_task.rb', line 25

def reversal_instruction
  "Code was pushed\n" +
      'To list app releases: ' +
      "heroku releases --remote #{target.name}\n" +
      'To rollback if needed: ' +
      "heroku rollback [version] --remote #{target.name}"
end

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/hr_deploy/tasks/push_code_task.rb', line 7

def run
  print_stage 'Pushing new code...'

  set_start_time
  execute_system_command("git push #{target.name} master")

  if dry_run? || !confirm?
    self.success = true
    return
  end

  if confirm_successful?('New code pushed?')
    self.success = true
  else
    self.success = false
    self.error = 'Could not push new code'
  end

  def reversal_instruction
    "Code was pushed\n" +
        'To list app releases: ' +
        "heroku releases --remote #{target.name}\n" +
        'To rollback if needed: ' +
        "heroku rollback [version] --remote #{target.name}"
  end
end