openpull 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/openpull +1 -50
- data/lib/openpull.rb +1 -0
- data/lib/openpull/pull_request_fetcher.rb +8 -4
- data/lib/openpull/runner.rb +76 -0
- data/lib/openpull/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d9f4bdf1fa1c21ed9f640511a7f34c0f781d56e
|
4
|
+
data.tar.gz: d5e88c87bdacef6d50b91c793a1ab75b6bf2aa36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d66eb8c9a83010b6b6c6a18d1cfe0eb91870c31f78f4e1363ca377c81d65e807a2a7224e8eb266f027415b4d2cd6fa56909a4035fa9ff71947882a153232b3fb
|
7
|
+
data.tar.gz: 96efa30ce9638de93d486910734c705ab83e617c923a775cc97011bae72671bbd9dae225c4a2f93fc4787cb44b9530cc3f4189b3816849f059669b31d0f86ed5
|
data/bin/openpull
CHANGED
@@ -2,53 +2,4 @@
|
|
2
2
|
require 'optparse'
|
3
3
|
require 'openpull'
|
4
4
|
|
5
|
-
|
6
|
-
op = OptionParser.new do |opts|
|
7
|
-
opts.banner = 'Usage: openpull [options]'
|
8
|
-
|
9
|
-
opts.separator ''
|
10
|
-
opts.separator 'Organisation and username can also be set in the ' \
|
11
|
-
'environment as GITHUB_ORGANISATION and GITHUB_USERNAME.'
|
12
|
-
opts.separator ''
|
13
|
-
|
14
|
-
opts.separator "Options:"
|
15
|
-
|
16
|
-
opts.on_tail('-h', '--help', 'Show this message') do
|
17
|
-
puts opts
|
18
|
-
exit
|
19
|
-
end
|
20
|
-
|
21
|
-
opts.on_tail("--version", "Show version") do
|
22
|
-
puts OpenPull::VERSION
|
23
|
-
exit
|
24
|
-
end
|
25
|
-
|
26
|
-
options[:organisation] = ENV['GITHUB_ORGANISATION']
|
27
|
-
opts.on('-o', '--organisation [ORG]', String, 'The Github organisation') do |o|
|
28
|
-
options[:organisation] = o
|
29
|
-
end
|
30
|
-
|
31
|
-
options[:username] = ENV['GITHUB_USERNAME']
|
32
|
-
opts.on('-u', '--username [USER]', String, 'Your Github username') do |u|
|
33
|
-
options[:username] = u
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
op.parse!
|
38
|
-
|
39
|
-
options[:access_token] = ENV['GITHUB_ACCESS_TOKEN']
|
40
|
-
|
41
|
-
if options[:access_token].nil?
|
42
|
-
puts 'You need to set the GitHub access token in your environment. ' \
|
43
|
-
'(GITHUB_ACCESS_TOKEN)'
|
44
|
-
exit
|
45
|
-
elsif options[:organisation].nil?
|
46
|
-
puts 'You need to either pass GitHub organisation or set it in your ' \
|
47
|
-
'environment. (GITHUB_ORGANISATION)'
|
48
|
-
puts "\n#{op}"
|
49
|
-
exit
|
50
|
-
end
|
51
|
-
|
52
|
-
puts OpenPull::Client.new(options[:access_token],
|
53
|
-
options[:organisation],
|
54
|
-
options[:username]).show_table
|
5
|
+
OpenPull::Runner.new(ARGV).run
|
data/lib/openpull.rb
CHANGED
@@ -22,14 +22,18 @@ module OpenPull
|
|
22
22
|
pull_requests = client.pull_requests(repository.id, state: 'open')
|
23
23
|
return [] if pull_requests.empty?
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
headers = ["#{repository.name} (#{pull_requests.size})"]
|
26
|
+
headers << (repository.private ? 'private' : 'public')
|
27
|
+
headers += [''] * 3
|
28
|
+
headers << repository.html_url
|
29
|
+
headers << ''
|
30
|
+
headers.map! { |h| h.blue.bold }
|
27
31
|
|
28
32
|
results = pull_requests.map do |pr|
|
29
33
|
Thread.new { row(pr) }
|
30
34
|
end.map(&:value)
|
31
35
|
|
32
|
-
[
|
36
|
+
[headers] + results
|
33
37
|
end
|
34
38
|
|
35
39
|
def row(pr)
|
@@ -43,7 +47,7 @@ module OpenPull
|
|
43
47
|
deco_pr.labels,
|
44
48
|
deco_pr.status,
|
45
49
|
deco_pr.mergeable,
|
46
|
-
deco_pr.html_url,
|
50
|
+
deco_pr.html_url.underline,
|
47
51
|
deco_pr.updated_at
|
48
52
|
]
|
49
53
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module OpenPull
|
4
|
+
class Runner
|
5
|
+
attr_reader :argv
|
6
|
+
attr_accessor :options
|
7
|
+
|
8
|
+
def initialize(argv)
|
9
|
+
@argv = argv
|
10
|
+
@options = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
op = option_parser
|
15
|
+
op.parse!
|
16
|
+
exit unless check_options(op)
|
17
|
+
|
18
|
+
puts OpenPull::Client.new(@options[:access_token],
|
19
|
+
@options[:organisation],
|
20
|
+
@options[:username]).show_table
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def option_parser
|
27
|
+
OptionParser.new do |opts|
|
28
|
+
opts.banner = 'Usage: openpull [options]'
|
29
|
+
|
30
|
+
opts.separator ''
|
31
|
+
opts.separator 'Organisation and username can also be set in the ' \
|
32
|
+
'environment as GITHUB_ORGANISATION and GITHUB_USERNAME.'
|
33
|
+
opts.separator ''
|
34
|
+
|
35
|
+
opts.separator 'Options:'
|
36
|
+
|
37
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
38
|
+
puts opts
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
opts.on_tail('--version', 'Show version') do
|
43
|
+
puts OpenPull::VERSION
|
44
|
+
exit
|
45
|
+
end
|
46
|
+
|
47
|
+
@options[:organisation] = ENV['GITHUB_ORGANISATION']
|
48
|
+
opts.on('-o', '--organisation [ORG]', String, 'The Github organisation') do |o|
|
49
|
+
@options[:organisation] = o
|
50
|
+
end
|
51
|
+
|
52
|
+
@options[:username] = ENV['GITHUB_USERNAME']
|
53
|
+
opts.on('-u', '--username [USER]', String, 'Your Github username') do |u|
|
54
|
+
@options[:username] = u
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def check_options(op)
|
60
|
+
@options[:access_token] = ENV['GITHUB_ACCESS_TOKEN']
|
61
|
+
|
62
|
+
if @options[:access_token].nil?
|
63
|
+
puts 'You need to set the GitHub access token in your environment. ' \
|
64
|
+
'(GITHUB_ACCESS_TOKEN)'
|
65
|
+
return false
|
66
|
+
elsif @options[:organisation].nil?
|
67
|
+
puts 'You need to either pass GitHub organisation or set it in your ' \
|
68
|
+
'environment. (GITHUB_ORGANISATION)'
|
69
|
+
puts "\n#{op}"
|
70
|
+
return false
|
71
|
+
end
|
72
|
+
|
73
|
+
return true
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/openpull/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4
|
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: 2015-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/openpull/client.rb
|
79
79
|
- lib/openpull/pull_request_decorator.rb
|
80
80
|
- lib/openpull/pull_request_fetcher.rb
|
81
|
+
- lib/openpull/runner.rb
|
81
82
|
- lib/openpull/table.rb
|
82
83
|
- lib/openpull/version.rb
|
83
84
|
homepage: http://ohm.sh/
|
@@ -100,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
101
|
version: '0'
|
101
102
|
requirements: []
|
102
103
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.4.5
|
104
105
|
signing_key:
|
105
106
|
specification_version: 4
|
106
107
|
summary: Fetches Open Pull-Requests from Github
|