xcskarel 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xcskarel/application.rb +2 -2
- data/lib/xcskarel/config.rb +8 -0
- data/lib/xcskarel/server.rb +14 -6
- data/lib/xcskarel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf58b04b0c57a70a57293e17fe3bb66bde17a5f8
|
4
|
+
data.tar.gz: afb87c39726475e9e85b1c04d74bef54adb7a104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f8aaa7c01000090168ef4f12445395135508928271ae0db44bd9a8f57a7e9c13b7fcf6a3b633e4189948044ae25a60b559ebaef8785a3e0779d90d2a6709b39
|
7
|
+
data.tar.gz: 9e0b9728393772d7ecef24d97162e31c10f023819fa3176fc7c9c16b7eb2b93b79ad12dee1e43630e0febbbbd5bbcfbd7477e38798e6b08c1413585f71beb7ed
|
data/lib/xcskarel/application.rb
CHANGED
@@ -52,7 +52,7 @@ module XCSKarel
|
|
52
52
|
def self.colorize(key, value)
|
53
53
|
value ||= ""
|
54
54
|
case key
|
55
|
-
when "
|
55
|
+
when "current_step"
|
56
56
|
case value
|
57
57
|
when "completed"
|
58
58
|
value = value.white
|
@@ -61,7 +61,7 @@ module XCSKarel
|
|
61
61
|
else
|
62
62
|
value = value.yellow
|
63
63
|
end
|
64
|
-
when "
|
64
|
+
when "result"
|
65
65
|
case value
|
66
66
|
when "succeeded"
|
67
67
|
value = value.green
|
data/lib/xcskarel/config.rb
CHANGED
@@ -14,6 +14,14 @@ module XCSKarel
|
|
14
14
|
(config_json['name'] || File.basename(@path).split('.').first).gsub("botconfig_", "")
|
15
15
|
end
|
16
16
|
|
17
|
+
def branch
|
18
|
+
blueprint = @json['configuration']['sourceControlBlueprint']
|
19
|
+
primary_repo_key = blueprint['DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey']
|
20
|
+
location = blueprint['DVTSourceControlWorkspaceBlueprintLocationsKey'][primary_repo_key]
|
21
|
+
# might be nil if we're pointing to a commit, for instance.
|
22
|
+
return location['DVTSourceControlBranchIdentifierKey']
|
23
|
+
end
|
24
|
+
|
17
25
|
def original_bot_name
|
18
26
|
@json['name'] || config_json['original_bot_name']
|
19
27
|
end
|
data/lib/xcskarel/server.rb
CHANGED
@@ -25,7 +25,10 @@ module XCSKarel
|
|
25
25
|
response = get_endpoint('/bots')
|
26
26
|
raise "You are unauthorized to access data on #{@host}, please check that you're passing in a correct username and password.".red if response.status == 401
|
27
27
|
raise "Failed to fetch Bots from Xcode Server at #{@host}, response: #{response.status}: #{response.body}.".red if response.status != 200
|
28
|
-
JSON.parse(response.body)['results']
|
28
|
+
bots = JSON.parse(response.body)['results']
|
29
|
+
|
30
|
+
# sort them alphabetically by name
|
31
|
+
bots.sort_by { |bot| bot['name'] }
|
29
32
|
end
|
30
33
|
|
31
34
|
def get_integrations(bot_id)
|
@@ -46,12 +49,17 @@ module XCSKarel
|
|
46
49
|
bots = self.get_bots
|
47
50
|
bots.map do |bot|
|
48
51
|
status = {}
|
49
|
-
status['
|
50
|
-
status['
|
52
|
+
status['name'] = bot['name']
|
53
|
+
status['id'] = bot['_id']
|
54
|
+
status['branch'] = XCSKarel::Config.new(bot, nil, nil).branch
|
51
55
|
last_integration = self.get_integrations(bot['_id']).first # sorted from newest to oldest
|
52
|
-
|
53
|
-
|
54
|
-
|
56
|
+
if last_integration
|
57
|
+
status['current_step'] = last_integration['currentStep']
|
58
|
+
status['result'] = last_integration['result']
|
59
|
+
status['count'] = last_integration['number']
|
60
|
+
else
|
61
|
+
status['count'] = 0
|
62
|
+
end
|
55
63
|
bot_statuses << status
|
56
64
|
end
|
57
65
|
return bot_statuses
|
data/lib/xcskarel/version.rb
CHANGED