octocheck 0.3.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 899907062201dd5d74081caa5e1fd0f294757469d3419c59f338ff0ffed8539f
4
- data.tar.gz: 445e9f6616c23a082c2f888000aa1501cc33429d42d8261b19ddf55d08db8db0
3
+ metadata.gz: 10c1a17c413b4f0e138356cf06cca760ad86a1f981b020217fec2b831ac3de92
4
+ data.tar.gz: c7a7ce9b7ffd818366799c9801434c5ee0a931fca28a10b05935256d63f23d6c
5
5
  SHA512:
6
- metadata.gz: 5c48f91c82bd8b3f0174e1a8bf499b21588ed873c01e574141724742991ae408d4844485c361eab1da24903350d0b80d737b322b5c1d9f10fd497fb0af52d62e
7
- data.tar.gz: a6d2e4921e1cd0f585b8a0f0d2099855ae4cdad0e17a33d8e06f8ec7c0302285a7253910cc84949fc743dc53d945204bb8f9fe67cef733fb7ac4a81d70adc0e3
6
+ metadata.gz: f899fcdbf86b8befd504925f80a6de4d78493245202eff13a0c99381833eada244d61ad5f9bdd875f619c5301549c956a6815f0d8addfc70ed23217294278929
7
+ data.tar.gz: d63480ecfaf66ed1640666e1d77f8387976ac8b9ff8038264b03a7a937f40a92ba5ad9464fc3d183187840621c48899976b2ec85176463deeed2dd87d678ceed
data/Gemfile.lock CHANGED
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- octocheck (0.2.1)
4
+ octocheck (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- rake (10.5.0)
9
+ rake (13.0.6)
10
10
 
11
11
  PLATFORMS
12
- ruby
12
+ x86_64-darwin-20
13
13
 
14
14
  DEPENDENCIES
15
- bundler (~> 1.16)
15
+ bundler
16
16
  octocheck!
17
- rake (~> 10.0)
17
+ rake (~> 13.0)
18
18
 
19
19
  BUNDLED WITH
20
- 1.17.3
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, --project: defaults to repo directory name
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, the
62
- status names are links to the check target. Other terminals have the
63
- link appended to the output.
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/#{org}/#{repo}/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
- linkify(status.fetch(:state), status.fetch(:target_url)),
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
- linkify(run.fetch(:state), run.fetch(:target_url)),
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
- linkify(detail.fetch(:state), detail.fetch(:target_url)),
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
- (summary.pr_links || []).each do |repo_link|
76
- output += [
77
- "",
78
- "Pull Request:",
79
- repo_link
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 linkify(text, url)
87
- colorized_text =
88
- if text.match(GREEN_REGEX)
89
- green(text)
90
- elsif text.match(RED_REGEX)
91
- red(text)
92
- elsif text.match(BLUE_REGEX)
93
- blue(text)
94
- else
95
- yellow(text)
96
- end
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
- "\e]8;;#{url}\a#{colorized_text}\e]8;;\a"
107
+ def linkify(text, url)
108
+ "\e]8;;#{url}\a#{text}\e]8;;\a"
99
109
  end
100
110
  end
101
111
  end
@@ -13,6 +13,10 @@ module Octocheck
13
13
  @check_runs ||= api.check_runs
14
14
  end
15
15
 
16
+ def open_pr_link
17
+ @open_pr_link ||= api.open_pr_link
18
+ end
19
+
16
20
  def pr_links
17
21
  @pr_links ||= api.pr_links
18
22
  end
@@ -1,3 +1,3 @@
1
1
  module Octocheck
2
- VERSION = "0.3.2"
2
+ VERSION = "0.5.0"
3
3
  end
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", "~> 1.16"
24
- spec.add_development_dependency "rake", "~> 10.0"
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.3.2
4
+ version: 0.5.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-09-22 00:00:00.000000000 Z
11
+ date: 2024-02-28 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: '1.16'
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: '1.16'
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: '10.0'
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: '10.0'
40
+ version: '13.0'
41
41
  description:
42
42
  email:
43
43
  - git@k7u7.com
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.3.3
86
+ rubygems_version: 3.4.10
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: See github checks in your terminal