circleci-cli 3.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 +4 -4
- data/.github/dependabot.yml +38 -0
- data/.github/workflows/release.yaml +41 -0
- data/.github/workflows/test.yml +20 -3
- data/.gitignore +57 -0
- data/.rubocop.yml +4 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +182 -7
- data/Gemfile.lock +176 -94
- data/Guardfile +1 -1
- data/README.md +6 -7
- data/circleci-cli.gemspec +25 -20
- data/lib/circleci/cli/command/base_command.rb +1 -1
- data/lib/circleci/cli/command/watch_command/build_repository.rb +2 -2
- data/lib/circleci/cli/command/watch_command/build_watcher.rb +80 -25
- data/lib/circleci/cli/networking/pusher_client.rb +7 -7
- data/lib/circleci/cli/printer/build_printer.rb +2 -2
- data/lib/circleci/cli/printer/step_printer.rb +2 -2
- data/lib/circleci/cli/response/action.rb +6 -3
- data/lib/circleci/cli/response/build.rb +2 -2
- data/lib/circleci/cli/response/step.rb +9 -2
- data/lib/circleci/cli/version.rb +1 -1
- data/lib/circleci/cli.rb +5 -4
- metadata +62 -28
- data/.circleci/config.yml +0 -68
data/Gemfile.lock
CHANGED
@@ -1,58 +1,107 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
circleci-cli (
|
5
|
-
circleci (
|
6
|
-
faraday (>= 0.14, <
|
7
|
-
highline (>= 1.7.8, < 2.
|
8
|
-
launchy (>= 2.4.3, < 2.
|
4
|
+
circleci-cli (4.0.1)
|
5
|
+
circleci (>= 2.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.
|
10
|
+
rugged (>= 0.26, < 1.10)
|
11
11
|
terminal-notifier (~> 2.0.0)
|
12
|
-
terminal-table (
|
13
|
-
thor (>= 0.20, < 1.
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
18
|
+
abbrev (0.1.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
|
26
|
+
i18n (>= 1.6, < 2)
|
27
|
+
logger (>= 1.4.2)
|
28
|
+
minitest (>= 5.1)
|
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)
|
51
|
+
async-http (~> 0.42)
|
52
|
+
faraday
|
53
|
+
async-pool (0.10.3)
|
54
|
+
async (>= 1.25)
|
55
|
+
base64 (0.3.0)
|
56
|
+
benchmark (0.4.1)
|
57
|
+
bigdecimal (3.2.2)
|
58
|
+
childprocess (5.1.0)
|
59
|
+
logger (~> 1.5)
|
60
|
+
circleci (2.1.0)
|
61
|
+
codecov (0.6.0)
|
62
|
+
simplecov (>= 0.15, < 0.22)
|
31
63
|
coderay (1.1.3)
|
32
|
-
concurrent-ruby (1.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
77
|
+
faraday-http-cache (2.5.1)
|
38
78
|
faraday (>= 0.8)
|
39
|
-
|
40
|
-
|
41
|
-
|
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)
|
86
|
+
formatador (1.1.0)
|
87
|
+
github_changelog_generator (1.16.4)
|
42
88
|
activesupport
|
89
|
+
async (>= 1.25.0)
|
90
|
+
async-http-faraday
|
43
91
|
faraday-http-cache
|
44
92
|
multi_json
|
45
93
|
octokit (~> 4.6)
|
46
94
|
rainbow (>= 2.2.1)
|
47
95
|
rake (>= 10.0)
|
48
|
-
|
49
|
-
guard (2.16.2)
|
96
|
+
guard (2.19.1)
|
50
97
|
formatador (>= 0.2.4)
|
51
98
|
listen (>= 2.7, < 4.0)
|
99
|
+
logger (~> 1.6)
|
52
100
|
lumberjack (>= 1.0.12, < 2.0)
|
53
101
|
nenv (~> 0.1)
|
54
102
|
notiffany (~> 0.0)
|
55
|
-
|
103
|
+
ostruct (~> 0.6)
|
104
|
+
pry (>= 0.13.0)
|
56
105
|
shellany (~> 0.0)
|
57
106
|
thor (>= 0.18.1)
|
58
107
|
guard-compat (1.2.1)
|
@@ -60,97 +109,130 @@ GEM
|
|
60
109
|
guard (~> 2.1)
|
61
110
|
guard-compat (~> 1.1)
|
62
111
|
rspec (>= 2.99.0, < 4.0)
|
63
|
-
guard-rubocop (1.
|
112
|
+
guard-rubocop (1.5.0)
|
64
113
|
guard (~> 2.0)
|
65
|
-
rubocop (
|
66
|
-
highline (
|
67
|
-
|
114
|
+
rubocop (< 2.0)
|
115
|
+
highline (3.1.2)
|
116
|
+
reline
|
117
|
+
i18n (1.14.7)
|
68
118
|
concurrent-ruby (~> 1.0)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
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)
|
126
|
+
addressable (~> 2.8)
|
127
|
+
childprocess (~> 5.0)
|
128
|
+
logger (~> 1.6)
|
129
|
+
lint_roller (1.1.0)
|
130
|
+
listen (3.9.0)
|
73
131
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
74
132
|
rb-inotify (~> 0.9, >= 0.9.10)
|
75
|
-
|
76
|
-
|
77
|
-
|
133
|
+
logger (1.7.0)
|
134
|
+
lumberjack (1.2.10)
|
135
|
+
method_source (1.1.0)
|
136
|
+
metrics (0.12.2)
|
137
|
+
minitest (5.25.5)
|
78
138
|
multi_json (1.15.0)
|
79
|
-
multipart-post (2.1.1)
|
80
139
|
nenv (0.3.0)
|
140
|
+
net-http (0.6.0)
|
141
|
+
uri
|
81
142
|
notiffany (0.1.3)
|
82
143
|
nenv (~> 0.1)
|
83
144
|
shellany (~> 0.0)
|
84
|
-
octokit (4.
|
85
|
-
faraday (>=
|
86
|
-
sawyer (~> 0.
|
87
|
-
|
88
|
-
|
145
|
+
octokit (4.25.1)
|
146
|
+
faraday (>= 1, < 3)
|
147
|
+
sawyer (~> 0.9)
|
148
|
+
ostruct (0.6.2)
|
149
|
+
parallel (1.27.0)
|
150
|
+
parser (3.3.8.0)
|
89
151
|
ast (~> 2.4.1)
|
90
|
-
|
152
|
+
racc
|
153
|
+
prism (1.4.0)
|
154
|
+
protocol-hpack (1.5.1)
|
155
|
+
protocol-http (0.49.0)
|
156
|
+
protocol-http1 (0.34.0)
|
157
|
+
protocol-http (~> 0.22)
|
158
|
+
protocol-http2 (0.22.1)
|
159
|
+
protocol-hpack (~> 1.4)
|
160
|
+
protocol-http (~> 0.47)
|
161
|
+
pry (0.15.2)
|
91
162
|
coderay (~> 1.1)
|
92
163
|
method_source (~> 1.0)
|
93
|
-
public_suffix (
|
164
|
+
public_suffix (6.0.2)
|
94
165
|
pusher-client (0.6.2)
|
95
166
|
json
|
96
167
|
websocket (~> 1.0)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
rb-
|
168
|
+
racc (1.8.1)
|
169
|
+
rainbow (3.1.1)
|
170
|
+
rake (13.3.0)
|
171
|
+
rb-fsevent (0.11.2)
|
172
|
+
rb-inotify (0.11.1)
|
101
173
|
ffi (~> 1.0)
|
102
|
-
regexp_parser (
|
103
|
-
|
104
|
-
|
105
|
-
rspec (3.
|
106
|
-
rspec-core (~> 3.
|
107
|
-
rspec-expectations (~> 3.
|
108
|
-
rspec-mocks (~> 3.
|
109
|
-
rspec-core (3.
|
110
|
-
rspec-support (~> 3.
|
111
|
-
rspec-expectations (3.
|
174
|
+
regexp_parser (2.10.0)
|
175
|
+
reline (0.6.1)
|
176
|
+
io-console (~> 0.5)
|
177
|
+
rspec (3.13.1)
|
178
|
+
rspec-core (~> 3.13.0)
|
179
|
+
rspec-expectations (~> 3.13.0)
|
180
|
+
rspec-mocks (~> 3.13.0)
|
181
|
+
rspec-core (3.13.5)
|
182
|
+
rspec-support (~> 3.13.0)
|
183
|
+
rspec-expectations (3.13.5)
|
112
184
|
diff-lcs (>= 1.2.0, < 2.0)
|
113
|
-
rspec-support (~> 3.
|
114
|
-
rspec-mocks (3.
|
185
|
+
rspec-support (~> 3.13.0)
|
186
|
+
rspec-mocks (3.13.5)
|
115
187
|
diff-lcs (>= 1.2.0, < 2.0)
|
116
|
-
rspec-support (~> 3.
|
117
|
-
rspec-support (3.
|
118
|
-
rubocop (
|
188
|
+
rspec-support (~> 3.13.0)
|
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)
|
119
194
|
parallel (~> 1.10)
|
120
|
-
parser (>=
|
195
|
+
parser (>= 3.3.0.2)
|
121
196
|
rainbow (>= 2.2.2, < 4.0)
|
122
|
-
regexp_parser (>=
|
123
|
-
|
124
|
-
rubocop-ast (>= 0.3.0, < 1.0)
|
197
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
198
|
+
rubocop-ast (>= 1.45.1, < 2.0)
|
125
199
|
ruby-progressbar (~> 1.7)
|
126
|
-
unicode-display_width (>=
|
127
|
-
rubocop-ast (
|
128
|
-
parser (>=
|
129
|
-
|
130
|
-
|
131
|
-
|
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)
|
204
|
+
ruby-progressbar (1.13.0)
|
205
|
+
rugged (1.9.0)
|
206
|
+
sawyer (0.9.2)
|
132
207
|
addressable (>= 2.3.5)
|
133
|
-
faraday (
|
208
|
+
faraday (>= 0.17.3, < 3)
|
209
|
+
securerandom (0.4.1)
|
134
210
|
shellany (0.0.1)
|
135
|
-
simplecov (0.
|
211
|
+
simplecov (0.21.2)
|
136
212
|
docile (~> 1.1)
|
137
213
|
simplecov-html (~> 0.11)
|
138
|
-
|
214
|
+
simplecov_json_formatter (~> 0.1)
|
215
|
+
simplecov-html (0.13.1)
|
216
|
+
simplecov_json_formatter (0.1.4)
|
139
217
|
terminal-notifier (2.0.0)
|
140
|
-
terminal-table (
|
141
|
-
unicode-display_width (
|
142
|
-
thor (1.
|
143
|
-
|
144
|
-
tzinfo (
|
145
|
-
|
146
|
-
unicode-display_width (1.
|
147
|
-
|
148
|
-
|
218
|
+
terminal-table (4.0.0)
|
219
|
+
unicode-display_width (>= 1.1.1, < 4)
|
220
|
+
thor (1.3.2)
|
221
|
+
traces (0.15.2)
|
222
|
+
tzinfo (2.0.6)
|
223
|
+
concurrent-ruby (~> 1.0)
|
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)
|
149
229
|
|
150
230
|
PLATFORMS
|
151
231
|
ruby
|
152
232
|
|
153
233
|
DEPENDENCIES
|
234
|
+
abbrev
|
235
|
+
base64
|
154
236
|
bundler
|
155
237
|
circleci-cli!
|
156
238
|
codecov
|
@@ -164,4 +246,4 @@ DEPENDENCIES
|
|
164
246
|
simplecov
|
165
247
|
|
166
248
|
BUNDLED WITH
|
167
|
-
2.
|
249
|
+
2.4.18
|
data/Guardfile
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
#
|
18
18
|
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
19
19
|
|
20
|
-
#
|
20
|
+
# NOTE: The cmd option is now required due to the increasing number of ways
|
21
21
|
# rspec may be run, below are examples of the most common uses.
|
22
22
|
# * bundler: 'bundle exec rspec'
|
23
23
|
# * bundler binstubs: 'bin/rspec'
|
data/README.md
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
# circleci-cli
|
2
2
|
[](#contributors-)
|
3
3
|
[](https://badge.fury.io/rb/circleci-cli)
|
4
|
-
[](https://libraries.io/github/unhappychoice/circleci-cli)
|
4
|
+
[](https://codeclimate.com/github/circleci-tools/circleci-cli)
|
5
|
+
[](https://codecov.io/gh/circleci-tools/circleci-cli)
|
6
|
+
[](https://libraries.io/github/circleci-tools/circleci-cli)
|
8
7
|

|
9
|
-

|
10
9
|
|
11
10
|
circleci-cli is a CLI tool for [Circle CI](https://circleci.com).
|
12
11
|
|
13
|
-

|
14
13
|
|
15
14
|
## Installation
|
16
15
|
|
@@ -84,7 +83,7 @@ $ circleci-cli browse
|
|
84
83
|
|
85
84
|
## Contributing
|
86
85
|
|
87
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
86
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/circleci-tools/circleci-cli.
|
88
87
|
|
89
88
|
## License
|
90
89
|
|
data/circleci-cli.gemspec
CHANGED
@@ -5,18 +5,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'circleci/cli/version'
|
6
6
|
|
7
7
|
def production_dependency(spec)
|
8
|
-
spec.add_dependency 'circleci', '
|
9
|
-
spec.add_dependency 'faraday', '>= 0.14', '<
|
10
|
-
spec.add_dependency 'highline', '>= 1.7.8', '< 2.
|
11
|
-
spec.add_dependency 'launchy', '>= 2.4.3', '< 2.
|
8
|
+
spec.add_dependency 'circleci', '>= 2.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.
|
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', '
|
16
|
-
spec.add_dependency 'thor', '>= 0.20', '< 1.
|
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)
|
20
|
+
spec.add_development_dependency 'abbrev'
|
21
|
+
spec.add_development_dependency 'base64'
|
20
22
|
spec.add_development_dependency 'bundler'
|
21
23
|
spec.add_development_dependency 'codecov'
|
22
24
|
spec.add_development_dependency 'github_changelog_generator'
|
@@ -36,20 +38,23 @@ def project_files
|
|
36
38
|
end
|
37
39
|
|
38
40
|
Gem::Specification.new do |spec|
|
39
|
-
spec.name
|
40
|
-
spec.version
|
41
|
-
spec.required_ruby_version = '>=
|
42
|
-
spec.authors
|
43
|
-
spec.email
|
41
|
+
spec.name = 'circleci-cli'
|
42
|
+
spec.version = CircleCI::CLI::VERSION
|
43
|
+
spec.required_ruby_version = '>= 3.1'
|
44
|
+
spec.authors = ['unhappychoice']
|
45
|
+
spec.email = ['unhappychoice@gmail.com']
|
44
46
|
|
45
|
-
spec.summary
|
46
|
-
spec.description
|
47
|
-
spec.homepage
|
48
|
-
spec.license
|
49
|
-
spec.files
|
50
|
-
spec.bindir
|
51
|
-
spec.executables
|
52
|
-
spec.require_paths
|
47
|
+
spec.summary = 'CLI tool for CircleCI'
|
48
|
+
spec.description = 'A command line tool for CircleCI'
|
49
|
+
spec.homepage = 'https://github.com/circleci-tools/circleci-cli'
|
50
|
+
spec.license = 'MIT'
|
51
|
+
spec.files = project_files
|
52
|
+
spec.bindir = 'exe'
|
53
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
54
|
+
spec.require_paths = ['lib']
|
55
|
+
spec.metadata = {
|
56
|
+
'rubygems_mfa_required' => 'true'
|
57
|
+
}
|
53
58
|
|
54
59
|
production_dependency spec
|
55
60
|
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
|
34
|
-
.select { |build| @user.nil? || build.user
|
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
|
-
|
22
|
+
poll_build
|
17
23
|
notify_started
|
18
24
|
end
|
19
25
|
|
20
26
|
def stop(status)
|
21
|
-
|
27
|
+
update_build
|
28
|
+
@build_thread&.kill
|
22
29
|
notify_stopped(status)
|
23
30
|
end
|
24
31
|
|
25
32
|
private
|
26
33
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
58
|
+
puts step.name
|
41
59
|
end
|
42
60
|
end
|
61
|
+
end
|
62
|
+
# rubocop:enable Metrics/MethodLength
|
43
63
|
|
44
|
-
|
45
|
-
|
64
|
+
def on_new_step_status(step)
|
65
|
+
return if @verbose
|
46
66
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
@@ -11,13 +11,13 @@ module CircleCI
|
|
11
11
|
socket.connect(true)
|
12
12
|
end
|
13
13
|
|
14
|
-
def bind(channel, event, &
|
14
|
+
def bind(channel, event, &)
|
15
15
|
socket.subscribe(channel)
|
16
|
-
socket[channel].bind(event, &
|
16
|
+
socket[channel].bind(event, &)
|
17
17
|
end
|
18
18
|
|
19
|
-
def bind_event_json(channel, event, &
|
20
|
-
bind(channel, event) { |data| JSON.parse(data).each(&
|
19
|
+
def bind_event_json(channel, event, &)
|
20
|
+
bind(channel, event) { |data| JSON.parse(data).each(&) }
|
21
21
|
end
|
22
22
|
|
23
23
|
def unsubscribe(channel)
|
@@ -31,15 +31,15 @@ module CircleCI
|
|
31
31
|
'1cf6e0e755e419d2ac9a',
|
32
32
|
secure: true,
|
33
33
|
auth_method: proc { |a, b| auth(a, b) },
|
34
|
-
logger: Logger.new(
|
34
|
+
logger: Logger.new(File::NULL)
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
38
38
|
def auth(socket_id, channel)
|
39
|
-
token = ENV
|
39
|
+
token = ENV.fetch('CIRCLE_CI_TOKEN', nil) || ask('Circle CI token ? :')
|
40
40
|
res = connection.post(
|
41
41
|
"/auth/pusher?circle-token=#{token}",
|
42
|
-
{ socket_id
|
42
|
+
{ socket_id:, channel_name: channel.name }
|
43
43
|
)
|
44
44
|
JSON.parse(res.body)['auth']
|
45
45
|
end
|
@@ -12,7 +12,7 @@ module CircleCI
|
|
12
12
|
["Author: #{build.author_name}"],
|
13
13
|
["Workflow: #{build.workflow_name}/#{build.workflow_job_name}"]
|
14
14
|
]
|
15
|
-
Terminal::Table.new(title
|
15
|
+
Terminal::Table.new(title:, rows: texts, style: { width: 120 }).to_s
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -33,7 +33,7 @@ module CircleCI
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def print_pretty
|
36
|
-
Terminal::Table.new(title
|
36
|
+
Terminal::Table.new(title:, headings:, rows:).to_s
|
37
37
|
end
|
38
38
|
|
39
39
|
def title
|