ghi 0.9.0.20130422.1 → 0.9.0.20130424
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ghi.rb +1 -1
- data/lib/ghi/client.rb +7 -1
- data/lib/ghi/commands/list.rb +15 -0
- data/lib/ghi/commands/version.rb +1 -1
- data/lib/ghi/formatting.rb +4 -1
- metadata +3 -4
data/lib/ghi.rb
CHANGED
data/lib/ghi/client.rb
CHANGED
@@ -46,6 +46,11 @@ module GHI
|
|
46
46
|
end
|
47
47
|
|
48
48
|
CONTENT_TYPE = 'application/vnd.github+json'
|
49
|
+
USER_AGENT = 'ghi/%s (%s; +%s)' % [
|
50
|
+
GHI::Commands::Version::VERSION,
|
51
|
+
RUBY_DESCRIPTION,
|
52
|
+
'https://github.com/stephencelis/ghi'
|
53
|
+
]
|
49
54
|
METHODS = {
|
50
55
|
:head => Net::HTTP::Head,
|
51
56
|
:get => Net::HTTP::Get,
|
@@ -94,7 +99,8 @@ module GHI
|
|
94
99
|
path += "?#{q.join '&'}"
|
95
100
|
end
|
96
101
|
|
97
|
-
|
102
|
+
headers = { 'Accept' => CONTENT_TYPE, 'User-Agent' => USER_AGENT }
|
103
|
+
req = METHODS[method].new path, headers
|
98
104
|
if GHI::Authorization.token
|
99
105
|
req['Authorization'] = "token #{GHI::Authorization.token}"
|
100
106
|
end
|
data/lib/ghi/commands/list.rb
CHANGED
@@ -26,6 +26,11 @@ module GHI
|
|
26
26
|
) do |labels|
|
27
27
|
(assigns[:labels] ||= []).concat labels
|
28
28
|
end
|
29
|
+
opts.on(
|
30
|
+
'-N', '--not-label <labelname>...', Array, 'exclude with label(s)'
|
31
|
+
) do |labels|
|
32
|
+
(assigns[:exclude_labels] ||= []).concat labels
|
33
|
+
end
|
29
34
|
opts.on(
|
30
35
|
'-S', '--sort <by>', %w(created updated comments),
|
31
36
|
{'c'=>'created','u'=>'updated','m'=>'comments'},
|
@@ -97,6 +102,9 @@ module GHI
|
|
97
102
|
retry
|
98
103
|
end
|
99
104
|
assigns[:labels] = assigns[:labels].join ',' if assigns[:labels]
|
105
|
+
if assigns[:exclude_labels]
|
106
|
+
assigns[:exclude_labels] = assigns[:exclude_labels].join ','
|
107
|
+
end
|
100
108
|
if reverse
|
101
109
|
assigns[:sort] ||= 'created'
|
102
110
|
assigns[:direction] = 'asc'
|
@@ -118,6 +126,13 @@ module GHI
|
|
118
126
|
if exclude_pull_requests
|
119
127
|
issues = issues.reject {|i| i["pull_request"].any? {|k,v| !v.nil? } }
|
120
128
|
end
|
129
|
+
if assigns[:exclude_labels]
|
130
|
+
issues = issues.reject do |i|
|
131
|
+
i["labels"].any? do |label|
|
132
|
+
assigns[:exclude_labels].include? label["name"]
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
121
136
|
if verbose
|
122
137
|
puts issues.map { |i| format_issue i }
|
123
138
|
else
|
data/lib/ghi/commands/version.rb
CHANGED
data/lib/ghi/formatting.rb
CHANGED
@@ -139,7 +139,10 @@ module GHI
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
if labels = assigns[:labels]
|
142
|
-
header << ", labeled #{
|
142
|
+
header << ", labeled #{labels.gsub ',', ', '}"
|
143
|
+
end
|
144
|
+
if excluded_labels = assigns[:exclude_labels]
|
145
|
+
header << ", excluding those labeled #{excluded_labels.gsub ',', ', '}"
|
143
146
|
end
|
144
147
|
if sort = assigns[:sort]
|
145
148
|
header << ", by #{sort} #{reverse ? 'ascending' : 'descending'}"
|
metadata
CHANGED
@@ -6,9 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 0
|
7
7
|
- 9
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 0.9.0.20130422.1
|
9
|
+
- 20130424
|
10
|
+
version: 0.9.0.20130424
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Stephen Celis
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2013-04-
|
18
|
+
date: 2013-04-24 00:00:00 -07:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|