diff options
| author | Zack Hobson | 2015-06-03 14:28:59 -0700 | 
|---|---|---|
| committer | Zack Hobson | 2015-06-03 14:28:59 -0700 | 
| commit | f84412ec5190ba7fa7ffced8830da8b1b1ced0d9 (patch) | |
| tree | 4e70dcd62c248b3ed03fa21ec766c946cd6d3802 | |
| parent | 390c49c92549aadbfbe080b14346918c9ccdfc75 (diff) | |
| parent | 7c025df3c27c3090417d2fdbb174ad0942e24d86 (diff) | |
| download | hcl-f84412ec5190ba7fa7ffced8830da8b1b1ced0d9.tar.bz2 | |
Merge pull request #65 from asymmetric/status
Fix `hcl status` 
| -rw-r--r-- | lib/hcl/commands.rb | 11 | 
1 files changed, 7 insertions, 4 deletions
| diff --git a/lib/hcl/commands.rb b/lib/hcl/commands.rb index 5b69d45..9800c95 100644 --- a/lib/hcl/commands.rb +++ b/lib/hcl/commands.rb @@ -12,12 +12,15 @@ module HCl      # Show the network status of the Harvest service.      def status -      result = Faraday.new("http://harveststatus.com/") do |f| -        f.use :harvest, '', '' +      result = Faraday.new("http://kccljmymlslr.statuspage.io/api/v2") do |f|          f.adapter Faraday.default_adapter        end.get('status.json').body -      date = Time.at(result[:last_check_time].to_i) -      "Harvest is #{result[:status]}, response time: #{result[:last_response_time]}ms. [#{date}]" + +      json = Yajl::Parser.parse result, symbolize_keys: true +      status = json[:status][:description] +      updated_at = DateTime.parse(json[:page][:updated_at]).strftime "%F %T %:z" + +      "#{status} [#{updated_at}]"      end      def console | 
