Class: Heroku::Command::Status

Inherits:
Base
  • Object
show all
Defined in:
lib/heroku/command/status.rb

Overview

check status of pogoapp platform

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#api, #app, #heroku, #initialize, namespace

Methods included from Helpers

#action, #ask, #confirm, #confirm_billing, #confirm_command, #create_git_remote, #deprecate, #display, #display_header, #display_object, #display_row, #display_table, #error, error_with_failure, error_with_failure=, extended, extended_into, #fail, #format_bytes, #format_date, #format_error, #format_with_bang, #get_terminal_environment, #git, #has_git?, #home_directory, #host_name, #hprint, #hputs, included, included_into, #json_decode, #json_encode, #launchy, #line_formatter, #longest, #output_with_bang, #quantify, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #time_ago, #truncate, #with_tty

Constructor Details

This class inherits a constructor from Heroku::Command::Base

Instance Method Details

#indexObject

status

display current status of pogoapp platform

Example:

$ pogo status

Pogoapp Status

Development: No known issues at this time. Production: No known issues at this time.



18
19
20
21
22
23
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
# File 'lib/heroku/command/status.rb', line 18

def index
  validate_arguments!

  heroku_status_host = ENV['HEROKU_STATUS_HOST'] || "status.heroku.com"
  require('excon')
  status = json_decode(Excon.get("https://#{heroku_status_host}/api/v3/current-status.json", :nonblock => false).body)

  styled_header("Pogoapp Status")

  status['status'].each do |key, value|
    if value == 'green'
      status['status'][key] = 'No known issues at this time.'
    end
  end
  styled_hash(status['status'])

  unless status['issues'].empty?
    display
    status['issues'].each do |issue|
      duration = time_ago(issue['created_at']).gsub(' ago', '+')
      styled_header("#{issue['title']}  #{duration}")
      changes = issue['updates'].map do |issue|
        [
          time_ago(issue['created_at']),
          issue['update_type'],
          issue['contents']
        ]
      end
      styled_array(changes, :sort => false)
    end
  end
end