Class: Paratrooper::Notifiers::ScreenNotifier

Inherits:
Paratrooper::Notifier show all
Defined in:
lib/paratrooper/notifiers/screen_notifier.rb

Overview

Public: Default notifier for outputting messages to screen.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Paratrooper::Notifier

#notify, #setup, #teardown, #warm_instance

Constructor Details

#initialize(output = STDOUT) ⇒ ScreenNotifier

Public: Initializes ScreenNotifier

output - IO object (default: STDOUT)



14
15
16
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 14

def initialize(output = STDOUT)
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



9
10
11
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 9

def output
  @output
end

Instance Method Details

#activate_maintenance_mode(options = {}) ⇒ Object



38
39
40
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 38

def activate_maintenance_mode(options = {})
  display("Activating Maintenance Mode - Enabled due to pending migrations")
end

#app_restart(options = {}) ⇒ Object



63
64
65
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 63

def app_restart(options = {})
  display("Restarting application")
end

#deactivate_maintenance_mode(options = {}) ⇒ Object



42
43
44
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 42

def deactivate_maintenance_mode(options = {})
  display("Deactivating Maintenance Mode")
end

#deploy_finished(options = {}) ⇒ Object



67
68
69
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 67

def deploy_finished(options = {})
  display("Deploy finished")
end

#display(message) ⇒ Object

Public: Displays message with decoration

message - String message to be displayed

Examples

display("Excellent Message")
# =>
# => =============================================================
# => >> Excellent Message
# => =============================================================
# =>


30
31
32
33
34
35
36
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 30

def display(message)
  output.puts
  output.puts "=" * 60
  output.puts ">> #{message}"
  output.puts "=" * 60
  output.puts
end

#push_repo(options = {}) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 50

def push_repo(options = {})
  desc = "#{options[:reference_point]} to #{options[:app_name]} on Heroku"
  if options[:force]
    display("Force pushing #{desc}")
  else
    display("Pushing #{desc}")
  end
end

#run_migrations(options = {}) ⇒ Object



59
60
61
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 59

def run_migrations(options = {})
  display("Running database migrations")
end

#update_repo_tag(options = {}) ⇒ Object



46
47
48
# File 'lib/paratrooper/notifiers/screen_notifier.rb', line 46

def update_repo_tag(options = {})
  display("Updating Repo Tag: #{options[:reference_point]}")
end