circleci-cli 4.0.0 → 4.0.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
  SHA256:
3
- metadata.gz: 731ca5b1c5a4ea5b73bf0757c37fc83fe13f197069c22c965de5bbe055357dd9
4
- data.tar.gz: 58b7984a871d7d2aac0bfed50c8b0f1e2b30b70d533485e386ae8c7cfdb8b432
3
+ metadata.gz: 90b6ab11da48868d2be56bf5dc12f260e4eccb095088c43afb1fff9e39ec547e
4
+ data.tar.gz: c7b1c2584bd04a9719d6e349c84f00f5b5d203412ebb537c774ae9d8ebdf6e24
5
5
  SHA512:
6
- metadata.gz: eaa50c9c638f86a0e3870f252276f1dad8507955dd1220fd4caf0d4e64e53157b74b1981deefef1719bfdc63e1d9fce7c9b0565f52d01e032eb8f6866a38dc31
7
- data.tar.gz: 9d3e1a28d7c4b63fec6577d33a3edb9ff001c19f3386c2dc8efd2da4c7dad3f5f8e8a6686b99483ee7de7633737e8327d647dc9da351fc3f45b560efd9900960
6
+ metadata.gz: 7e6ec3d626733e32229477cbe3fabcb11404b9014a4be827d49d0ce053b1a6079ee501c7d8f48b15ec2a7f44965ed8c7930df6c5086a706c2c6c9796be34b4e5
7
+ data.tar.gz: 2c779a15909f96203c82ebe5260e3770ae7079f5714e77462392e5f8f19b4457a804b1f3e36c872f29180655150819a8f26e348d69cdc8d9264cc79eb2e2d60b
data/.rubocop.yml CHANGED
@@ -5,7 +5,7 @@ AllCops:
5
5
  Style/Documentation:
6
6
  Enabled: false
7
7
 
8
- Styyle/OpenStructUse:
8
+ Style/OpenStructUse:
9
9
  Enabled: false
10
10
 
11
11
  Layout/LineLength:
data/Gemfile.lock CHANGED
@@ -1,87 +1,88 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- circleci-cli (4.0.0)
4
+ circleci-cli (4.0.1)
5
5
  circleci (>= 2.1.0)
6
- faraday (>= 0.14, < 2.8)
7
- highline (>= 1.7.8, < 2.2.0)
8
- launchy (>= 2.4.3, < 3.1.0)
6
+ faraday (>= 0.14, < 2.14)
7
+ highline (>= 1.7.8, < 3.2.0)
8
+ launchy (>= 2.4.3, < 3.2.0)
9
9
  pusher-client (~> 0.6.2)
10
- rugged (>= 0.26, < 1.8)
10
+ rugged (>= 0.26, < 1.10)
11
11
  terminal-notifier (~> 2.0.0)
12
- terminal-table (>= 1.8, < 3.1)
13
- thor (>= 0.20, < 1.3)
12
+ terminal-table (>= 1.8, < 4.1)
13
+ thor (>= 0.20, < 1.4)
14
14
 
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
18
  abbrev (0.1.2)
19
- activesupport (6.1.7.6)
20
- concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ activesupport (7.2.2.1)
20
+ base64
21
+ benchmark (>= 0.3)
22
+ bigdecimal
23
+ concurrent-ruby (~> 1.0, >= 1.3.1)
24
+ connection_pool (>= 2.2.5)
25
+ drb
21
26
  i18n (>= 1.6, < 2)
27
+ logger (>= 1.4.2)
22
28
  minitest (>= 5.1)
23
- tzinfo (~> 2.0)
24
- zeitwerk (~> 2.3)
25
- addressable (2.8.6)
26
- public_suffix (>= 2.0.2, < 6.0)
27
- ast (2.4.2)
28
- async (1.32.1)
29
- console (~> 1.10)
30
- nio4r (~> 2.3)
31
- timers (~> 4.1)
32
- async-http (0.60.2)
33
- async (>= 1.25)
34
- async-io (>= 1.28)
35
- async-pool (>= 0.2)
36
- protocol-http (~> 0.24.0)
37
- protocol-http1 (~> 0.15.0)
38
- protocol-http2 (~> 0.15.0)
39
- traces (>= 0.10.0)
40
- async-http-faraday (0.12.0)
29
+ securerandom (>= 0.3)
30
+ tzinfo (~> 2.0, >= 2.0.5)
31
+ addressable (2.8.7)
32
+ public_suffix (>= 2.0.2, < 7.0)
33
+ ast (2.4.3)
34
+ async (2.24.0)
35
+ console (~> 1.29)
36
+ fiber-annotation
37
+ io-event (~> 1.9)
38
+ metrics (~> 0.12)
39
+ traces (~> 0.15)
40
+ async-http (0.88.0)
41
+ async (>= 2.10.2)
42
+ async-pool (~> 0.9)
43
+ io-endpoint (~> 0.14)
44
+ io-stream (~> 0.6)
45
+ metrics (~> 0.12)
46
+ protocol-http (~> 0.49)
47
+ protocol-http1 (~> 0.30)
48
+ protocol-http2 (~> 0.22)
49
+ traces (~> 0.10)
50
+ async-http-faraday (0.22.0)
41
51
  async-http (~> 0.42)
42
52
  faraday
43
- async-io (1.43.2)
44
- async
45
- async-pool (0.4.0)
53
+ async-pool (0.10.3)
46
54
  async (>= 1.25)
47
55
  base64 (0.3.0)
48
- childprocess (5.0.0)
56
+ benchmark (0.4.1)
57
+ bigdecimal (3.2.2)
58
+ childprocess (5.1.0)
59
+ logger (~> 1.5)
49
60
  circleci (2.1.0)
50
61
  codecov (0.6.0)
51
62
  simplecov (>= 0.15, < 0.22)
52
63
  coderay (1.1.3)
53
- concurrent-ruby (1.3.1)
54
- console (1.15.3)
55
- fiber-local
56
- diff-lcs (1.5.1)
57
- docile (1.4.0)
58
- faraday (1.10.3)
59
- faraday-em_http (~> 1.0)
60
- faraday-em_synchrony (~> 1.0)
61
- faraday-excon (~> 1.1)
62
- faraday-httpclient (~> 1.0)
63
- faraday-multipart (~> 1.0)
64
- faraday-net_http (~> 1.0)
65
- faraday-net_http_persistent (~> 1.0)
66
- faraday-patron (~> 1.0)
67
- faraday-rack (~> 1.0)
68
- faraday-retry (~> 1.0)
69
- ruby2_keywords (>= 0.0.4)
70
- faraday-em_http (1.0.0)
71
- faraday-em_synchrony (1.0.0)
72
- faraday-excon (1.1.0)
64
+ concurrent-ruby (1.3.5)
65
+ connection_pool (2.5.3)
66
+ console (1.30.2)
67
+ fiber-annotation
68
+ fiber-local (~> 1.1)
69
+ json
70
+ diff-lcs (1.6.2)
71
+ docile (1.4.1)
72
+ drb (2.2.3)
73
+ faraday (2.13.2)
74
+ faraday-net_http (>= 2.0, < 3.5)
75
+ json
76
+ logger
73
77
  faraday-http-cache (2.5.1)
74
78
  faraday (>= 0.8)
75
- faraday-httpclient (1.0.1)
76
- faraday-multipart (1.0.4)
77
- multipart-post (~> 2)
78
- faraday-net_http (1.0.1)
79
- faraday-net_http_persistent (1.2.0)
80
- faraday-patron (1.0.0)
81
- faraday-rack (1.0.0)
82
- faraday-retry (1.0.3)
83
- ffi (1.17.0)
84
- fiber-local (1.0.0)
79
+ faraday-net_http (3.4.1)
80
+ net-http (>= 0.5.0)
81
+ ffi (1.17.2)
82
+ fiber-annotation (0.2.0)
83
+ fiber-local (1.1.0)
84
+ fiber-storage
85
+ fiber-storage (1.0.1)
85
86
  formatador (1.1.0)
86
87
  github_changelog_generator (1.16.4)
87
88
  activesupport
@@ -92,12 +93,14 @@ GEM
92
93
  octokit (~> 4.6)
93
94
  rainbow (>= 2.2.1)
94
95
  rake (>= 10.0)
95
- guard (2.18.1)
96
+ guard (2.19.1)
96
97
  formatador (>= 0.2.4)
97
98
  listen (>= 2.7, < 4.0)
99
+ logger (~> 1.6)
98
100
  lumberjack (>= 1.0.12, < 2.0)
99
101
  nenv (~> 0.1)
100
102
  notiffany (~> 0.0)
103
+ ostruct (~> 0.6)
101
104
  pry (>= 0.13.0)
102
105
  shellany (~> 0.0)
103
106
  thor (>= 0.18.1)
@@ -109,103 +112,120 @@ GEM
109
112
  guard-rubocop (1.5.0)
110
113
  guard (~> 2.0)
111
114
  rubocop (< 2.0)
112
- highline (2.1.0)
113
- i18n (1.14.5)
115
+ highline (3.1.2)
116
+ reline
117
+ i18n (1.14.7)
114
118
  concurrent-ruby (~> 1.0)
115
- json (2.7.2)
116
- launchy (3.0.1)
119
+ io-console (0.8.0)
120
+ io-endpoint (0.15.2)
121
+ io-event (1.11.2)
122
+ io-stream (0.6.1)
123
+ json (2.12.2)
124
+ language_server-protocol (3.17.0.5)
125
+ launchy (3.1.1)
117
126
  addressable (~> 2.8)
118
127
  childprocess (~> 5.0)
128
+ logger (~> 1.6)
129
+ lint_roller (1.1.0)
119
130
  listen (3.9.0)
120
131
  rb-fsevent (~> 0.10, >= 0.10.3)
121
132
  rb-inotify (~> 0.9, >= 0.9.10)
133
+ logger (1.7.0)
122
134
  lumberjack (1.2.10)
123
135
  method_source (1.1.0)
124
- minitest (5.15.0)
136
+ metrics (0.12.2)
137
+ minitest (5.25.5)
125
138
  multi_json (1.15.0)
126
- multipart-post (2.4.1)
127
139
  nenv (0.3.0)
128
- nio4r (2.7.3)
140
+ net-http (0.6.0)
141
+ uri
129
142
  notiffany (0.1.3)
130
143
  nenv (~> 0.1)
131
144
  shellany (~> 0.0)
132
145
  octokit (4.25.1)
133
146
  faraday (>= 1, < 3)
134
147
  sawyer (~> 0.9)
135
- parallel (1.24.0)
136
- parser (3.3.2.0)
148
+ ostruct (0.6.2)
149
+ parallel (1.27.0)
150
+ parser (3.3.8.0)
137
151
  ast (~> 2.4.1)
138
152
  racc
139
- protocol-hpack (1.4.2)
140
- protocol-http (0.24.7)
141
- protocol-http1 (0.15.1)
153
+ prism (1.4.0)
154
+ protocol-hpack (1.5.1)
155
+ protocol-http (0.49.0)
156
+ protocol-http1 (0.34.0)
142
157
  protocol-http (~> 0.22)
143
- protocol-http2 (0.15.1)
158
+ protocol-http2 (0.22.1)
144
159
  protocol-hpack (~> 1.4)
145
- protocol-http (~> 0.18)
146
- pry (0.14.2)
160
+ protocol-http (~> 0.47)
161
+ pry (0.15.2)
147
162
  coderay (~> 1.1)
148
163
  method_source (~> 1.0)
149
- public_suffix (4.0.7)
164
+ public_suffix (6.0.2)
150
165
  pusher-client (0.6.2)
151
166
  json
152
167
  websocket (~> 1.0)
153
- racc (1.8.0)
168
+ racc (1.8.1)
154
169
  rainbow (3.1.1)
155
- rake (13.2.1)
170
+ rake (13.3.0)
156
171
  rb-fsevent (0.11.2)
157
172
  rb-inotify (0.11.1)
158
173
  ffi (~> 1.0)
159
- regexp_parser (2.9.2)
160
- rexml (3.3.9)
161
- rspec (3.13.0)
174
+ regexp_parser (2.10.0)
175
+ reline (0.6.1)
176
+ io-console (~> 0.5)
177
+ rspec (3.13.1)
162
178
  rspec-core (~> 3.13.0)
163
179
  rspec-expectations (~> 3.13.0)
164
180
  rspec-mocks (~> 3.13.0)
165
- rspec-core (3.13.0)
181
+ rspec-core (3.13.5)
166
182
  rspec-support (~> 3.13.0)
167
- rspec-expectations (3.13.0)
183
+ rspec-expectations (3.13.5)
168
184
  diff-lcs (>= 1.2.0, < 2.0)
169
185
  rspec-support (~> 3.13.0)
170
- rspec-mocks (3.13.1)
186
+ rspec-mocks (3.13.5)
171
187
  diff-lcs (>= 1.2.0, < 2.0)
172
188
  rspec-support (~> 3.13.0)
173
- rspec-support (3.13.1)
174
- rubocop (1.28.2)
189
+ rspec-support (3.13.4)
190
+ rubocop (1.78.0)
191
+ json (~> 2.3)
192
+ language_server-protocol (~> 3.17.0.2)
193
+ lint_roller (~> 1.1.0)
175
194
  parallel (~> 1.10)
176
- parser (>= 3.1.0.0)
195
+ parser (>= 3.3.0.2)
177
196
  rainbow (>= 2.2.2, < 4.0)
178
- regexp_parser (>= 1.8, < 3.0)
179
- rexml
180
- rubocop-ast (>= 1.17.0, < 2.0)
197
+ regexp_parser (>= 2.9.3, < 3.0)
198
+ rubocop-ast (>= 1.45.1, < 2.0)
181
199
  ruby-progressbar (~> 1.7)
182
- unicode-display_width (>= 1.4.0, < 3.0)
183
- rubocop-ast (1.17.0)
184
- parser (>= 3.1.1.0)
200
+ unicode-display_width (>= 2.4.0, < 4.0)
201
+ rubocop-ast (1.45.1)
202
+ parser (>= 3.3.7.2)
203
+ prism (~> 1.4)
185
204
  ruby-progressbar (1.13.0)
186
- ruby2_keywords (0.0.5)
187
- rugged (1.7.2)
205
+ rugged (1.9.0)
188
206
  sawyer (0.9.2)
189
207
  addressable (>= 2.3.5)
190
208
  faraday (>= 0.17.3, < 3)
209
+ securerandom (0.4.1)
191
210
  shellany (0.0.1)
192
211
  simplecov (0.21.2)
193
212
  docile (~> 1.1)
194
213
  simplecov-html (~> 0.11)
195
214
  simplecov_json_formatter (~> 0.1)
196
- simplecov-html (0.12.3)
215
+ simplecov-html (0.13.1)
197
216
  simplecov_json_formatter (0.1.4)
198
217
  terminal-notifier (2.0.0)
199
- terminal-table (3.0.2)
200
- unicode-display_width (>= 1.1.1, < 3)
201
- thor (1.2.2)
202
- timers (4.3.5)
203
- traces (0.11.1)
218
+ terminal-table (4.0.0)
219
+ unicode-display_width (>= 1.1.1, < 4)
220
+ thor (1.3.2)
221
+ traces (0.15.2)
204
222
  tzinfo (2.0.6)
205
223
  concurrent-ruby (~> 1.0)
206
- unicode-display_width (2.5.0)
207
- websocket (1.2.10)
208
- zeitwerk (2.6.15)
224
+ unicode-display_width (3.1.4)
225
+ unicode-emoji (~> 4.0, >= 4.0.4)
226
+ unicode-emoji (4.0.4)
227
+ uri (1.0.3)
228
+ websocket (1.2.11)
209
229
 
210
230
  PLATFORMS
211
231
  ruby
data/circleci-cli.gemspec CHANGED
@@ -6,14 +6,14 @@ require 'circleci/cli/version'
6
6
 
7
7
  def production_dependency(spec)
8
8
  spec.add_dependency 'circleci', '>= 2.1.0'
9
- spec.add_dependency 'faraday', '>= 0.14', '< 2.8'
10
- spec.add_dependency 'highline', '>= 1.7.8', '< 2.2.0'
11
- spec.add_dependency 'launchy', '>= 2.4.3', '< 3.1.0'
9
+ spec.add_dependency 'faraday', '>= 0.14', '< 2.14'
10
+ spec.add_dependency 'highline', '>= 1.7.8', '< 3.2.0'
11
+ spec.add_dependency 'launchy', '>= 2.4.3', '< 3.2.0'
12
12
  spec.add_dependency 'pusher-client', '~> 0.6.2'
13
- spec.add_dependency 'rugged', '>= 0.26', '< 1.8'
13
+ spec.add_dependency 'rugged', '>= 0.26', '< 1.10'
14
14
  spec.add_dependency 'terminal-notifier', '~> 2.0.0'
15
- spec.add_dependency 'terminal-table', '>= 1.8', '< 3.1'
16
- spec.add_dependency 'thor', '>= 0.20', '< 1.3'
15
+ spec.add_dependency 'terminal-table', '>= 1.8', '< 4.1'
16
+ spec.add_dependency 'thor', '>= 0.20', '< 1.4'
17
17
  end
18
18
 
19
19
  def development_dependency(spec)
@@ -30,8 +30,8 @@ module CircleCI
30
30
  def builds_to_show
31
31
  @builds
32
32
  .reject { |build| @build_numbers_shown.include?(build.build_number) }
33
- .select { |build| @branch.nil? || build.branch.to_s == @branch.to_s }
34
- .select { |build| @user.nil? || build.user.to_s == @user.to_s }
33
+ .select { |build| @branch.nil? || build.branch == @branch }
34
+ .select { |build| @user.nil? || build.user == @user }
35
35
  .sort_by(&:build_number)
36
36
  end
37
37
 
@@ -10,50 +10,109 @@ module CircleCI
10
10
  @build = build
11
11
  @verbose = verbose
12
12
  @messages = Hash.new { |h, k| h[k] = [] }
13
+
14
+ @build_thread = nil
15
+
16
+ @steps = build.steps
17
+ @current_step = nil
18
+ @read_byte = 0
13
19
  end
14
20
 
15
21
  def start
16
- bind_event_handling @build.channel_name
22
+ poll_build
17
23
  notify_started
18
24
  end
19
25
 
20
26
  def stop(status)
21
- client.unsubscribe("#{@build.channel_name}@0")
27
+ update_build
28
+ @build_thread&.kill
22
29
  notify_stopped(status)
23
30
  end
24
31
 
25
32
  private
26
33
 
27
- def bind_event_handling(channel) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
28
- client.bind_event_json(channel, 'newAction') do |json|
29
- if @verbose
30
- print_bordered json['log']['name']
31
- else
32
- print json['log']['name']
34
+ def poll_build
35
+ @build_thread = Thread.new do
36
+ count = 0
37
+ loop do
38
+ update_build if (count % 5).zero?
39
+ update_actions
40
+
41
+ count += 1
42
+ sleep 1
33
43
  end
34
44
  end
45
+ end
35
46
 
36
- client.bind_event_json(channel, 'appendAction') do |json|
37
- if @verbose
38
- Thor::Shell::Basic.new.say(json['out']['message'], nil, false)
47
+ # rubocop:disable Metrics/MethodLength
48
+ def on_new_step(step)
49
+ if @verbose
50
+ print_bordered step.name
51
+ else
52
+ case step.status
53
+ when 'success'
54
+ puts "\e[2K\r#{Printer.colorize_green(step.name)}"
55
+ when 'failed'
56
+ puts "\e[2K\r#{Printer.colorize_red(step.name)}"
39
57
  else
40
- @messages[json['step']] << json['out']['message']
58
+ puts step.name
41
59
  end
42
60
  end
61
+ end
62
+ # rubocop:enable Metrics/MethodLength
43
63
 
44
- client.bind_event_json(channel, 'updateAction') do |json|
45
- next if @verbose
64
+ def on_new_step_status(step)
65
+ return if @verbose
46
66
 
47
- case json['log']['status']
48
- when 'success'
49
- puts "\e[2K\r#{Printer.colorize_green(json['log']['name'])}"
50
- when 'failed'
51
- puts "\e[2K\r#{Printer.colorize_red(json['log']['name'])}"
52
- @messages[json['step']].each(&method(:say))
53
- end
67
+ case step.status
68
+ when 'success'
69
+ puts "\e[1A\e[2K\r#{Printer.colorize_green(step.name)}"
70
+ when 'failed'
71
+ puts "\e[1A\e[2K\r#{Printer.colorize_red(step.name)}"
72
+ @messages[step.name].each(&method(:say))
54
73
  end
55
74
  end
56
75
 
76
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
77
+ def update_build
78
+ build = CircleCI::CLI::Response::Build.get(@build.username, @build.reponame, @build.build_number)
79
+
80
+ # Calc actions diff and dispatch event
81
+ build.steps
82
+ .each do |step|
83
+ on_new_step(step) unless @steps.any? { |s| s.name == step.name }
84
+ on_new_step_status(step) if @steps.any? { |s| s.name == step.name && s.status != step.status }
85
+ end
86
+
87
+ @steps = build.steps
88
+
89
+ next_step = build.steps.find { |s| s.status == 'running' }
90
+ @read_byte = 0 if @current_step&.name != next_step&.name
91
+ @current_step = next_step
92
+ end
93
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
94
+
95
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
96
+ def update_actions
97
+ return unless @current_step
98
+
99
+ response = Faraday.new(
100
+ url: "https://circleci.com/api/private/output/raw/github/#{@build.username}/#{@build.reponame}/#{@build.build_number}/output/#{@current_step.actions.first.index}/#{@current_step.actions.first.step}",
101
+ headers: { Range: "bytes=#{@read_byte}-" }
102
+ ).get.body
103
+
104
+ return if response.empty?
105
+
106
+ @read_byte += response.bytesize
107
+
108
+ if @verbose
109
+ Thor::Shell::Basic.new.say(response, nil, false)
110
+ else
111
+ @messages[@current_step.name] << response
112
+ end
113
+ end
114
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
115
+
57
116
  def notify_started
58
117
  say Printer::BuildPrinter.header_for(
59
118
  @build,
@@ -75,10 +134,6 @@ module CircleCI
75
134
  def print_bordered(text)
76
135
  say Terminal::Table.new(rows: [[text]], style: { width: 120 }).to_s
77
136
  end
78
-
79
- def client
80
- @client ||= Networking::CircleCIPusherClient.new.tap(&:connect)
81
- end
82
137
  end
83
138
  end
84
139
  end
@@ -31,7 +31,7 @@ module CircleCI
31
31
  '1cf6e0e755e419d2ac9a',
32
32
  secure: true,
33
33
  auth_method: proc { |a, b| auth(a, b) },
34
- logger: Logger.new('/dev/null')
34
+ logger: Logger.new(File::NULL)
35
35
  )
36
36
  end
37
37
 
@@ -22,11 +22,11 @@ module CircleCI
22
22
  end.to_s
23
23
  else
24
24
  @steps.group_by(&:type).map do |_, steps|
25
- steps.map do |step|
25
+ steps.flat_map do |step|
26
26
  step.actions.map do |a|
27
27
  "#{colorize_by_status(a.name.slice(0..120), a.status)}\n#{"#{a.log}\n" if a.failed? && a.log}"
28
28
  end
29
- end.flatten.join
29
+ end.join
30
30
  end.join("\n")
31
31
  end
32
32
  end
@@ -4,12 +4,15 @@ module CircleCI
4
4
  module CLI
5
5
  module Response
6
6
  class Action
7
- attr_reader :name, :status, :run_time_millis
7
+ attr_reader :name, :status, :index, :step, :end_time, :run_time_millis
8
8
 
9
9
  def initialize(hash)
10
10
  @hash = hash
11
11
  @name = hash['name']
12
12
  @status = hash['status']
13
+ @index = hash['index']
14
+ @step = hash['step']
15
+ @end_time = hash['end_time']
13
16
  @run_time_millis = hash['run_time_millis']
14
17
  end
15
18
 
@@ -17,8 +20,8 @@ module CircleCI
17
20
  request(@hash['output_url'])
18
21
  .map do |r|
19
22
  r['message']
20
- .gsub(/\r\n/, "\n")
21
- .gsub(/\e\[A\r\e\[2K/, '')
23
+ .gsub("\r\n", "\n")
24
+ .gsub("\e[A\r\e[2K", '')
22
25
  .scan(/.{1,120}/)
23
26
  .join("\n")
24
27
  end
@@ -58,7 +58,7 @@ module CircleCI
58
58
  end
59
59
 
60
60
  def finished?
61
- status == 'success' || status == 'canceled' || status == 'failed' || status == 'no_tests'
61
+ %w[success canceled failed no_tests].include?(status)
62
62
  end
63
63
 
64
64
  def channel_name
@@ -82,7 +82,7 @@ module CircleCI
82
82
  end
83
83
 
84
84
  def steps
85
- hash = @hash['steps'].group_by { |s| s['actions'].first['type'] }
85
+ hash = @hash['steps']&.group_by { |s| s['actions'].first['type'] } || {}
86
86
  hash.flat_map { |type, value| value.map { |v| Step.new(type, v) } }
87
87
  end
88
88
 
@@ -4,17 +4,24 @@ module CircleCI
4
4
  module CLI
5
5
  module Response
6
6
  class Step
7
- attr_reader :type, :status
7
+ attr_reader :type, :name
8
8
 
9
9
  def initialize(type, hash)
10
10
  @type = type
11
- @status = hash['status']
11
+ @name = hash['name']
12
12
  @hash = hash
13
13
  end
14
14
 
15
15
  def actions
16
16
  @hash['actions'].map { |a| Action.new(a) }
17
17
  end
18
+
19
+ def status
20
+ return 'running' if actions.any? { |action| action.end_time.nil? }
21
+ return 'failed' if actions.any?(&:failed?)
22
+
23
+ 'success'
24
+ end
18
25
  end
19
26
  end
20
27
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CircleCI
4
4
  module CLI
5
- VERSION = '4.0.0'
5
+ VERSION = '4.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circleci-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - unhappychoice
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0.14'
33
33
  - - "<"
34
34
  - !ruby/object:Gem::Version
35
- version: '2.8'
35
+ version: '2.14'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  version: '0.14'
43
43
  - - "<"
44
44
  - !ruby/object:Gem::Version
45
- version: '2.8'
45
+ version: '2.14'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: highline
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  version: 1.7.8
53
53
  - - "<"
54
54
  - !ruby/object:Gem::Version
55
- version: 2.2.0
55
+ version: 3.2.0
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
@@ -62,7 +62,7 @@ dependencies:
62
62
  version: 1.7.8
63
63
  - - "<"
64
64
  - !ruby/object:Gem::Version
65
- version: 2.2.0
65
+ version: 3.2.0
66
66
  - !ruby/object:Gem::Dependency
67
67
  name: launchy
68
68
  requirement: !ruby/object:Gem::Requirement
@@ -72,7 +72,7 @@ dependencies:
72
72
  version: 2.4.3
73
73
  - - "<"
74
74
  - !ruby/object:Gem::Version
75
- version: 3.1.0
75
+ version: 3.2.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  version: 2.4.3
83
83
  - - "<"
84
84
  - !ruby/object:Gem::Version
85
- version: 3.1.0
85
+ version: 3.2.0
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: pusher-client
88
88
  requirement: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  version: '0.26'
107
107
  - - "<"
108
108
  - !ruby/object:Gem::Version
109
- version: '1.8'
109
+ version: '1.10'
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
@@ -116,7 +116,7 @@ dependencies:
116
116
  version: '0.26'
117
117
  - - "<"
118
118
  - !ruby/object:Gem::Version
119
- version: '1.8'
119
+ version: '1.10'
120
120
  - !ruby/object:Gem::Dependency
121
121
  name: terminal-notifier
122
122
  requirement: !ruby/object:Gem::Requirement
@@ -140,7 +140,7 @@ dependencies:
140
140
  version: '1.8'
141
141
  - - "<"
142
142
  - !ruby/object:Gem::Version
143
- version: '3.1'
143
+ version: '4.1'
144
144
  type: :runtime
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
@@ -150,7 +150,7 @@ dependencies:
150
150
  version: '1.8'
151
151
  - - "<"
152
152
  - !ruby/object:Gem::Version
153
- version: '3.1'
153
+ version: '4.1'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: thor
156
156
  requirement: !ruby/object:Gem::Requirement
@@ -160,7 +160,7 @@ dependencies:
160
160
  version: '0.20'
161
161
  - - "<"
162
162
  - !ruby/object:Gem::Version
163
- version: '1.3'
163
+ version: '1.4'
164
164
  type: :runtime
165
165
  prerelease: false
166
166
  version_requirements: !ruby/object:Gem::Requirement
@@ -170,7 +170,7 @@ dependencies:
170
170
  version: '0.20'
171
171
  - - "<"
172
172
  - !ruby/object:Gem::Version
173
- version: '1.3'
173
+ version: '1.4'
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: abbrev
176
176
  requirement: !ruby/object:Gem::Requirement