ruby-bugzilla 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/bzconsole CHANGED
@@ -274,10 +274,14 @@ module BzConsole
274
274
  printf("Bug#%s - %s\n", result['id'], result['summary'])
275
275
  printf("Status:\t\t%s%s\n", result['status'], !result['resolution'].empty? ? sprintf("[%s]", result['resolution']) : "")
276
276
  printf("Product:\t%s\n", result['product'])
277
+ printf("Version:\t%s\n", result['version'])
277
278
  printf("Component:\t%s\n", result['component'])
278
279
  printf("Assinged To:\t%s\n", result['assigned_to'])
279
280
  printf("Priority:\t%s\n", result['priority'])
280
281
  printf("Severity:\t%s\n", result['severity'])
282
+ result.keys.reject {|x| ['id','summary','status','resolution','product','version','component','assigned_to','priority','severity', 'comments'].include?(x)}.each do |x|
283
+ printf("%s:\t%s\n", x.capitalize, result[x].respond_to?(:to_time) ? result[x].to_time : result[x])
284
+ end
281
285
  printf("Comments:\t%d\n\n", result['comments'].length)
282
286
  i = 0
283
287
  result['comments'].each do |c|
@@ -44,6 +44,8 @@ See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Classificat
44
44
 
45
45
  =end
46
46
 
47
+ protected
48
+
47
49
  def _get(cmd, args[0])
48
50
  requires_version(cmd, 4.4)
49
51
 
@@ -33,6 +33,8 @@ create Groups and get information about them.
33
33
 
34
34
  class Group < APITemplate
35
35
 
36
+ protected
37
+
36
38
  def __create(cmd, *args)
37
39
  # FIXME
38
40
  end # def _create
@@ -26,6 +26,6 @@
26
26
 
27
27
  module Bugzilla
28
28
 
29
- VERSION = "0.5.1"
29
+ VERSION = "0.5.2"
30
30
 
31
31
  end # module Bugzilla
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-bugzilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-19 00:00:00.000000000 Z
12
+ date: 2012-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -100,37 +100,23 @@ executables:
100
100
  extensions: []
101
101
  extra_rdoc_files: []
102
102
  files:
103
- - lib/bugzilla.rb~
104
103
  - lib/bugzilla/version.rb
105
- - lib/bugzilla/bugzilla.rb~
106
104
  - lib/bugzilla/product.rb
107
105
  - lib/bugzilla/skeleton.rb
108
106
  - lib/bugzilla/user.rb
109
107
  - lib/bugzilla/xmlrpc.rb
110
- - lib/bugzilla/skelton.rb~
111
- - lib/bugzilla/api_tmpl.rb~
112
- - lib/bugzilla/xmlrpc.rb~
113
- - lib/bugzilla/classification.rb~
114
- - lib/bugzilla/skeleton.rb~
115
- - lib/bugzilla/bug.rb~
116
108
  - lib/bugzilla/group.rb
117
109
  - lib/bugzilla/plugin.rb
118
- - lib/bugzilla/version.rb~
119
- - lib/bugzilla/product.rb~
120
110
  - lib/bugzilla/bugzilla.rb
121
- - lib/bugzilla/group.rb~
122
- - lib/bugzilla/user.rb~
123
111
  - lib/bugzilla/classification.rb
124
112
  - lib/bugzilla/bug.rb
125
- - lib/bugzilla/plugin.rb~
126
113
  - lib/bugzilla/api_tmpl.rb
127
114
  - lib/bugzilla.rb
128
- - lib/ruby-bugzilla/rhbugzilla.rb~
129
115
  - lib/ruby-bugzilla/rhbugzilla.rb
130
116
  - README.rdoc
131
117
  - COPYING
132
118
  - bin/bzconsole
133
- homepage: http://github.com/tagoh/ruby-bugzilla
119
+ homepage: http://rubygems.org/ruby-bugzilla
134
120
  licenses: []
135
121
  post_install_message:
136
122
  rdoc_options: []
data/lib/bugzilla.rb~ DELETED
@@ -1,24 +0,0 @@
1
- # bugzilla.rb
2
- # Copyright (C) 2010-2012 Akira TAGOH
3
- #
4
- # Authors:
5
- # Akira TAGOH <tagoh@redhat.com>
6
- #
7
- # This library is free software: you can redistribute it and/or
8
- # modify it under the terms of the GNU Lesser General Public
9
- # License as published by the Free Software Foundation, either
10
- # version 3 of the License, or (at your option) any later version.
11
- #
12
- # This library is distributed in the hope that it will be useful,
13
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- # GNU General Public License for more details.
16
- #
17
- # You should have received a copy of the GNU General Public License
18
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
-
20
- require 'bugzilla/bug'
21
- require 'bugzilla/plugin'
22
- require 'bugzilla/product'
23
- require 'bugzilla/user'
24
- require 'bugzilla/xmlrpc'
@@ -1,52 +0,0 @@
1
- # api_tmpl.rb
2
- # Copyright (C) 2010-2012 Red Hat, Inc.
3
- #
4
- # Authors:
5
- # Akira TAGOH <tagoh@redhat.com>
6
- #
7
- # This program is free software; you can redistribute it and/or modify
8
- # it under the terms of the GNU General Public License as published by
9
- # the Free Software Foundation; either version 2 of the License, or
10
- # (at your option) any later version.
11
- #
12
- # This program is distributed in the hope that it will be useful,
13
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- # GNU General Public License for more details.
16
- #
17
- # You should have received a copy of the GNU General Public License
18
- # along with this program; if not, write to the Free Software
19
- # Foundation, Inc., 59 Temple Place - Suite 330,
20
- # Boston, MA 02111-1307, USA.
21
-
22
- require 'bugzilla/skeleton'
23
- require 'bugzilla/bugzilla'
24
-
25
-
26
- module Bugzilla
27
-
28
- =begin rdoc
29
-
30
- === Bugzilla::APITemplate
31
-
32
- =end
33
-
34
- class APITemplate < Skeleton
35
-
36
- def initialize(iface)
37
- super
38
-
39
- @bz = Bugzilla.new(iface)
40
- end # def initialize
41
-
42
- def method_missing(symbol, *args)
43
- if @bz.respond_to?(symbol) then
44
- @bz.__send__(symbol, *args)
45
- else
46
- super
47
- end
48
- end # def method_missing
49
-
50
- end # class APITemplate
51
-
52
- end # module Bugzilla
data/lib/bugzilla/bug.rb~ DELETED
@@ -1,346 +0,0 @@
1
- # bug.rb
2
- # Copyright (C) 2010-2012 Red Hat, Inc.
3
- #
4
- # Authors:
5
- # Akira TAGOH <tagoh@redhat.com>
6
- #
7
- # This program is free software; you can redistribute it and/or modify
8
- # it under the terms of the GNU General Public License as published by
9
- # the Free Software Foundation; either version 2 of the License, or
10
- # (at your option) any later version.
11
- #
12
- # This program is distributed in the hope that it will be useful,
13
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- # GNU General Public License for more details.
16
- #
17
- # You should have received a copy of the GNU General Public License
18
- # along with this program; if not, write to the Free Software
19
- # Foundation, Inc., 59 Temple Place - Suite 330,
20
- # Boston, MA 02111-1307, USA.
21
-
22
- require 'bugzilla/api_tmpl'
23
-
24
- module Bugzilla
25
-
26
- =begin rdoc
27
-
28
- === Bugzilla::Bug
29
-
30
- Bugzilla::Bug class is to access
31
- the Bugzilla::WebService::Bug API that allows you to file
32
- a new bug in Bugzilla or get information about bugs that
33
- have already been filed.
34
-
35
- =end
36
-
37
- class Bug < APITemplate
38
-
39
- FIELDS_SUMMARY = ["id", "product", "component", "status", "severity", "summary"]
40
- FIELDS_DETAILS = FIELDS_SUMMARY + ["assigned_to", "internals", "priority", "resolution"]
41
- FIELDS_ALL = ["alias", "assigned_to", "blocks", "cc", "classification",
42
- "component", "creation_time", "creator", "deadline",
43
- "depends_on", "dupe_of", "estimated_time", "groups",
44
- "id", "is_cc_accessible", "is_confirmed", "is_open",
45
- "is_creator_accessible", "keywords", "last_change_time",
46
- "op_sys", "platform", "priority", "product", "qa_contact",
47
- "remaining_time", "resolution", "see_also", "severity",
48
- "status", "summary", "target_milestone", "update_token",
49
- "url", "version", "whiteboard",
50
- "external_bugs", "internals"]
51
-
52
- =begin rdoc
53
-
54
- ==== Bugzilla::Bug#get_bugs(bugs, fields = Bugzilla::Bug::FIELDS_SUMMARY)
55
-
56
- Get the _bugs_ information from Bugzilla. either of String
57
- or Numeric or Array would be acceptable for _bugs_. you can
58
- specify the fields you want to look up with _fields_.
59
-
60
- FWIW this name conflicts to Bugzilla API but this isn's a
61
- primitive method since get_bugs method in WebService API is
62
- actually deprecated.
63
-
64
- =end
65
-
66
- def get_bugs(bugs, fields = ::Bugzilla::Bug::FIELDS_SUMMARY)
67
- params = {}
68
-
69
- if bugs.kind_of?(Array) then
70
- params['ids'] = bugs
71
- elsif bugs.kind_of?(Integer) ||
72
- bugs.kind_of?(String) then
73
- params['ids'] = [bugs]
74
- else
75
- raise ArgumentError, sprintf("Unknown type of arguments: %s", bugs.class)
76
- end
77
- unless fields.nil? then
78
- unless (fields - ::Bugzilla::Bug::FIELDS_ALL).empty? then
79
- raise ArgumentError, sprintf("Invalid fields: %s", (::Bugzilla::Bug::FIELDS_ALL - fields).join(' '))
80
- end
81
- params['include_fields'] = fields
82
- end
83
-
84
- result = get(params)
85
-
86
- if fields.nil? || fields == ::Bugzilla::Bug::FIELDS_ALL then
87
- get_comments(bugs).each do |id, c|
88
- result['bugs'].each do |r|
89
- if r['id'].to_s == id then
90
- r['comments'] = c['comments']
91
- r['comments'] = [] if r['comments'].nil?
92
- break
93
- end
94
- end
95
- end
96
- end
97
-
98
- # 'bugs' is only in interests.
99
- # XXX: need to deal with 'faults' ?
100
- result['bugs']
101
- end # def get_bugs
102
-
103
- =begin rdoc
104
-
105
- ==== Bugzilla::Bug#get_comments(bugs)
106
-
107
- =end
108
-
109
- def get_comments(bugs)
110
- params = {}
111
-
112
- if bugs.kind_of?(Array) then
113
- params['ids'] = bugs
114
- elsif bugs.kind_of?(Integer) ||
115
- bugs.kind_of?(String) then
116
- params['ids'] = [bugs]
117
- else
118
- raise ArgumentError, sprintf("Unknown type of arguments: %s", bugs.class)
119
- end
120
-
121
- result = comments(params)
122
-
123
- # not supporting comment_ids. so drop "comments".
124
- result['bugs']
125
- end # def get_comments
126
-
127
- =begin rdoc
128
-
129
- ==== Bugzilla::Bug#fields(params)
130
-
131
- Raw Bugzilla API to obtain the information about valid bug
132
- fields, including the lists of legal values for each field.
133
-
134
- See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
135
-
136
- =end
137
-
138
- =begin rdoc
139
-
140
- ==== Bugzilla::Bug#legal_values(params)
141
-
142
- Raw Bugzilla API to obtain the information what values are
143
- allowed for a particular field.
144
-
145
- See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
146
-
147
- =end
148
-
149
- =begin rdoc
150
-
151
- ==== Bugzilla::Bug#attachments(params)
152
-
153
- Raw Bugzilla API to obtain the information about
154
- attachments, given a list of bugs and/or attachment ids.
155
-
156
- See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
157
-
158
- =end
159
-
160
- =begin rdoc
161
-
162
- ==== Bugzilla::Bug#comments(params)
163
-
164
- Raw Bugzilla API to obtain the information about comments,
165
- given a list of bugs and/or comment ids.
166
-
167
- See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
168
-
169
- =end
170
-
171
- =begin rdoc
172
-
173
- ==== Bugzilla::Bug#get(params)
174
-
175
- Raw Bugzilla API to obtain the information about particular
176
- bugs in the database.
177
-
178
- =end
179
-
180
- =begin rdoc
181
-
182
- ==== Bugzilla::Bug#history(params)
183
-
184
- Raw Bugzilla API to obtain the history of changes for
185
- particular bugs in the database.
186
-
187
- =end
188
-
189
- =begin rdoc
190
-
191
- ==== Bugzilla::Bug#search(params)
192
-
193
- Raw Bugzilla API to search for bugs based on particular
194
- criteria.
195
-
196
- =end
197
-
198
- protected
199
-
200
- def _fields(cmd, *args)
201
- requires_version(cmd, 3.6)
202
- params = {}
203
-
204
- if args[0].kind_of?(Array) then
205
- x = args[0].map {|x| x.kind_of?(Integer)}.uniq
206
- if x.length == 1 && x[0] then
207
- params['ids'] = args[0]
208
- else
209
- x = args[0].map {|x| x.kind_of?(String)}.uniq
210
- if x.length == 1 && x[0] then
211
- params['names'] = args[0]
212
- end
213
- end
214
- elsif args[0].kind_of?(Hash) then
215
- params = args[0]
216
- elsif args[0].kind_of?(Integer) then
217
- params['ids'] = [args[0]]
218
- elsif args[0].kind_of?(String) then
219
- params['names'] = [args[0]]
220
- elsif args[0].nil? then
221
- else
222
- raise ArgumentError, "Invalid parameters"
223
- end
224
-
225
- @iface.call(cmd, params)
226
- end # def _fields
227
-
228
- def _legal_values(cmd, *args)
229
- raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
230
-
231
- @iface.call(cmd, args[0])
232
- end # def _legal_values
233
-
234
- def _attachments(cmd, *args)
235
- requires_version(cmd, 3.6)
236
-
237
- raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
238
-
239
- @iface.call(cmd, args[0])
240
- end # def _attachments
241
-
242
- def _comments(cmd, *args)
243
- requires_version(cmd, 3.4)
244
-
245
- raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
246
-
247
- @iface.call(cmd, args[0])
248
- end # def _comments
249
-
250
- def _get(cmd, *args)
251
- params = {}
252
-
253
- if args[0].kind_of?(Hash) then
254
- params = args[0]
255
- elsif args[0].kind_of?(Array) then
256
- params['ids'] = args[0]
257
- elsif args[0].kind_of?(Integer) ||
258
- args[0].kind_of?(String) then
259
- params['ids'] = [args[0]]
260
- else
261
- raise ArgumentError, "Invalid parameters"
262
- end
263
- if check_version(3.4)[0] then
264
- params['permissive'] = true
265
- end
266
-
267
- @iface.call(cmd, params)
268
- end # def _get
269
-
270
- def _history(cmd, *args)
271
- requires_version(cmd, 3.4)
272
-
273
- params = {}
274
-
275
- if args[0].kind_of?(Hash) then
276
- params = args[0]
277
- elsif args[0].kind_of?(Array) then
278
- params['ids'] = args[0]
279
- elsif args[0].kind_of?(Integer) ||
280
- args[0].kind_of?(String) then
281
- params['ids'] = [args[0]]
282
- else
283
- raise ArgumentError, "Invalid parameters"
284
- end
285
-
286
- @iface.call(cmd, params)
287
- end # def _history
288
-
289
- def _search(cmd, *args)
290
- requires_version(cmd, 3.4)
291
-
292
- raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
293
-
294
- @iface.call(cmd, args[0])
295
- end # def _search
296
-
297
- def _create(cmd, *args)
298
- raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)
299
-
300
- required_fields = [:product, :component, :summary, :version]
301
- defaulted_fields = [:description, :op_sys, :platform, :priority, :severity]
302
-
303
- res = check_version("3.0.4")
304
- unless res[0] then
305
- required_fields.push(*defaulted_fields)
306
- end
307
- required_fields.each do |f|
308
- raise ArgumentError, sprintf("Required fields isn't given: %s", f) unless args[0].include?(f)
309
- end
310
- res = check_version(4.0)
311
- unless res[0] then
312
- raise ArgumentError, "groups field isn't available in this bugzilla" if args[0].include?("groups")
313
- raise ArgumentError, "comment_is_private field isn't available in this bugzilla" if args[0].include?("comment_is_private")
314
- else
315
- if args[0].include?("commentprivacy") then
316
- args[0]["comment_is_private"] = args[0]["commentprivacy"]
317
- args[0].delete("commentprivacy")
318
- end
319
- end
320
-
321
- @iface.call(cmd, args[0])
322
- end # def _create
323
-
324
- def __add_attachment(cmd, *args)
325
- requires_version(cmd, 4.0)
326
- # FIXME
327
- end # def _add_attachment
328
-
329
- def __add_comment(cmd, *args)
330
- requires_version(cmd, 3.2)
331
- # FIXME
332
- end # def _add_comment
333
-
334
- def __update(cmd, *args)
335
- requires_version(cmd, 4.0)
336
- # FIXME
337
- end # def _update
338
-
339
- def __update_see_also(cmd, *args)
340
- requires_version(cmd, 3.4)
341
- # FIXME
342
- end # def _update_see_also
343
-
344
- end # class Bug
345
-
346
- end # module Bugzilla