def run
say "Connected to #{openshift_server}"
if openshift_online_server?
status = rest_client.request(:method => :get, :url => "#{openshift_url}/app/status/status.json", :lazy_auth => true){ |res| decode_json(res.content) }
open = status['open']
(success 'All systems running fine' and return 0) if open.blank?
open.each do |i|
i = i['issue']
say color("%-3s %s" % ["##{i['id']}", i['title']], :bold)
items = i['updates'].map{ |u| [u['description'], date(u['created_at'])] }
items.unshift ['Opened', date(i['created_at'])]
table(items, :align => [nil,:right], :join => ' ').each{ |s| say " #{s}" }
end
say "\n"
warn pluralize(open.length, "open issue")
open.length
else
success "Using API version #{rest_client.api_version_negotiated}"
0
end
end