circleci-cli 2.3.0 → 3.0.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 +4 -4
- data/.all-contributorsrc +12 -1
- data/.github/workflows/test.yml +1 -1
- data/.rubocop.yml +9 -1
- data/.ruby-version +1 -0
- data/Gemfile.lock +73 -72
- data/README.md +32 -22
- data/circleci-cli.gemspec +5 -5
- data/lib/circleci/cli.rb +114 -27
- data/lib/circleci/cli/command/base_command.rb +6 -13
- data/lib/circleci/cli/command/build_command.rb +1 -1
- data/lib/circleci/cli/command/builds_command.rb +9 -9
- data/lib/circleci/cli/command/projects_command.rb +1 -1
- data/lib/circleci/cli/command/watch_command.rb +6 -1
- data/lib/circleci/cli/command/watch_command/build_repository.rb +7 -2
- data/lib/circleci/cli/command/watch_command/build_watcher.rb +18 -11
- data/lib/circleci/cli/networking/pusher_client.rb +15 -21
- data/lib/circleci/cli/printer.rb +25 -1
- data/lib/circleci/cli/printer/build_printer.rb +7 -7
- data/lib/circleci/cli/printer/project_printer.rb +2 -1
- data/lib/circleci/cli/printer/step_printer.rb +8 -8
- data/lib/circleci/cli/response/action.rb +1 -0
- data/lib/circleci/cli/response/build.rb +7 -7
- data/lib/circleci/cli/response/step.rb +1 -2
- data/lib/circleci/cli/version.rb +1 -1
- metadata +26 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84193221832fac2cdd329cbedc96812e1bb12dc94d902bdce8ae1159eac958ce
|
|
4
|
+
data.tar.gz: 0d038c89097f8e76673532aac7a38419f47389c654ababced6daf50e6d91b3a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83c46bad4ba33e854dfc4ae366f202e9615d6e1b48eaa1f89897c160827115358b7b26bd0aa283a8c6a94baaa824d33a196f430941528516a23e50e8b86d48c9
|
|
7
|
+
data.tar.gz: 0eeb43050dc0f7802d10990efc4841136d7def707b51962e782ffcf57bbc30148fb74032c863efb836388813726b37fcb7074bcc4a95682e26a367ea3edfddd6
|
data/.all-contributorsrc
CHANGED
|
@@ -39,7 +39,18 @@
|
|
|
39
39
|
"ideas",
|
|
40
40
|
"code"
|
|
41
41
|
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"login": "marcotc",
|
|
45
|
+
"name": "Marco Costa",
|
|
46
|
+
"avatar_url": "https://avatars3.githubusercontent.com/u/583503?v=4",
|
|
47
|
+
"profile": "https://datadoghq.com",
|
|
48
|
+
"contributions": [
|
|
49
|
+
"ideas",
|
|
50
|
+
"code"
|
|
51
|
+
]
|
|
42
52
|
}
|
|
43
53
|
],
|
|
44
|
-
"contributorsPerLine": 7
|
|
54
|
+
"contributorsPerLine": 7,
|
|
55
|
+
"skipCi": true
|
|
45
56
|
}
|
data/.github/workflows/test.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.6.3
|
data/Gemfile.lock
CHANGED
|
@@ -1,55 +1,52 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
circleci-cli (
|
|
4
|
+
circleci-cli (3.0.0)
|
|
5
5
|
circleci (~> 2.0.2)
|
|
6
|
-
|
|
7
|
-
faraday (>= 0.14, < 0.17)
|
|
6
|
+
faraday (>= 0.14, < 1.1)
|
|
8
7
|
highline (>= 1.7.8, < 2.1.0)
|
|
9
|
-
launchy (
|
|
8
|
+
launchy (>= 2.4.3, < 2.6.0)
|
|
10
9
|
pusher-client (~> 0.6.2)
|
|
11
|
-
rugged (>= 0.26, <
|
|
10
|
+
rugged (>= 0.26, < 1.1)
|
|
12
11
|
terminal-notifier (~> 2.0.0)
|
|
13
12
|
terminal-table (~> 1.8.0)
|
|
14
|
-
thor (
|
|
13
|
+
thor (>= 0.20, < 1.1)
|
|
15
14
|
|
|
16
15
|
GEM
|
|
17
16
|
remote: https://rubygems.org/
|
|
18
17
|
specs:
|
|
19
|
-
activesupport (6.0.
|
|
18
|
+
activesupport (6.0.3.2)
|
|
20
19
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
21
20
|
i18n (>= 0.7, < 2)
|
|
22
21
|
minitest (~> 5.1)
|
|
23
22
|
tzinfo (~> 1.1)
|
|
24
|
-
zeitwerk (~> 2.
|
|
23
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
|
25
24
|
addressable (2.7.0)
|
|
26
25
|
public_suffix (>= 2.0.2, < 5.0)
|
|
27
|
-
ast (2.4.
|
|
28
|
-
circleci (2.0.
|
|
29
|
-
codecov (0.
|
|
26
|
+
ast (2.4.1)
|
|
27
|
+
circleci (2.0.3)
|
|
28
|
+
codecov (0.2.8)
|
|
30
29
|
json
|
|
31
30
|
simplecov
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
concurrent-ruby (1.1.5)
|
|
36
|
-
diff-lcs (1.3)
|
|
31
|
+
coderay (1.1.3)
|
|
32
|
+
concurrent-ruby (1.1.7)
|
|
33
|
+
diff-lcs (1.4.4)
|
|
37
34
|
docile (1.3.2)
|
|
38
|
-
faraday (0.
|
|
35
|
+
faraday (1.0.1)
|
|
39
36
|
multipart-post (>= 1.2, < 3)
|
|
40
|
-
faraday-http-cache (2.
|
|
41
|
-
faraday (
|
|
42
|
-
ffi (1.
|
|
37
|
+
faraday-http-cache (2.2.0)
|
|
38
|
+
faraday (>= 0.8)
|
|
39
|
+
ffi (1.13.1)
|
|
43
40
|
formatador (0.2.5)
|
|
44
|
-
github_changelog_generator (1.
|
|
41
|
+
github_changelog_generator (1.15.2)
|
|
45
42
|
activesupport
|
|
46
43
|
faraday-http-cache
|
|
47
44
|
multi_json
|
|
48
45
|
octokit (~> 4.6)
|
|
49
|
-
rainbow (>= 2.1)
|
|
46
|
+
rainbow (>= 2.2.1)
|
|
50
47
|
rake (>= 10.0)
|
|
51
|
-
retriable (~>
|
|
52
|
-
guard (2.
|
|
48
|
+
retriable (~> 3.0)
|
|
49
|
+
guard (2.16.2)
|
|
53
50
|
formatador (>= 0.2.4)
|
|
54
51
|
listen (>= 2.7, < 4.0)
|
|
55
52
|
lumberjack (>= 1.0.12, < 2.0)
|
|
@@ -66,85 +63,89 @@ GEM
|
|
|
66
63
|
guard-rubocop (1.3.0)
|
|
67
64
|
guard (~> 2.0)
|
|
68
65
|
rubocop (~> 0.20)
|
|
69
|
-
highline (2.0.
|
|
70
|
-
i18n (1.
|
|
66
|
+
highline (2.0.3)
|
|
67
|
+
i18n (1.8.5)
|
|
71
68
|
concurrent-ruby (~> 1.0)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
listen (3.2.0)
|
|
69
|
+
json (2.3.1)
|
|
70
|
+
launchy (2.5.0)
|
|
71
|
+
addressable (~> 2.7)
|
|
72
|
+
listen (3.2.1)
|
|
77
73
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
78
74
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
79
|
-
lumberjack (1.
|
|
80
|
-
method_source (0.
|
|
81
|
-
minitest (5.
|
|
82
|
-
multi_json (1.
|
|
75
|
+
lumberjack (1.2.7)
|
|
76
|
+
method_source (1.0.0)
|
|
77
|
+
minitest (5.14.1)
|
|
78
|
+
multi_json (1.15.0)
|
|
83
79
|
multipart-post (2.1.1)
|
|
84
80
|
nenv (0.3.0)
|
|
85
81
|
notiffany (0.1.3)
|
|
86
82
|
nenv (~> 0.1)
|
|
87
83
|
shellany (~> 0.0)
|
|
88
|
-
octokit (4.
|
|
84
|
+
octokit (4.18.0)
|
|
85
|
+
faraday (>= 0.9)
|
|
89
86
|
sawyer (~> 0.8.0, >= 0.5.3)
|
|
90
|
-
parallel (1.
|
|
91
|
-
parser (2.
|
|
92
|
-
ast (~> 2.4.
|
|
93
|
-
pry (0.
|
|
94
|
-
coderay (~> 1.1
|
|
95
|
-
method_source (~>
|
|
96
|
-
public_suffix (4.0.
|
|
87
|
+
parallel (1.19.2)
|
|
88
|
+
parser (2.7.1.4)
|
|
89
|
+
ast (~> 2.4.1)
|
|
90
|
+
pry (0.13.1)
|
|
91
|
+
coderay (~> 1.1)
|
|
92
|
+
method_source (~> 1.0)
|
|
93
|
+
public_suffix (4.0.5)
|
|
97
94
|
pusher-client (0.6.2)
|
|
98
95
|
json
|
|
99
96
|
websocket (~> 1.0)
|
|
100
97
|
rainbow (3.0.0)
|
|
101
|
-
rake (13.0.
|
|
102
|
-
rb-fsevent (0.10.
|
|
103
|
-
rb-inotify (0.10.
|
|
98
|
+
rake (13.0.1)
|
|
99
|
+
rb-fsevent (0.10.4)
|
|
100
|
+
rb-inotify (0.10.1)
|
|
104
101
|
ffi (~> 1.0)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
rspec-
|
|
110
|
-
|
|
111
|
-
rspec-
|
|
112
|
-
rspec-
|
|
102
|
+
regexp_parser (1.7.1)
|
|
103
|
+
retriable (3.1.2)
|
|
104
|
+
rexml (3.2.4)
|
|
105
|
+
rspec (3.9.0)
|
|
106
|
+
rspec-core (~> 3.9.0)
|
|
107
|
+
rspec-expectations (~> 3.9.0)
|
|
108
|
+
rspec-mocks (~> 3.9.0)
|
|
109
|
+
rspec-core (3.9.2)
|
|
110
|
+
rspec-support (~> 3.9.3)
|
|
111
|
+
rspec-expectations (3.9.2)
|
|
113
112
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
114
|
-
rspec-support (~> 3.
|
|
115
|
-
rspec-mocks (3.
|
|
113
|
+
rspec-support (~> 3.9.0)
|
|
114
|
+
rspec-mocks (3.9.1)
|
|
116
115
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
117
|
-
rspec-support (~> 3.
|
|
118
|
-
rspec-support (3.
|
|
119
|
-
rubocop (0.
|
|
120
|
-
jaro_winkler (~> 1.5.1)
|
|
116
|
+
rspec-support (~> 3.9.0)
|
|
117
|
+
rspec-support (3.9.3)
|
|
118
|
+
rubocop (0.89.1)
|
|
121
119
|
parallel (~> 1.10)
|
|
122
|
-
parser (>= 2.
|
|
120
|
+
parser (>= 2.7.1.1)
|
|
123
121
|
rainbow (>= 2.2.2, < 4.0)
|
|
122
|
+
regexp_parser (>= 1.7)
|
|
123
|
+
rexml
|
|
124
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
|
124
125
|
ruby-progressbar (~> 1.7)
|
|
125
|
-
unicode-display_width (>= 1.4.0, <
|
|
126
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
127
|
+
rubocop-ast (0.3.0)
|
|
128
|
+
parser (>= 2.7.1.4)
|
|
126
129
|
ruby-progressbar (1.10.1)
|
|
127
|
-
rugged (0.
|
|
130
|
+
rugged (1.0.1)
|
|
128
131
|
sawyer (0.8.2)
|
|
129
132
|
addressable (>= 2.3.5)
|
|
130
133
|
faraday (> 0.8, < 2.0)
|
|
131
134
|
shellany (0.0.1)
|
|
132
|
-
simplecov (0.
|
|
135
|
+
simplecov (0.19.0)
|
|
133
136
|
docile (~> 1.1)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
simplecov-html (0.10.2)
|
|
137
|
+
simplecov-html (~> 0.11)
|
|
138
|
+
simplecov-html (0.12.2)
|
|
137
139
|
terminal-notifier (2.0.0)
|
|
138
140
|
terminal-table (1.8.0)
|
|
139
141
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
140
|
-
thor (0.
|
|
142
|
+
thor (1.0.1)
|
|
141
143
|
thread_safe (0.3.6)
|
|
142
|
-
tzinfo (1.2.
|
|
144
|
+
tzinfo (1.2.7)
|
|
143
145
|
thread_safe (~> 0.1)
|
|
144
|
-
unicode-display_width (1.
|
|
145
|
-
url (0.3.2)
|
|
146
|
+
unicode-display_width (1.7.0)
|
|
146
147
|
websocket (1.2.8)
|
|
147
|
-
zeitwerk (2.
|
|
148
|
+
zeitwerk (2.4.0)
|
|
148
149
|
|
|
149
150
|
PLATFORMS
|
|
150
151
|
ruby
|
data/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# circleci-cli
|
|
2
|
-
[](#contributors-)
|
|
3
3
|
[](https://badge.fury.io/rb/circleci-cli)
|
|
4
4
|
[](https://circleci.com/gh/unhappychoice/circleci-cli)
|
|
5
5
|
[](https://codeclimate.com/github/unhappychoice/circleci-cli)
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|

|
|
9
9
|

|
|
10
10
|
|
|
11
|
-
Notice: This gem is renamed from `circler` to `circleci-cli` on 2019/09/22
|
|
12
11
|
circleci-cli is a CLI tool for [Circle CI](https://circleci.com).
|
|
13
12
|
|
|
14
13
|

|
|
@@ -28,26 +27,33 @@ export CIRCLE_CI_TOKEN=your-circle-ci-token
|
|
|
28
27
|
## Usage
|
|
29
28
|
```
|
|
30
29
|
Commands:
|
|
31
|
-
circleci-cli browse
|
|
32
|
-
circleci-cli build
|
|
33
|
-
circleci-cli builds
|
|
34
|
-
circleci-cli
|
|
35
|
-
circleci-cli
|
|
36
|
-
circleci-cli
|
|
37
|
-
circleci-cli
|
|
38
|
-
circleci-cli
|
|
30
|
+
circleci-cli browse # Open CircleCI website
|
|
31
|
+
circleci-cli build # Show the build result
|
|
32
|
+
circleci-cli builds # List builds
|
|
33
|
+
circleci-cli cancel # Cancel a build
|
|
34
|
+
circleci-cli help [COMMAND] # Describe available commands or one specific command
|
|
35
|
+
circleci-cli projects # List projects
|
|
36
|
+
circleci-cli retry # Retry a build
|
|
37
|
+
circleci-cli version # Show gem version
|
|
38
|
+
circleci-cli watch # Watch builds in real time
|
|
39
39
|
|
|
40
40
|
Options:
|
|
41
|
-
-p user_name/project
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
```
|
|
41
|
+
-p user_name/project # Specify repository
|
|
42
|
+
# Default to the Git remote of current directory
|
|
43
|
+
|
|
44
|
+
-b branch # Specify branch name
|
|
45
|
+
# Default to the current Git branch
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
-a, --all, --no-all # Ignore the branch option and stop being filtered by the branch
|
|
48
|
+
# Default to false
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
-n build_number # Specify build number.
|
|
51
|
+
-l last # Get or retry last failed build.
|
|
52
|
+
-v verbose # Show all the logs if applied to watch command.
|
|
53
|
+
|
|
54
|
+
--pretty=true/false, --no-pretty # Make outputs pretty or not
|
|
55
|
+
# Default to true
|
|
56
|
+
```
|
|
51
57
|
|
|
52
58
|
### Examples
|
|
53
59
|
|
|
@@ -89,15 +95,19 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
|
89
95
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
90
96
|
|
|
91
97
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
92
|
-
<!-- prettier-ignore -->
|
|
98
|
+
<!-- prettier-ignore-start -->
|
|
99
|
+
<!-- markdownlint-disable -->
|
|
93
100
|
<table>
|
|
94
101
|
<tr>
|
|
95
|
-
<td align="center"><a href="http://blog.unhappychoice.com"><img src="https://avatars3.githubusercontent.com/u/5608948?v=4" width="100px;" alt="
|
|
96
|
-
<td align="center"><a href="https://mattbrictson.com/"><img src="https://avatars0.githubusercontent.com/u/189693?v=4" width="100px;" alt="
|
|
97
|
-
<td align="center"><a href="http://fzf.me"><img src="https://avatars0.githubusercontent.com/u/1462357?v=4" width="100px;" alt="
|
|
102
|
+
<td align="center"><a href="http://blog.unhappychoice.com"><img src="https://avatars3.githubusercontent.com/u/5608948?v=4" width="100px;" alt=""/><br /><sub><b>Yuji Ueki</b></sub></a><br /><a href="https://github.com/unhappychoice/circleci-cli/commits?author=unhappychoice" title="Code">💻</a></td>
|
|
103
|
+
<td align="center"><a href="https://mattbrictson.com/"><img src="https://avatars0.githubusercontent.com/u/189693?v=4" width="100px;" alt=""/><br /><sub><b>Matt Brictson</b></sub></a><br /><a href="https://github.com/unhappychoice/circleci-cli/commits?author=mattbrictson" title="Code">💻</a> <a href="https://github.com/unhappychoice/circleci-cli/commits?author=mattbrictson" title="Tests">⚠️</a></td>
|
|
104
|
+
<td align="center"><a href="http://fzf.me"><img src="https://avatars0.githubusercontent.com/u/1462357?v=4" width="100px;" alt=""/><br /><sub><b>Fletcher Fowler</b></sub></a><br /><a href="https://github.com/unhappychoice/circleci-cli/issues?q=author%3Afzf" title="Bug reports">🐛</a> <a href="#ideas-fzf" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/unhappychoice/circleci-cli/commits?author=fzf" title="Code">💻</a></td>
|
|
105
|
+
<td align="center"><a href="https://datadoghq.com"><img src="https://avatars3.githubusercontent.com/u/583503?v=4" width="100px;" alt=""/><br /><sub><b>Marco Costa</b></sub></a><br /><a href="#ideas-marcotc" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/unhappychoice/circleci-cli/commits?author=marcotc" title="Code">💻</a></td>
|
|
98
106
|
</tr>
|
|
99
107
|
</table>
|
|
100
108
|
|
|
109
|
+
<!-- markdownlint-enable -->
|
|
110
|
+
<!-- prettier-ignore-end -->
|
|
101
111
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
102
112
|
|
|
103
113
|
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
data/circleci-cli.gemspec
CHANGED
|
@@ -6,15 +6,14 @@ require 'circleci/cli/version'
|
|
|
6
6
|
|
|
7
7
|
def production_dependency(spec)
|
|
8
8
|
spec.add_dependency 'circleci', '~> 2.0.2'
|
|
9
|
-
spec.add_dependency '
|
|
10
|
-
spec.add_dependency 'faraday', '>= 0.14', '< 0.17'
|
|
9
|
+
spec.add_dependency 'faraday', '>= 0.14', '< 1.1'
|
|
11
10
|
spec.add_dependency 'highline', '>= 1.7.8', '< 2.1.0'
|
|
12
|
-
spec.add_dependency 'launchy', '
|
|
11
|
+
spec.add_dependency 'launchy', '>= 2.4.3', '< 2.6.0'
|
|
13
12
|
spec.add_dependency 'pusher-client', '~> 0.6.2'
|
|
14
|
-
spec.add_dependency 'rugged', '>= 0.26', '<
|
|
13
|
+
spec.add_dependency 'rugged', '>= 0.26', '< 1.1'
|
|
15
14
|
spec.add_dependency 'terminal-notifier', '~> 2.0.0'
|
|
16
15
|
spec.add_dependency 'terminal-table', '~> 1.8.0'
|
|
17
|
-
spec.add_dependency 'thor', '
|
|
16
|
+
spec.add_dependency 'thor', '>= 0.20', '< 1.1'
|
|
18
17
|
end
|
|
19
18
|
|
|
20
19
|
def development_dependency(spec)
|
|
@@ -39,6 +38,7 @@ end
|
|
|
39
38
|
Gem::Specification.new do |spec|
|
|
40
39
|
spec.name = 'circleci-cli'
|
|
41
40
|
spec.version = CircleCI::CLI::VERSION
|
|
41
|
+
spec.required_ruby_version = '>= 2.5'
|
|
42
42
|
spec.authors = ['unhappychoice']
|
|
43
43
|
spec.email = ['unhappychoice@gmail.com']
|
|
44
44
|
|
data/lib/circleci/cli.rb
CHANGED
|
@@ -5,7 +5,6 @@ require 'faraday'
|
|
|
5
5
|
require 'launchy'
|
|
6
6
|
require 'terminal-table'
|
|
7
7
|
require 'highline/import'
|
|
8
|
-
require 'colorize'
|
|
9
8
|
require 'rugged'
|
|
10
9
|
require 'circleci'
|
|
11
10
|
require 'terminal-notifier'
|
|
@@ -18,61 +17,149 @@ require 'circleci/cli/networking'
|
|
|
18
17
|
|
|
19
18
|
module CircleCI
|
|
20
19
|
module CLI
|
|
21
|
-
class Runner < Thor
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
class Runner < Thor # rubocop:disable Metrics/ClassLength
|
|
21
|
+
package_name 'circleci-cli'
|
|
22
|
+
|
|
23
|
+
class << self
|
|
24
|
+
def project
|
|
25
|
+
repository = Rugged::Repository.new('.')
|
|
26
|
+
origin = repository.remotes.find { |r| r.name == 'origin' }
|
|
27
|
+
regexp = %r{(?:git@|https://)github.com(?::|/)([\w_-]+/[.\w_-]+?)(?:\.git)*$}
|
|
28
|
+
return Regexp.last_match(1) if origin.url =~ regexp
|
|
29
|
+
|
|
30
|
+
nil
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def branch_name
|
|
34
|
+
repository = Rugged::Repository.new('.')
|
|
35
|
+
head = repository.head
|
|
36
|
+
|
|
37
|
+
return nil unless head.branch?
|
|
38
|
+
|
|
39
|
+
head.name.sub(%r{\Arefs/heads/}, '')
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
desc 'projects', 'List projects'
|
|
44
|
+
method_option :pretty, type: :boolean, default: true, desc: 'Make output pretty'
|
|
24
45
|
def projects
|
|
25
46
|
Command::ProjectsCommand.run(options)
|
|
26
47
|
end
|
|
27
48
|
|
|
28
|
-
desc 'builds', '
|
|
29
|
-
method_option :project,
|
|
30
|
-
|
|
31
|
-
|
|
49
|
+
desc 'builds', 'List builds'
|
|
50
|
+
method_option :project,
|
|
51
|
+
aliases: 'p',
|
|
52
|
+
type: :string,
|
|
53
|
+
banner: 'user/project',
|
|
54
|
+
default: project,
|
|
55
|
+
desc: 'A project you want to get.'
|
|
56
|
+
method_option :branch,
|
|
57
|
+
aliases: 'b',
|
|
58
|
+
type: :string,
|
|
59
|
+
banner: 'some-branch',
|
|
60
|
+
default: branch_name,
|
|
61
|
+
desc: 'A branch name you want to filter with.'
|
|
62
|
+
method_option :all,
|
|
63
|
+
aliases: 'a',
|
|
64
|
+
type: :boolean,
|
|
65
|
+
default: false,
|
|
66
|
+
desc: 'Target all the branches. This option overwrites branch option.'
|
|
67
|
+
method_option :pretty, type: :boolean, banner: 'true/false', default: true, desc: 'Make output pretty.'
|
|
32
68
|
def builds
|
|
33
69
|
Command::BuildsCommand.run(options)
|
|
34
70
|
end
|
|
35
71
|
|
|
36
|
-
desc 'build', '
|
|
37
|
-
method_option :project,
|
|
38
|
-
|
|
39
|
-
|
|
72
|
+
desc 'build', 'Show the build result'
|
|
73
|
+
method_option :project,
|
|
74
|
+
aliases: 'p',
|
|
75
|
+
type: :string,
|
|
76
|
+
banner: 'user/project',
|
|
77
|
+
default: project,
|
|
78
|
+
desc: 'A project you want to get.'
|
|
79
|
+
method_option :build, aliases: 'n', type: :numeric, banner: 'build-number', desc: 'Build number you want to get.'
|
|
80
|
+
method_option :last, aliases: 'l', type: :boolean, default: false, desc: 'Get last failed build.'
|
|
81
|
+
method_option :pretty, type: :boolean, banner: 'true/false', default: true, desc: 'Make output pretty.'
|
|
40
82
|
def build
|
|
41
83
|
Command::BuildCommand.run(options)
|
|
42
84
|
end
|
|
43
85
|
|
|
44
|
-
desc 'browse', '
|
|
45
|
-
method_option :project,
|
|
46
|
-
|
|
86
|
+
desc 'browse', 'Open CircleCI website'
|
|
87
|
+
method_option :project,
|
|
88
|
+
aliases: 'p',
|
|
89
|
+
type: :string,
|
|
90
|
+
banner: 'user/project',
|
|
91
|
+
default: project,
|
|
92
|
+
desc: 'A project you want to get.'
|
|
93
|
+
method_option :build,
|
|
94
|
+
aliases: 'n',
|
|
95
|
+
type: :numeric,
|
|
96
|
+
banner: 'build-number',
|
|
97
|
+
desc: 'Build number you want to browse.'
|
|
47
98
|
def browse
|
|
48
99
|
Command::BrowseCommand.run(options)
|
|
49
100
|
end
|
|
50
101
|
|
|
51
|
-
desc 'retry', '
|
|
52
|
-
method_option :project,
|
|
53
|
-
|
|
54
|
-
|
|
102
|
+
desc 'retry', 'Retry a build'
|
|
103
|
+
method_option :project,
|
|
104
|
+
aliases: 'p',
|
|
105
|
+
type: :string,
|
|
106
|
+
banner: 'user/project',
|
|
107
|
+
default: project,
|
|
108
|
+
desc: 'A project you want to get.'
|
|
109
|
+
method_option :build,
|
|
110
|
+
aliases: 'n',
|
|
111
|
+
type: :numeric,
|
|
112
|
+
banner: 'build-number',
|
|
113
|
+
desc: 'Build number you want to retry.'
|
|
114
|
+
method_option :last, aliases: 'l', type: :boolean, desc: 'Retry last failed build.'
|
|
55
115
|
def retry
|
|
56
116
|
Command::RetryCommand.run(options)
|
|
57
117
|
end
|
|
58
118
|
|
|
59
|
-
desc 'cancel', '
|
|
60
|
-
method_option :project,
|
|
61
|
-
|
|
119
|
+
desc 'cancel', 'Cancel a build'
|
|
120
|
+
method_option :project,
|
|
121
|
+
aliases: 'p',
|
|
122
|
+
type: :string,
|
|
123
|
+
default: project,
|
|
124
|
+
desc: 'A project you want to get.'
|
|
125
|
+
method_option :build,
|
|
126
|
+
aliases: 'n',
|
|
127
|
+
type: :numeric,
|
|
128
|
+
banner: 'build-number',
|
|
129
|
+
desc: 'Build number you want to cancel.'
|
|
62
130
|
def cancel
|
|
63
131
|
Command::CancelCommand.run(options)
|
|
64
132
|
end
|
|
65
133
|
|
|
66
|
-
desc 'watch', '
|
|
67
|
-
method_option :project,
|
|
68
|
-
|
|
134
|
+
desc 'watch', 'Watch builds in real time'
|
|
135
|
+
method_option :project,
|
|
136
|
+
aliases: 'p',
|
|
137
|
+
type: :string,
|
|
138
|
+
banner: 'user/project',
|
|
139
|
+
default: project,
|
|
140
|
+
desc: 'A project you want to get.'
|
|
141
|
+
method_option :branch,
|
|
142
|
+
aliases: 'b',
|
|
143
|
+
type: :string,
|
|
144
|
+
banner: 'some-branch',
|
|
145
|
+
default: branch_name,
|
|
146
|
+
desc: 'A branch name you want to filter with.'
|
|
147
|
+
method_option :all,
|
|
148
|
+
aliases: 'a',
|
|
149
|
+
type: :boolean,
|
|
150
|
+
default: false,
|
|
151
|
+
desc: 'Target all the branches. This option overwrites branch option.'
|
|
69
152
|
method_option :user, aliases: 'u', type: :string, banner: 'user'
|
|
70
|
-
method_option :verbose,
|
|
153
|
+
method_option :verbose,
|
|
154
|
+
aliases: 'v',
|
|
155
|
+
type: :boolean,
|
|
156
|
+
default: false,
|
|
157
|
+
desc: 'Show all the build logs including successful build steps.'
|
|
71
158
|
def watch
|
|
72
159
|
Command::WatchCommand.run(options)
|
|
73
160
|
end
|
|
74
161
|
|
|
75
|
-
desc 'version', '
|
|
162
|
+
desc 'version', 'Show gem version'
|
|
76
163
|
def version
|
|
77
164
|
say CircleCI::CLI::VERSION
|
|
78
165
|
end
|
|
@@ -14,30 +14,23 @@ module CircleCI
|
|
|
14
14
|
def project_name(options)
|
|
15
15
|
if options.project
|
|
16
16
|
options.project
|
|
17
|
-
elsif reponame
|
|
18
|
-
reponame
|
|
19
17
|
else
|
|
20
18
|
say Printer::ProjectPrinter.new(Response::Project.all).to_s
|
|
21
19
|
ask('Input user-name/project-name :')
|
|
22
20
|
end
|
|
23
21
|
end
|
|
24
22
|
|
|
25
|
-
def
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
nil
|
|
23
|
+
def branch_name(options)
|
|
24
|
+
if options.all
|
|
25
|
+
nil
|
|
26
|
+
else
|
|
27
|
+
options.branch
|
|
28
|
+
end
|
|
32
29
|
end
|
|
33
30
|
|
|
34
31
|
def build_number(options)
|
|
35
32
|
options.build || ask('Input build number')
|
|
36
33
|
end
|
|
37
|
-
|
|
38
|
-
def should_be_pretty(options)
|
|
39
|
-
options['format'] != 'simple'
|
|
40
|
-
end
|
|
41
34
|
end
|
|
42
35
|
end
|
|
43
36
|
end
|
|
@@ -7,16 +7,16 @@ module CircleCI
|
|
|
7
7
|
class << self
|
|
8
8
|
def run(options)
|
|
9
9
|
setup_token
|
|
10
|
-
|
|
10
|
+
project_name = project_name(options)
|
|
11
|
+
username, reponame = project_name.split('/')
|
|
12
|
+
branch = branch_name(options)
|
|
13
|
+
builds = if branch
|
|
14
|
+
Response::Build.branch(username, reponame, branch)
|
|
15
|
+
else
|
|
16
|
+
Response::Build.all(username, reponame)
|
|
17
|
+
end
|
|
11
18
|
|
|
12
|
-
builds
|
|
13
|
-
if options.branch
|
|
14
|
-
Response::Build.branch(username, reponame, options.branch)
|
|
15
|
-
else
|
|
16
|
-
Response::Build.all(username, reponame)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
say Printer::BuildPrinter.new(builds, pretty: should_be_pretty(options)).to_s
|
|
19
|
+
say Printer::BuildPrinter.new(builds, project_name, pretty: options.pretty).to_s
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -7,7 +7,7 @@ module CircleCI
|
|
|
7
7
|
class << self
|
|
8
8
|
def run(options)
|
|
9
9
|
setup_token
|
|
10
|
-
say Printer::ProjectPrinter.new(Response::Project.all, pretty:
|
|
10
|
+
say Printer::ProjectPrinter.new(Response::Project.all, pretty: options.pretty).to_s
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -13,7 +13,12 @@ module CircleCI
|
|
|
13
13
|
|
|
14
14
|
username, reponame = project_name(options).split('/')
|
|
15
15
|
@options = options
|
|
16
|
-
@repository = BuildRepository.new(
|
|
16
|
+
@repository = BuildRepository.new(
|
|
17
|
+
username,
|
|
18
|
+
reponame,
|
|
19
|
+
branch: branch_name(options),
|
|
20
|
+
user: options.user
|
|
21
|
+
)
|
|
17
22
|
@client = Networking::CircleCIPusherClient.new.tap(&:connect)
|
|
18
23
|
@build_watcher = nil
|
|
19
24
|
|
|
@@ -14,8 +14,13 @@ module CircleCI
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def update
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
response = if @branch
|
|
18
|
+
Response::Build.branch(@username, @reponame, @branch)
|
|
19
|
+
else
|
|
20
|
+
Response::Build.all(@username, @reponame)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
@builds = (response + @builds).uniq(&:build_number)
|
|
19
24
|
end
|
|
20
25
|
|
|
21
26
|
def mark_as_shown(build_number)
|
|
@@ -7,7 +7,6 @@ module CircleCI
|
|
|
7
7
|
attr_reader :build
|
|
8
8
|
|
|
9
9
|
def initialize(build, verbose: false)
|
|
10
|
-
@client = Networking::CircleCIPusherClient.new.tap(&:connect)
|
|
11
10
|
@build = build
|
|
12
11
|
@verbose = verbose
|
|
13
12
|
@messages = Hash.new { |h, k| h[k] = [] }
|
|
@@ -19,14 +18,14 @@ module CircleCI
|
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
def stop(status)
|
|
22
|
-
|
|
21
|
+
client.unsubscribe("#{@build.channel_name}@0")
|
|
23
22
|
notify_stopped(status)
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
private
|
|
27
26
|
|
|
28
27
|
def bind_event_handling(channel) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
29
|
-
|
|
28
|
+
client.bind_event_json(channel, 'newAction') do |json|
|
|
30
29
|
if @verbose
|
|
31
30
|
print_bordered json['log']['name']
|
|
32
31
|
else
|
|
@@ -34,7 +33,7 @@ module CircleCI
|
|
|
34
33
|
end
|
|
35
34
|
end
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
client.bind_event_json(channel, 'appendAction') do |json|
|
|
38
37
|
if @verbose
|
|
39
38
|
Thor::Shell::Basic.new.say(json['out']['message'], nil, false)
|
|
40
39
|
else
|
|
@@ -42,28 +41,32 @@ module CircleCI
|
|
|
42
41
|
end
|
|
43
42
|
end
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
client.bind_event_json(channel, 'updateAction') do |json|
|
|
46
45
|
next if @verbose
|
|
47
46
|
|
|
48
47
|
case json['log']['status']
|
|
49
48
|
when 'success'
|
|
50
|
-
puts "\e[2K\r#{json['log']['name']
|
|
49
|
+
puts "\e[2K\r#{Printer.colorize_green(json['log']['name'])}"
|
|
51
50
|
when 'failed'
|
|
52
|
-
puts "\e[2K\r#{json['log']['name']
|
|
51
|
+
puts "\e[2K\r#{Printer.colorize_red(json['log']['name'])}"
|
|
53
52
|
@messages[json['step']].each(&method(:say))
|
|
54
53
|
end
|
|
55
54
|
end
|
|
56
55
|
end
|
|
57
56
|
|
|
58
57
|
def notify_started
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
say Printer::BuildPrinter.header_for(
|
|
59
|
+
@build,
|
|
60
|
+
"👀 Start watching #{@build.project_name} ##{@build.build_number}"
|
|
61
|
+
)
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
def notify_stopped(status)
|
|
64
65
|
text = case status
|
|
65
|
-
when 'success'
|
|
66
|
-
|
|
66
|
+
when 'success'
|
|
67
|
+
Printer.colorize_green("🎉 #{@build.project_name} ##{@build.build_number} has succeeded!")
|
|
68
|
+
when 'failed'
|
|
69
|
+
Printer.colorize_red("😥 #{@build.project_name} ##{@build.build_number} has failed...")
|
|
67
70
|
end
|
|
68
71
|
|
|
69
72
|
@verbose ? print_bordered(text) : say(text)
|
|
@@ -72,6 +75,10 @@ module CircleCI
|
|
|
72
75
|
def print_bordered(text)
|
|
73
76
|
say Terminal::Table.new(rows: [[text]], style: { width: 120 }).to_s
|
|
74
77
|
end
|
|
78
|
+
|
|
79
|
+
def client
|
|
80
|
+
@client ||= Networking::CircleCIPusherClient.new.tap(&:connect)
|
|
81
|
+
end
|
|
75
82
|
end
|
|
76
83
|
end
|
|
77
84
|
end
|
|
@@ -8,45 +8,39 @@ module CircleCI
|
|
|
8
8
|
class CircleCIPusherClient
|
|
9
9
|
def connect
|
|
10
10
|
PusherClient.logger.level = Logger::ERROR
|
|
11
|
-
|
|
12
|
-
@socket.connect(true)
|
|
11
|
+
socket.connect(true)
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
def bind(channel, event)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
yield data
|
|
19
|
-
end
|
|
14
|
+
def bind(channel, event, &block)
|
|
15
|
+
socket.subscribe(channel)
|
|
16
|
+
socket[channel].bind(event, &block)
|
|
20
17
|
end
|
|
21
18
|
|
|
22
|
-
def bind_event_json(channel, event)
|
|
23
|
-
bind(channel, event)
|
|
24
|
-
JSON.parse(data).each { |json| yield(json) }
|
|
25
|
-
end
|
|
19
|
+
def bind_event_json(channel, event, &block)
|
|
20
|
+
bind(channel, event) { |data| JSON.parse(data).each(&block) }
|
|
26
21
|
end
|
|
27
22
|
|
|
28
23
|
def unsubscribe(channel)
|
|
29
|
-
|
|
24
|
+
socket.unsubscribe(channel)
|
|
30
25
|
end
|
|
31
26
|
|
|
32
27
|
private
|
|
33
28
|
|
|
34
|
-
def
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def pusher_options
|
|
39
|
-
{
|
|
29
|
+
def socket
|
|
30
|
+
@socket ||= PusherClient::Socket.new(
|
|
31
|
+
'1cf6e0e755e419d2ac9a',
|
|
40
32
|
secure: true,
|
|
41
33
|
auth_method: proc { |a, b| auth(a, b) },
|
|
42
34
|
logger: Logger.new('/dev/null')
|
|
43
|
-
|
|
35
|
+
)
|
|
44
36
|
end
|
|
45
37
|
|
|
46
38
|
def auth(socket_id, channel)
|
|
47
|
-
data = { socket_id: socket_id, channel_name: channel.name }
|
|
48
39
|
token = ENV['CIRCLE_CI_TOKEN'] || ask('Circle CI token ? :')
|
|
49
|
-
res = connection.post(
|
|
40
|
+
res = connection.post(
|
|
41
|
+
"/auth/pusher?circle-token=#{token}",
|
|
42
|
+
{ socket_id: socket_id, channel_name: channel.name }
|
|
43
|
+
)
|
|
50
44
|
JSON.parse(res.body)['auth']
|
|
51
45
|
end
|
|
52
46
|
|
data/lib/circleci/cli/printer.rb
CHANGED
|
@@ -6,6 +6,30 @@ require 'circleci/cli/printer/step_printer'
|
|
|
6
6
|
|
|
7
7
|
module CircleCI
|
|
8
8
|
module CLI
|
|
9
|
-
module Printer
|
|
9
|
+
module Printer
|
|
10
|
+
class << self
|
|
11
|
+
def colorize_red(string)
|
|
12
|
+
colorize(string, '0;31;49')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def colorize_green(string)
|
|
16
|
+
colorize(string, '0;32;49')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def colorize_yellow(string)
|
|
20
|
+
colorize(string, '0;33;49')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def colorize_light_black(string)
|
|
24
|
+
colorize(string, '0;90;49')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def colorize(string, color_code)
|
|
30
|
+
"\e[#{color_code}m#{string}\e[0m"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
10
34
|
end
|
|
11
35
|
end
|
|
@@ -7,17 +7,18 @@ module CircleCI
|
|
|
7
7
|
class << self
|
|
8
8
|
def header_for(build, title)
|
|
9
9
|
texts = [
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
10
|
+
["Project: #{build.project_name}"],
|
|
11
|
+
["Build: #{build.build_number}"],
|
|
12
|
+
["Author: #{build.author_name}"],
|
|
13
|
+
["Workflow: #{build.workflow_name}/#{build.workflow_job_name}"]
|
|
14
14
|
]
|
|
15
15
|
Terminal::Table.new(title: title, rows: texts, style: { width: 120 }).to_s
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def initialize(builds, pretty: true)
|
|
19
|
+
def initialize(builds, project_name, pretty: true)
|
|
20
20
|
@builds_to_show = builds
|
|
21
|
+
@project_name = project_name
|
|
21
22
|
@pretty = pretty
|
|
22
23
|
end
|
|
23
24
|
|
|
@@ -36,8 +37,7 @@ module CircleCI
|
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
def title
|
|
39
|
-
|
|
40
|
-
"Recent Builds / #{build.project_name}".green
|
|
40
|
+
Printer.colorize_green("Recent Builds / #{@project_name}")
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def headings
|
|
@@ -5,6 +5,7 @@ module CircleCI
|
|
|
5
5
|
module Printer
|
|
6
6
|
class ProjectPrinter
|
|
7
7
|
attr_accessor :compact
|
|
8
|
+
|
|
8
9
|
def initialize(projects, pretty: true)
|
|
9
10
|
@projects = projects
|
|
10
11
|
@pretty = pretty
|
|
@@ -26,7 +27,7 @@ module CircleCI
|
|
|
26
27
|
|
|
27
28
|
def print_pretty
|
|
28
29
|
Terminal::Table.new(
|
|
29
|
-
title: 'Projects'
|
|
30
|
+
title: Printer.colorize_green('Projects'),
|
|
30
31
|
headings: ['User name', 'Repository name'],
|
|
31
32
|
rows: @projects.map(&:information)
|
|
32
33
|
).to_s
|
|
@@ -9,14 +9,14 @@ module CircleCI
|
|
|
9
9
|
@pretty = pretty
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def to_s # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
12
|
+
def to_s # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
13
13
|
if @pretty
|
|
14
14
|
Terminal::Table.new do |t|
|
|
15
15
|
@steps
|
|
16
16
|
.group_by(&:type)
|
|
17
17
|
.each do |key, steps|
|
|
18
18
|
t << :separator
|
|
19
|
-
t << [{ value: key
|
|
19
|
+
t << [{ value: Printer.colorize_green(key), alignment: :center, colspan: 2 }]
|
|
20
20
|
steps.each { |s| print_actions(t, s) }
|
|
21
21
|
end
|
|
22
22
|
end.to_s
|
|
@@ -35,10 +35,10 @@ module CircleCI
|
|
|
35
35
|
|
|
36
36
|
def colorize_by_status(string, status)
|
|
37
37
|
case status
|
|
38
|
-
when 'success', 'fixed' then string
|
|
39
|
-
when 'canceled' then string
|
|
40
|
-
when 'failed', 'timedout' then string
|
|
41
|
-
when 'no_tests', 'not_run' then string
|
|
38
|
+
when 'success', 'fixed' then Printer.colorize_green(string)
|
|
39
|
+
when 'canceled' then Printer.colorize_yellow(string)
|
|
40
|
+
when 'failed', 'timedout' then Printer.colorize_red(string)
|
|
41
|
+
when 'no_tests', 'not_run' then Printer.colorize_light_black(string)
|
|
42
42
|
else string
|
|
43
43
|
end
|
|
44
44
|
end
|
|
@@ -46,8 +46,8 @@ module CircleCI
|
|
|
46
46
|
def format_time(time)
|
|
47
47
|
return '' unless time
|
|
48
48
|
|
|
49
|
-
minute = format('
|
|
50
|
-
second = format('
|
|
49
|
+
minute = format('%<time>02d', time: time / 1000 / 60)
|
|
50
|
+
second = format('%<time>02d', time: (time / 1000) % 60)
|
|
51
51
|
"#{minute}:#{second}"
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -39,7 +39,7 @@ module CircleCI
|
|
|
39
39
|
attr_reader :username, :build_number, :reponame, :branch, :status, :author_name, :start_time,
|
|
40
40
|
:user, :workflow_name, :workflow_job_name
|
|
41
41
|
|
|
42
|
-
def initialize(hash)
|
|
42
|
+
def initialize(hash) # rubocop:disable Metrics/MethodLength
|
|
43
43
|
@hash = hash
|
|
44
44
|
@username = hash['username']
|
|
45
45
|
@build_number = hash['build_num']
|
|
@@ -90,10 +90,10 @@ module CircleCI
|
|
|
90
90
|
|
|
91
91
|
def colorize_by_status(string, status)
|
|
92
92
|
case status
|
|
93
|
-
when 'success', 'fixed' then string
|
|
94
|
-
when 'canceled' then string
|
|
95
|
-
when 'failed' then string
|
|
96
|
-
when 'no_tests', 'not_run' then string
|
|
93
|
+
when 'success', 'fixed' then Printer.colorize_green(string)
|
|
94
|
+
when 'canceled' then Printer.colorize_yellow(string)
|
|
95
|
+
when 'failed' then Printer.colorize_red(string)
|
|
96
|
+
when 'no_tests', 'not_run' then Printer.colorize_light_black(string)
|
|
97
97
|
else string
|
|
98
98
|
end
|
|
99
99
|
end
|
|
@@ -101,8 +101,8 @@ module CircleCI
|
|
|
101
101
|
def format_time(time)
|
|
102
102
|
return '' unless time
|
|
103
103
|
|
|
104
|
-
minute = format('
|
|
105
|
-
second = format('
|
|
104
|
+
minute = format('%<time>02d', time: time / 1000 / 60)
|
|
105
|
+
second = format('%<time>02d', time: (time / 1000) % 60)
|
|
106
106
|
"#{minute}:#{second}"
|
|
107
107
|
end
|
|
108
108
|
end
|
data/lib/circleci/cli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: circleci-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- unhappychoice
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-08-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: circleci
|
|
@@ -24,20 +24,6 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: 2.0.2
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: colorize
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.8.1
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.8.1
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: faraday
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -47,7 +33,7 @@ dependencies:
|
|
|
47
33
|
version: '0.14'
|
|
48
34
|
- - "<"
|
|
49
35
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: '
|
|
36
|
+
version: '1.1'
|
|
51
37
|
type: :runtime
|
|
52
38
|
prerelease: false
|
|
53
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -57,7 +43,7 @@ dependencies:
|
|
|
57
43
|
version: '0.14'
|
|
58
44
|
- - "<"
|
|
59
45
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '
|
|
46
|
+
version: '1.1'
|
|
61
47
|
- !ruby/object:Gem::Dependency
|
|
62
48
|
name: highline
|
|
63
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -82,16 +68,22 @@ dependencies:
|
|
|
82
68
|
name: launchy
|
|
83
69
|
requirement: !ruby/object:Gem::Requirement
|
|
84
70
|
requirements:
|
|
85
|
-
- - "
|
|
71
|
+
- - ">="
|
|
86
72
|
- !ruby/object:Gem::Version
|
|
87
73
|
version: 2.4.3
|
|
74
|
+
- - "<"
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: 2.6.0
|
|
88
77
|
type: :runtime
|
|
89
78
|
prerelease: false
|
|
90
79
|
version_requirements: !ruby/object:Gem::Requirement
|
|
91
80
|
requirements:
|
|
92
|
-
- - "
|
|
81
|
+
- - ">="
|
|
93
82
|
- !ruby/object:Gem::Version
|
|
94
83
|
version: 2.4.3
|
|
84
|
+
- - "<"
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: 2.6.0
|
|
95
87
|
- !ruby/object:Gem::Dependency
|
|
96
88
|
name: pusher-client
|
|
97
89
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -115,7 +107,7 @@ dependencies:
|
|
|
115
107
|
version: '0.26'
|
|
116
108
|
- - "<"
|
|
117
109
|
- !ruby/object:Gem::Version
|
|
118
|
-
version: '
|
|
110
|
+
version: '1.1'
|
|
119
111
|
type: :runtime
|
|
120
112
|
prerelease: false
|
|
121
113
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -125,7 +117,7 @@ dependencies:
|
|
|
125
117
|
version: '0.26'
|
|
126
118
|
- - "<"
|
|
127
119
|
- !ruby/object:Gem::Version
|
|
128
|
-
version: '
|
|
120
|
+
version: '1.1'
|
|
129
121
|
- !ruby/object:Gem::Dependency
|
|
130
122
|
name: terminal-notifier
|
|
131
123
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -158,16 +150,22 @@ dependencies:
|
|
|
158
150
|
name: thor
|
|
159
151
|
requirement: !ruby/object:Gem::Requirement
|
|
160
152
|
requirements:
|
|
161
|
-
- - "
|
|
153
|
+
- - ">="
|
|
162
154
|
- !ruby/object:Gem::Version
|
|
163
|
-
version: 0.20
|
|
155
|
+
version: '0.20'
|
|
156
|
+
- - "<"
|
|
157
|
+
- !ruby/object:Gem::Version
|
|
158
|
+
version: '1.1'
|
|
164
159
|
type: :runtime
|
|
165
160
|
prerelease: false
|
|
166
161
|
version_requirements: !ruby/object:Gem::Requirement
|
|
167
162
|
requirements:
|
|
168
|
-
- - "
|
|
163
|
+
- - ">="
|
|
169
164
|
- !ruby/object:Gem::Version
|
|
170
|
-
version: 0.20
|
|
165
|
+
version: '0.20'
|
|
166
|
+
- - "<"
|
|
167
|
+
- !ruby/object:Gem::Version
|
|
168
|
+
version: '1.1'
|
|
171
169
|
- !ruby/object:Gem::Dependency
|
|
172
170
|
name: bundler
|
|
173
171
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -320,6 +318,7 @@ files:
|
|
|
320
318
|
- ".circleci/config.yml"
|
|
321
319
|
- ".github/workflows/test.yml"
|
|
322
320
|
- ".rubocop.yml"
|
|
321
|
+
- ".ruby-version"
|
|
323
322
|
- CHANGELOG.md
|
|
324
323
|
- CODE_OF_CONDUCT.md
|
|
325
324
|
- Gemfile
|
|
@@ -372,7 +371,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
372
371
|
requirements:
|
|
373
372
|
- - ">="
|
|
374
373
|
- !ruby/object:Gem::Version
|
|
375
|
-
version: '
|
|
374
|
+
version: '2.5'
|
|
376
375
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
377
376
|
requirements:
|
|
378
377
|
- - ">="
|