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 CHANGED
@@ -60,7 +60,7 @@ EOF
60
60
  end
61
61
 
62
62
  if command_name.nil?
63
- command_name = "list"
63
+ command_name = 'list'
64
64
  end
65
65
 
66
66
  if command_name == 'help'
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
- req = METHODS[method].new path, 'Accept' => CONTENT_TYPE
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
@@ -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
@@ -4,7 +4,7 @@ module GHI
4
4
  MAJOR = 0
5
5
  MINOR = 9
6
6
  PATCH = 0
7
- PRE = 20130422.1
7
+ PRE = 20130424
8
8
 
9
9
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join '.'
10
10
 
@@ -139,7 +139,10 @@ module GHI
139
139
  end
140
140
  end
141
141
  if labels = assigns[:labels]
142
- header << ", labeled #{assigns[:labels].gsub ',', ', '}"
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
- - 20130422
10
- - 1
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-22 00:00:00 -07:00
18
+ date: 2013-04-24 00:00:00 -07:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency