Skip to content

Instantly share code, notes, and snippets.

@happyrobots
Created December 4, 2011 13:59
Show Gist options
  • Save happyrobots/1430267 to your computer and use it in GitHub Desktop.
Save happyrobots/1430267 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
heroku_status_url = "https://status.heroku.com"
doc = Nokogiri::HTML(open(heroku_status_url))
problems, problem_types = [], { "app" => "App Operations", "tools" => "Tools" }
problem_types.each_pair do |key, name|
is_having_issue = doc.css("div#open ol.status li.#{key}.green").empty?
problems << name if is_having_issue
end
exit if problems.empty?
verb = problems.size == 1 ? "is" : "are"
alert = "It looks like Heroku #{problems.join(' and ')} #{verb} having some issues."
`open #{heroku_status_url} ; say #{alert}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment