octocheck 0.1.0 → 0.2.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/README.md +20 -37
- data/lib/octocheck/api.rb +4 -3
- data/lib/octocheck/formatters/iterm2.rb +24 -3
- data/lib/octocheck/formatters/simple.rb +25 -3
- data/lib/octocheck/summary.rb +4 -0
- data/lib/octocheck/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bd35dfaeee268f1d3daf61cc078347ff1e431c9
|
4
|
+
data.tar.gz: ef74400a142c4722381274a76e558b58496cf41b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51fe6549ea9540916697ac3df1976a1200b053825b143e041f656c1cebbc0e0036831f4bcf83a476a6870172eeead016cdd13ff9ee01caf475fa1f3b57c0a22a
|
7
|
+
data.tar.gz: fc7426aec7e22337e978f83d3ab95a11a5ce0eeea9d5e185dfe6c826ea6441db010ceec8f6955cfa1a8e53adea8e54c822a1b5328287dbc5ebb14196539b402d
|
data/README.md
CHANGED
@@ -1,52 +1,33 @@
|
|
1
|
-
|
1
|
+
See github status checks in your terminal. (https://help.github.com/en/articles/about-status-checks)
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/octocheck`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
3
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'octocheck'
|
13
4
|
```
|
5
|
+
$ octocheck
|
14
6
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install octocheck
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
7
|
+
success ci-check-1 https://example.com/ci-check-1
|
8
|
+
in_progress ci-check-2 https://example.com/ci-check-2
|
9
|
+
failed ci-check-3 https://example.com/ci-check-3
|
10
|
+
```
|
32
11
|
|
33
|
-
|
12
|
+
### Installation
|
34
13
|
|
35
|
-
|
36
|
-
See github status checks in your terminal.
|
37
|
-
(https://help.github.com/en/articles/about-status-checks)
|
14
|
+
Requires ruby > 2.1.0
|
38
15
|
|
39
|
-
|
16
|
+
```
|
17
|
+
gem install octocheck
|
18
|
+
```
|
40
19
|
|
41
|
-
|
20
|
+
### OPTIONS
|
42
21
|
|
22
|
+
```
|
43
23
|
-b, --branch: defaults to current repo's branch
|
44
24
|
-p, --project: defaults to repo directory name
|
45
25
|
-o, --org: the Github org that owns the repo (see CONFIGURATION below)
|
46
26
|
-r, --revision: defaults to latest revision on current branch
|
47
27
|
-t, --token: your github API token (see CONFIGURATION below)
|
28
|
+
```
|
48
29
|
|
49
|
-
|
30
|
+
### CONFIGURATION
|
50
31
|
|
51
32
|
You can specify your github org and token in a configuration file so
|
52
33
|
that you don't need to configure them each time.
|
@@ -54,12 +35,14 @@ that you don't need to configure them each time.
|
|
54
35
|
Put a json formatted file at ~/.config/octocheck/config.json with the
|
55
36
|
following data:
|
56
37
|
|
38
|
+
```json
|
57
39
|
{
|
58
40
|
"token": "< github token value >",
|
59
41
|
"org": "< github org name >"
|
60
42
|
}
|
43
|
+
```
|
61
44
|
|
62
|
-
|
45
|
+
### ORG
|
63
46
|
|
64
47
|
Unfortunately when accessing status checks for a repo, the repo's
|
65
48
|
organization must be specified. :( The organization can be found in
|
@@ -67,7 +50,7 @@ the repo's url:
|
|
67
50
|
|
68
51
|
https://github.com/ORGNAME/repo_name
|
69
52
|
|
70
|
-
|
53
|
+
### TOKEN
|
71
54
|
|
72
55
|
In order to read Github checks, you need to configure (or pass as an
|
73
56
|
argument) a token with rights to "repo" permissions:
|
@@ -80,7 +63,7 @@ argument) a token with rights to "repo" permissions:
|
|
80
63
|
Unfortunately full `repo` access is needed in order to access Github
|
81
64
|
status checks. Hopefully they change that soon.
|
82
65
|
|
83
|
-
|
66
|
+
### OUTPUT
|
84
67
|
|
85
68
|
Checks are listed in the order they are received. There is some basic
|
86
69
|
colorization applied based on the status names. When using Iterm2, the
|
data/lib/octocheck/api.rb
CHANGED
@@ -18,7 +18,7 @@ module Octocheck
|
|
18
18
|
{
|
19
19
|
name: j["context"],
|
20
20
|
state: j["state"].downcase,
|
21
|
-
|
21
|
+
target_url: j["target_url"]
|
22
22
|
}
|
23
23
|
}
|
24
24
|
.uniq {|j| j[:name]}
|
@@ -31,7 +31,8 @@ module Octocheck
|
|
31
31
|
{
|
32
32
|
name: cr["name"],
|
33
33
|
state: cr["status"].downcase,
|
34
|
-
|
34
|
+
github_url: "https://github.com/#{org}/#{repo}/runs/#{cr["id"]}",
|
35
|
+
target_url: cr["details_url"],
|
35
36
|
details: check_run_details(cr["output"]["summary"])
|
36
37
|
}
|
37
38
|
}
|
@@ -49,7 +50,7 @@ module Octocheck
|
|
49
50
|
{
|
50
51
|
name: structure[:name],
|
51
52
|
state: structure[:state].downcase,
|
52
|
-
|
53
|
+
target_url: structure[:url]
|
53
54
|
}
|
54
55
|
else
|
55
56
|
nil
|
@@ -14,29 +14,50 @@ module Octocheck
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def format(summary)
|
17
|
+
counts = {}
|
17
18
|
cols = []
|
18
19
|
summary.statuses.each do |status|
|
20
|
+
counts[status.fetch(:state)] = (counts[status.fetch(:state)] || 0) + 1
|
21
|
+
|
19
22
|
cols << [
|
20
|
-
linkify(status.fetch(:state), status.fetch(:
|
23
|
+
linkify(status.fetch(:state), status.fetch(:target_url)),
|
21
24
|
status.fetch(:name)
|
22
25
|
].join(" ")
|
23
26
|
end
|
24
27
|
|
25
28
|
summary.check_runs.each do |run|
|
29
|
+
counts[run.fetch(:state)] = (counts[run.fetch(:state)] || 0) + 1
|
30
|
+
|
26
31
|
cols << [
|
27
|
-
linkify(run.fetch(:state), run.fetch(:
|
32
|
+
linkify(run.fetch(:state), run.fetch(:target_url)),
|
28
33
|
run.fetch(:name)
|
29
34
|
].join(" ")
|
30
35
|
|
31
36
|
run.fetch(:details).each do |detail|
|
37
|
+
counts[detail.fetch(:state)] = (counts[detail.fetch(:state)] || 0) + 1
|
38
|
+
|
32
39
|
cols << [
|
33
|
-
linkify(detail.fetch(:state), detail.fetch(:
|
40
|
+
linkify(detail.fetch(:state), detail.fetch(:target_url)),
|
34
41
|
detail.fetch(:name)
|
35
42
|
].join(" ")
|
36
43
|
end
|
37
44
|
end
|
38
45
|
|
39
46
|
io.puts(cols.join("\n"))
|
47
|
+
|
48
|
+
state_summaries =
|
49
|
+
counts
|
50
|
+
.sort
|
51
|
+
.map {|state, count| "#{count} #{state}"}
|
52
|
+
.join(", ")
|
53
|
+
|
54
|
+
link_summaries =
|
55
|
+
summary
|
56
|
+
.check_runs
|
57
|
+
.map {|cr| cr.fetch(:github_url) }
|
58
|
+
.join("\n")
|
59
|
+
|
60
|
+
io.puts(["", state_summaries, link_summaries].join("\n"))
|
40
61
|
end
|
41
62
|
|
42
63
|
def linkify(text, url)
|
@@ -14,32 +14,54 @@ module Octocheck
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def format(summary)
|
17
|
+
counts = {}
|
17
18
|
cols = []
|
18
19
|
summary.statuses.each do |status|
|
20
|
+
counts[status.fetch(:state)] = (counts[status.fetch(:state)] || 0) + 1
|
21
|
+
|
19
22
|
cols << [
|
20
23
|
colorize(status.fetch(:state)),
|
21
24
|
status.fetch(:name),
|
22
|
-
status.fetch(:
|
25
|
+
status.fetch(:target_url)
|
23
26
|
].join(" ")
|
24
27
|
end
|
25
28
|
|
26
29
|
summary.check_runs.each do |run|
|
30
|
+
counts[run.fetch(:state)] = (counts[run.fetch(:state)] || 0) + 1
|
31
|
+
|
27
32
|
cols << [
|
28
33
|
colorize(run.fetch(:state)),
|
29
34
|
run.fetch(:name),
|
30
|
-
run.fetch(:
|
35
|
+
run.fetch(:target_url)
|
31
36
|
].join(" ")
|
32
37
|
|
33
38
|
run.fetch(:details).each do |detail|
|
39
|
+
counts[detail.fetch(:state)] = (counts[detail.fetch(:state)] || 0) + 1
|
40
|
+
|
34
41
|
cols << [
|
35
42
|
colorize(detail.fetch(:state)),
|
36
43
|
detail.fetch(:name),
|
37
|
-
detail.fetch(:
|
44
|
+
detail.fetch(:target_url)
|
38
45
|
].join(" ")
|
39
46
|
end
|
40
47
|
end
|
41
48
|
|
42
49
|
io.puts(cols.join("\n"))
|
50
|
+
|
51
|
+
state_summaries =
|
52
|
+
counts
|
53
|
+
.sort
|
54
|
+
.map {|state, count| "#{count} #{state}"}
|
55
|
+
.join(", ")
|
56
|
+
|
57
|
+
link_summaries =
|
58
|
+
summary
|
59
|
+
.check_runs
|
60
|
+
.map {|cr| cr.fetch(:github_url) }
|
61
|
+
.join("\n")
|
62
|
+
|
63
|
+
io.puts(["", state_summaries, link_summaries].join("\n"))
|
64
|
+
|
43
65
|
end
|
44
66
|
|
45
67
|
def colorize(text)
|
data/lib/octocheck/summary.rb
CHANGED
data/lib/octocheck/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octocheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Kinnecom
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|