xcskarel 0.10.0 → 0.11.0

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: a547dddbe32f8f28af3767137ebfc4b47dd0b871
4
- data.tar.gz: a2a28673151ff2563b383738ffd8f3d4dbe42345
3
+ metadata.gz: cf58b04b0c57a70a57293e17fe3bb66bde17a5f8
4
+ data.tar.gz: afb87c39726475e9e85b1c04d74bef54adb7a104
5
5
  SHA512:
6
- metadata.gz: 93a7d7b5afd1a0478643c0ad70effc2fa01aafcf3c9d4ffcdbf4037d7e09deafef97738550c2c2eea7cd2f8d73717e4fbc9c6cc15aa44044ac580a9fa2a43b70
7
- data.tar.gz: 21502e25cffc850bd1010daadc200b70ababb16480db04953d6cc98fc5b05e96c138f3ba985b15015f423788426b12ef6a93f56ce200ff176da7a306bd12acc1
6
+ metadata.gz: 8f8aaa7c01000090168ef4f12445395135508928271ae0db44bd9a8f57a7e9c13b7fcf6a3b633e4189948044ae25a60b559ebaef8785a3e0779d90d2a6709b39
7
+ data.tar.gz: 9e0b9728393772d7ecef24d97162e31c10f023819fa3176fc7c9c16b7eb2b93b79ad12dee1e43630e0febbbbd5bbcfbd7477e38798e6b08c1413585f71beb7ed
@@ -52,7 +52,7 @@ module XCSKarel
52
52
  def self.colorize(key, value)
53
53
  value ||= ""
54
54
  case key
55
- when "integration_step"
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 "integration_result"
64
+ when "result"
65
65
  case value
66
66
  when "succeeded"
67
67
  value = value.green
@@ -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
@@ -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['bot_name'] = bot['name']
50
- status['bot_id'] = bot['_id']
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
- status['integration_step'] = last_integration['currentStep']
53
- status['integration_result'] = last_integration['result']
54
- status['integration_number'] = last_integration['number']
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
@@ -1,3 +1,3 @@
1
1
  module XCSKarel
2
- VERSION = '0.10.0'
2
+ VERSION = '0.11.0'
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.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honza Dvorsky