Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit

  • Loading branch information...
commit 9a1aa8ec6fd99a28efcb2097b2170bd0b5a9a73d 0 parents
@geemus authored
Showing with 60 additions and 0 deletions.
  1. +13 −0 README.markdown
  2. +2 −0  init.rb
  3. +45 −0 lib/commands/status.rb
13 README.markdown
@@ -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
2  init.rb
@@ -0,0 +1,2 @@
+require 'heroku/command/base'
+require 'commands/status'
45 lib/commands/status.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.