-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9a1aa8e
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Heroku status | ||
|
||
Displays current status of the Heroku platform. | ||
|
||
## Installation | ||
|
||
$ heroku plugins:install git://github.com/geemus/heroku-status.git | ||
|
||
## Usage | ||
|
||
To use simply call: | ||
|
||
$ heroku status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'heroku/command/base' | ||
require 'commands/status' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# display status of Heroku | ||
# | ||
class Heroku::Command::Status < Heroku::Command::Base | ||
|
||
# status | ||
# | ||
# display current status of Heroku platform | ||
# | ||
def index | ||
uri = URI.parse('https://status.heroku.com/status.json') | ||
http = Net::HTTP.new(uri.host, uri.port) | ||
http.use_ssl = true | ||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | ||
|
||
request = Net::HTTP::Get.new(uri.request_uri) | ||
|
||
response = http.request(request) | ||
status = json_decode(response.body) | ||
|
||
display('') | ||
if status.values.all? {|value| value == 'green'} | ||
display(" All Systems Go: No known issues at this time.") | ||
else | ||
status.each do |key, value| | ||
display(" #{key}: #{value}") | ||
end | ||
uri = URI.parse('https://status.heroku.com/feed') | ||
http = Net::HTTP.new(uri.host, uri.port) | ||
http.use_ssl = true | ||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | ||
|
||
request = Net::HTTP::Get.new(uri.request_uri) | ||
|
||
response = http.request(request) | ||
entries = REXML::Document.new(response.body).elements.to_a("//entry") | ||
entry = entries.first | ||
display('') | ||
display(' ' + entry.elements['title'].text) | ||
display(' ' + entry.elements['content'].text.gsub(/\n\n/, "\n ").gsub(/<[^>]*>/, '')) | ||
end | ||
display('') | ||
|
||
end | ||
|
||
end |