openpull 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/openpull +2 -0
- data/lib/openpull.rb +2 -0
- data/lib/openpull/client.rb +2 -0
- data/lib/openpull/pull_request_decorator.rb +4 -2
- data/lib/openpull/pull_request_fetcher.rb +8 -5
- data/lib/openpull/runner.rb +8 -4
- data/lib/openpull/table.rb +5 -3
- data/lib/openpull/version.rb +3 -1
- metadata +18 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 82f1b6addaaf490e7b67098b24319e40edfc91c13a2da045793764195eab8ada
|
4
|
+
data.tar.gz: 7bb5b8770a4471f37ce8a8c5ef3006fcfa8229cdd2cf28dd30ff27264889e2f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa0e6916e1d363246249895ad0d0d448ed19935eec6c77971d326c968f670dbfeea355401d3113b51438e31434adbf439a1ffc1d10052fc73899a53ff0862558
|
7
|
+
data.tar.gz: 4e2e273c8bb3d7f72e98292f62313f0417d5d1ac6165eae419193807a7d31e0e938f21a718e01c591dad9399055e6d812b96b37ecfe163edb05d9889b9581144
|
data/bin/openpull
CHANGED
data/lib/openpull.rb
CHANGED
data/lib/openpull/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OpenPull
|
2
4
|
class PullRequestDecorator < ::SimpleDelegator
|
3
5
|
def as_row(username)
|
@@ -39,13 +41,13 @@ module OpenPull
|
|
39
41
|
|
40
42
|
def commits
|
41
43
|
num = rels[:commits].get.data.size
|
42
|
-
num
|
44
|
+
num.zero? ? '' : num
|
43
45
|
end
|
44
46
|
|
45
47
|
def comments
|
46
48
|
num = rels[:comments].get.data.size
|
47
49
|
num += rels[:review_comments].get.data.size
|
48
|
-
num
|
50
|
+
num.zero? ? '' : num
|
49
51
|
end
|
50
52
|
|
51
53
|
def mergeable
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OpenPull
|
2
4
|
class PullRequestFetcher
|
3
5
|
attr_reader :client, :organisation, :username
|
@@ -24,8 +26,8 @@ module OpenPull
|
|
24
26
|
pull_requests = client.pull_requests(repository.id, state: 'open')
|
25
27
|
return [] if pull_requests.empty?
|
26
28
|
|
27
|
-
results = pull_requests.map do |
|
28
|
-
Thread.new { row(
|
29
|
+
results = pull_requests.map do |pull_request|
|
30
|
+
Thread.new { row(pull_request) }
|
29
31
|
end.map(&:value)
|
30
32
|
|
31
33
|
[headers(repository, results.size)] + results
|
@@ -44,11 +46,12 @@ module OpenPull
|
|
44
46
|
head.map { |h| h.blue.bold }
|
45
47
|
end
|
46
48
|
|
47
|
-
def row(
|
49
|
+
def row(pull_request)
|
48
50
|
print '.'.yellow
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
+
OpenPull::PullRequestDecorator.new(
|
53
|
+
pull_request.rels[:self].get.data
|
54
|
+
).as_row(username)
|
52
55
|
end
|
53
56
|
end
|
54
57
|
end
|
data/lib/openpull/runner.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'optparse'
|
2
4
|
|
3
5
|
module OpenPull
|
@@ -84,24 +86,26 @@ module OpenPull
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
87
|
-
def check_options(
|
89
|
+
def check_options(option)
|
88
90
|
check_access_token
|
89
|
-
check_organisation(
|
91
|
+
check_organisation(option)
|
90
92
|
end
|
91
93
|
|
92
94
|
def check_access_token
|
93
95
|
@options[:access_token] = ENV['GITHUB_ACCESS_TOKEN']
|
94
96
|
return unless @options[:access_token].nil?
|
97
|
+
|
95
98
|
puts 'You need to set the GitHub access token in your environment. ' \
|
96
99
|
'(GITHUB_ACCESS_TOKEN)'
|
97
100
|
exit
|
98
101
|
end
|
99
102
|
|
100
|
-
def check_organisation(
|
103
|
+
def check_organisation(option)
|
101
104
|
return unless @options[:organisation].nil?
|
105
|
+
|
102
106
|
puts 'You need to either pass GitHub organisation or set it in your ' \
|
103
107
|
'environment. (GITHUB_ORGANISATION)'
|
104
|
-
puts "\n#{
|
108
|
+
puts "\n#{option}"
|
105
109
|
exit
|
106
110
|
end
|
107
111
|
end
|
data/lib/openpull/table.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OpenPull
|
2
4
|
class Table
|
3
|
-
HEADINGS = %w
|
5
|
+
HEADINGS = %w[
|
4
6
|
title user labels status commits comments mergeable url updated
|
5
|
-
|
7
|
+
].freeze
|
6
8
|
|
7
9
|
class << self
|
8
10
|
def rewind!
|
@@ -15,7 +17,7 @@ module OpenPull
|
|
15
17
|
Terminal::Table.new(headings: HEADINGS.map(&:bold)) do |tab|
|
16
18
|
sub_tables.each_with_index do |sub_table, j|
|
17
19
|
sub_table.each_with_index do |row, i|
|
18
|
-
tab.add_separator if i
|
20
|
+
tab.add_separator if i.zero? && !j.zero?
|
19
21
|
tab.add_row row
|
20
22
|
end
|
21
23
|
end
|
data/lib/openpull/version.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openpull
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mads Ohm Larsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: colorize
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.8.1
|
20
20
|
type: :runtime
|
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.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: faraday-http-cache
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.4.2
|
34
34
|
type: :runtime
|
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: 0.4.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: octokit
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.8.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: terminal-table
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.8.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.8.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.64'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.64'
|
83
83
|
description: Fetches open pull-requests, with status and mergability, in your organisation.
|
84
84
|
email: mads.ohm@gmail.com
|
85
85
|
executables:
|
@@ -95,7 +95,7 @@ files:
|
|
95
95
|
- lib/openpull/runner.rb
|
96
96
|
- lib/openpull/table.rb
|
97
97
|
- lib/openpull/version.rb
|
98
|
-
homepage:
|
98
|
+
homepage: https://ohm.sh/
|
99
99
|
licenses:
|
100
100
|
- MIT
|
101
101
|
metadata: {}
|
@@ -114,8 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
|
-
|
118
|
-
rubygems_version: 2.4.5
|
117
|
+
rubygems_version: 3.0.1
|
119
118
|
signing_key:
|
120
119
|
specification_version: 4
|
121
120
|
summary: Fetches Open Pull-Requests from Github
|