octocheck 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/README.md +3 -0
- data/exe/octocheck +4 -4
- data/lib/octocheck/api.rb +6 -0
- data/lib/octocheck/cli.rb +1 -4
- data/lib/octocheck/formatters/iterm2.rb +34 -24
- data/lib/octocheck/summary.rb +4 -0
- data/lib/octocheck/version.rb +1 -1
- data/octocheck.gemspec +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34f9e72473d8a5d8e972b1142ddf2458cb74dea7fab8cd2fa3cc2e3495df1edd
|
4
|
+
data.tar.gz: 73a25bd652cba4f57b0d23f3f8f8a7991583f903fdb49c09130c244e061adde2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cb02f476bd804a35b233796b2cc9993989ec20add750e742ffca9742d7bc156c5f508bd8c0af26705fff921794c7eaf6b742ff01dea5bc04fd39d85c5422cf9
|
7
|
+
data.tar.gz: 985b3b5b213612c45da2355d2d8b4ae888b29a472af22338e0a174e67be697cdaec69ae326b1c173eea3921b50aaaeea9df50f4f31cfc888fd3760c774b935af
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
octocheck (0.
|
4
|
+
octocheck (0.4.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
rake (
|
9
|
+
rake (13.0.6)
|
10
10
|
|
11
11
|
PLATFORMS
|
12
|
-
|
12
|
+
x86_64-darwin-20
|
13
13
|
|
14
14
|
DEPENDENCIES
|
15
|
-
bundler
|
15
|
+
bundler
|
16
16
|
octocheck!
|
17
|
-
rake (~>
|
17
|
+
rake (~> 13.0)
|
18
18
|
|
19
19
|
BUNDLED WITH
|
20
|
-
|
20
|
+
2.3.3
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
See github status checks in your terminal. (https://help.github.com/en/articles/about-status-checks)
|
2
2
|
|
3
|
+
Bonus: displays a link to an existing PR!
|
4
|
+
Super bonus: displays a link to open a PR if one doesn't exist!
|
5
|
+
Super extra bonus: use this in front of your non-programmer friends and they will think you are a super cool hacker!
|
3
6
|
|
4
7
|
```
|
5
8
|
$ octocheck
|
data/exe/octocheck
CHANGED
@@ -16,7 +16,7 @@ HELP = <<~TXT
|
|
16
16
|
[Options]
|
17
17
|
|
18
18
|
-b, --branch: defaults to current repo's branch
|
19
|
-
-p, --
|
19
|
+
-p, --reponame: defaults to repo directory name
|
20
20
|
-o, --org: the Github org that owns the repo (see CONFIGURATION below)
|
21
21
|
-r, --revision: defaults to latest revision on current branch
|
22
22
|
-t, --token: your github API token (see CONFIGURATION below)
|
@@ -58,9 +58,9 @@ HELP = <<~TXT
|
|
58
58
|
[OUTPUT]
|
59
59
|
|
60
60
|
Checks are listed in the order they are received. There is some basic
|
61
|
-
colorization applied based on the status names. When using Iterm2,
|
62
|
-
status names are links to the check target. Other terminals have the
|
63
|
-
|
61
|
+
colorization applied based on the status names. When using Iterm2 or vscode,
|
62
|
+
the status names are links to the check target. Other terminals have the link
|
63
|
+
appended to the output.
|
64
64
|
TXT
|
65
65
|
|
66
66
|
options = {}
|
data/lib/octocheck/api.rb
CHANGED
@@ -22,6 +22,12 @@ module Octocheck
|
|
22
22
|
"https://github.com/#{org}/#{repo}/tree/#{branch}"
|
23
23
|
end
|
24
24
|
|
25
|
+
def open_pr_link
|
26
|
+
return unless branch
|
27
|
+
|
28
|
+
"https://github.com/appfolio/apm_bundle/compare/#{branch}?expand=1"
|
29
|
+
end
|
30
|
+
|
25
31
|
def statuses
|
26
32
|
get("repos/#{org}/#{repo}/commits/#{branch}/statuses")
|
27
33
|
.map {|j|
|
data/lib/octocheck/cli.rb
CHANGED
@@ -17,10 +17,7 @@ module Octocheck
|
|
17
17
|
api: api
|
18
18
|
)
|
19
19
|
|
20
|
-
using_iterm2 = (
|
21
|
-
ENV["TERM_PROGRAM"] == "iTerm.app" &&
|
22
|
-
ENV.fetch("TERM_PROGRAM_VERSION", "").match(/3.[23456789]/)
|
23
|
-
)
|
20
|
+
using_iterm2 = ["iTerm.app", "vscode"].include?(ENV["TERM_PROGRAM"])
|
24
21
|
|
25
22
|
formatter =
|
26
23
|
if using_iterm2
|
@@ -20,8 +20,8 @@ module Octocheck
|
|
20
20
|
counts[status.fetch(:state)] = (counts[status.fetch(:state)] || 0) + 1
|
21
21
|
|
22
22
|
cols << [
|
23
|
-
|
24
|
-
status.fetch(:name)
|
23
|
+
colorify(status.fetch(:state)),
|
24
|
+
linkify(status.fetch(:name), status.fetch(:target_url))
|
25
25
|
].join(" ")
|
26
26
|
end
|
27
27
|
|
@@ -29,16 +29,16 @@ module Octocheck
|
|
29
29
|
counts[run.fetch(:state)] = (counts[run.fetch(:state)] || 0) + 1
|
30
30
|
|
31
31
|
cols << [
|
32
|
-
|
33
|
-
run.fetch(:name)
|
32
|
+
colorify(run.fetch(:state)),
|
33
|
+
linkify(run.fetch(:name), run.fetch(:target_url))
|
34
34
|
].join(" ")
|
35
35
|
|
36
36
|
run.fetch(:details).each do |detail|
|
37
37
|
counts[detail.fetch(:state)] = (counts[detail.fetch(:state)] || 0) + 1
|
38
38
|
|
39
39
|
cols << [
|
40
|
-
|
41
|
-
detail.fetch(:name)
|
40
|
+
colorify(detail.fetch(:state)),
|
41
|
+
linkify(detail.fetch(:name), detail.fetch(:target_url))
|
42
42
|
].join(" ")
|
43
43
|
end
|
44
44
|
end
|
@@ -72,30 +72,40 @@ module Octocheck
|
|
72
72
|
]
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
if summary.pr_links.empty? && summary.open_pr_link
|
76
|
+
output += [
|
77
|
+
"",
|
78
|
+
"Open Pull Request:",
|
79
|
+
summary.open_pr_link
|
80
|
+
]
|
81
|
+
|
82
|
+
else
|
83
|
+
(summary.pr_links).each do |repo_link|
|
84
|
+
output += [
|
85
|
+
"",
|
86
|
+
"Pull Request:",
|
87
|
+
repo_link
|
88
|
+
]
|
89
|
+
end
|
81
90
|
end
|
82
91
|
|
83
92
|
io.puts(output.join("\n"))
|
84
93
|
end
|
85
94
|
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
95
|
+
def colorify(text)
|
96
|
+
if text.match(GREEN_REGEX)
|
97
|
+
green(text)
|
98
|
+
elsif text.match(RED_REGEX)
|
99
|
+
red(text)
|
100
|
+
elsif text.match(BLUE_REGEX)
|
101
|
+
blue(text)
|
102
|
+
else
|
103
|
+
yellow(text)
|
104
|
+
end
|
105
|
+
end
|
97
106
|
|
98
|
-
|
107
|
+
def linkify(text, url)
|
108
|
+
"\e]8;;#{url}\a#{text}\e]8;;\a"
|
99
109
|
end
|
100
110
|
end
|
101
111
|
end
|
data/lib/octocheck/summary.rb
CHANGED
data/lib/octocheck/version.rb
CHANGED
data/octocheck.gemspec
CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler"
|
24
|
-
spec.add_development_dependency "rake", "~>
|
23
|
+
spec.add_development_dependency "bundler"
|
24
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
25
25
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octocheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.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: 2022-
|
11
|
+
date: 2022-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
- git@k7u7.com
|