github-nippou 2.0.0.beta4 → 2.0.0.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/github/nippou/commands.rb +55 -9
- data/lib/github/nippou/concerns/sawyer_resource_github.rb +0 -9
- data/lib/github/nippou/concerns/string_markdown.rb +5 -0
- data/lib/github/nippou/user_events.rb +1 -7
- data/lib/github/nippou/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: 5c0359c1b0c93e33e07c49a4642968c84af8eb4a
|
4
|
+
data.tar.gz: aeee0e7c9a0732b7a237785c83862033e357d003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da2634a1fb6c171d8f9e6ed5d557458576b44971322d4ebf1c6bf07ba8eb692d35733ab17fd4cb7bff7af49a854bf7e8024f191b1a2946c1e88d5967aedbd189
|
7
|
+
data.tar.gz: 0ec755b2b786478253bcca2b613faaf98bb9c43830eb081316ac9ab9059b031f0f5984a314522a3595949507007f8b8961136131796f20ca00f57f480a84ff3e
|
data/Gemfile.lock
CHANGED
@@ -16,17 +16,22 @@ module Github
|
|
16
16
|
|
17
17
|
desc 'list', "Displays today's GitHub events formatted for Nippou"
|
18
18
|
def list
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
lines = []
|
20
|
+
threads = []
|
21
|
+
mutex1 = Mutex::new
|
22
|
+
mutex2 = Mutex::new
|
23
|
+
|
24
|
+
thread_num.times do |i|
|
25
|
+
threads << Thread.start do
|
26
|
+
while user_event = mutex1.synchronize { user_events.pop } do
|
27
|
+
line = format_line(user_event, i)
|
28
|
+
mutex2.synchronize { lines << line }
|
29
|
+
end
|
27
30
|
end
|
28
|
-
puts line
|
29
31
|
end
|
32
|
+
threads.each(&:join)
|
33
|
+
|
34
|
+
puts sort(lines)
|
30
35
|
end
|
31
36
|
|
32
37
|
desc 'version', 'Displays version'
|
@@ -42,6 +47,35 @@ module Github
|
|
42
47
|
).collect
|
43
48
|
end
|
44
49
|
|
50
|
+
def format_line(user_event, i)
|
51
|
+
puts "#{i} : #{user_event.html_url}" if ENV['GITHUB_NIPPOU_DEBUG']
|
52
|
+
issue = issue(user_event)
|
53
|
+
line = "* [%s - %s](%s) by %s" %
|
54
|
+
[issue.title.markdown_escape, user_event.repo.name, user_event.html_url, issue.user.login]
|
55
|
+
|
56
|
+
if issue.merged
|
57
|
+
line << ' **merged!**'
|
58
|
+
elsif issue.state == 'closed'
|
59
|
+
line << ' **closed!**'
|
60
|
+
end
|
61
|
+
|
62
|
+
line
|
63
|
+
end
|
64
|
+
|
65
|
+
def issue(user_event)
|
66
|
+
if user_event.issue?
|
67
|
+
client.issue(user_event.repo.name, user_event.payload.issue.number)
|
68
|
+
else
|
69
|
+
client.pull_request(user_event.repo.name, user_event.payload.pull_request.number)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def sort(lines)
|
74
|
+
lines.sort do |a, b|
|
75
|
+
a.html_url_as_nippou <=> b.html_url_as_nippou
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
45
79
|
def client
|
46
80
|
@client ||= Octokit::Client.new(login: user, access_token: access_token)
|
47
81
|
end
|
@@ -84,6 +118,18 @@ MESSAGE
|
|
84
118
|
exit!
|
85
119
|
end
|
86
120
|
end
|
121
|
+
|
122
|
+
def thread_num
|
123
|
+
@thread_num ||=
|
124
|
+
case
|
125
|
+
when ENV['GITHUB_NIPPOU_THREAD_NUM']
|
126
|
+
ENV['GITHUB_NIPPOU_THREAD_NUM']
|
127
|
+
when !`git config github-nippou.thread-num`.chomp.empty?
|
128
|
+
`git config github-nippou.thread-num`.chomp
|
129
|
+
else
|
130
|
+
5
|
131
|
+
end.to_i
|
132
|
+
end
|
87
133
|
end
|
88
134
|
end
|
89
135
|
end
|
@@ -2,15 +2,6 @@ require 'octokit'
|
|
2
2
|
|
3
3
|
module SawyerResourceGithub
|
4
4
|
refine Sawyer::Resource do
|
5
|
-
def issue(client)
|
6
|
-
case
|
7
|
-
when self.issue?
|
8
|
-
client.issue(self.repo.name, self.payload.issue.number)
|
9
|
-
when self.pull_request?
|
10
|
-
client.pull_request(self.repo.name, self.payload.pull_request.number)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
5
|
def html_url
|
15
6
|
case
|
16
7
|
when self.issue?
|
@@ -15,7 +15,7 @@ module Github
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def collect
|
18
|
-
uniq(
|
18
|
+
uniq(filter(retrieve))
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
@@ -47,12 +47,6 @@ module Github
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def sort(user_events)
|
51
|
-
user_events.sort do |a, b|
|
52
|
-
a.html_url <=> b.html_url
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
50
|
def uniq(user_events)
|
57
51
|
user_events.uniq do |user_event|
|
58
52
|
user_event.html_url
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-nippou
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Masuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|