xcskarel 0.3 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0c5a62e07ba83314f4c8837c2994722d02285cd
4
- data.tar.gz: 497b7601779a4f216aa0c8be5dfdd214daa298c2
3
+ metadata.gz: 6af488d80910f9ee7f28c8760bc09018a0163c55
4
+ data.tar.gz: 54c6dffe9173bee13c2b96caa5bd61b8141da76d
5
5
  SHA512:
6
- metadata.gz: 248a370dca81fa6ef007d94b2de6320b2738c3eef8cd26d6917644462ca0e61b6ddd6afdddffc3f8371fdcb7a622591879729850c3800f075368f7a71cf00382
7
- data.tar.gz: c67fe583a47c9336d169cd357891d9e8f5110393057dbe934dd5545a44ab23c8b5613cbb0c0e98bdf23c77088cf48b5c63ca65c8231181c24c52c09bd07adfa5
6
+ metadata.gz: 1b1a79f3a81df97a677f234c35d7667ac6742e6cb07f67eb200e24daca88544ffab15a0673ba79ab33d2eda88cedc61da2f208b5bca499d10d81c0911865fafa
7
+ data.tar.gz: 866283bd79ff5ae6727fe42ac2193f0a3580c865119925ded8f40e75d59460c77211fcdd83051fc0ca991eee0ebbb6e12e2d8ee459907042cb9c1cf1f5a63e07
data/bin/xcskarel CHANGED
@@ -68,6 +68,22 @@ class XCSKarelApplication
68
68
  end
69
69
  end
70
70
 
71
+ command :health do |c|
72
+ c.syntax = 'xcskarel health [options]'
73
+ c.description = 'Fetches health information of the specified server'
74
+ c.example 'get health', 'xcskarel health --hostname 127.0.0.1'
75
+ add_xcs_options(c)
76
+ c.action do |args, options|
77
+ server = create_server_from_options(options)
78
+ all_health = server.get_health
79
+ unless options.no_filter
80
+ all_health = XCSKarel.filter_key_paths(all_health, ['uptime'])
81
+ end
82
+ out = options.no_pretty ? JSON.generate(all_health) : JSON.pretty_generate(all_health)
83
+ puts out
84
+ end
85
+ end
86
+
71
87
  command :'server start' do |c|
72
88
  c.syntax = 'xcskarel server start [options]'
73
89
  c.description = 'Start local Xcode Server'
data/lib/karel/server.rb CHANGED
@@ -34,6 +34,12 @@ module XCSKarel
34
34
  JSON.parse(response.body)['results']
35
35
  end
36
36
 
37
+ def get_health
38
+ response = get_endpoint("/health")
39
+ raise "Failed to get Health of #{@host}" if response.status != 200
40
+ JSON.parse(response.body)
41
+ end
42
+
37
43
  def headers
38
44
  headers = {
39
45
  'user-agent' => 'xcskarel', # XCS wants user agent. for some API calls. not for others. sigh.
data/lib/karel/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module XCSKarel
2
- VERSION = '0.3'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcskarel
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honza Dvorsky