ruby-bugzilla 0.3.3 → 0.4.0

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.
@@ -0,0 +1,33 @@
1
+ # version.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
+
23
+ =begin rdoc
24
+
25
+ == Bugzilla
26
+
27
+ =end
28
+
29
+ module Bugzilla
30
+
31
+ VERSION = "0.4.0"
32
+
33
+ end # module Bugzilla
@@ -0,0 +1,81 @@
1
+ # xmlrpc.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 'xmlrpc/client'
23
+
24
+ module Bugzilla
25
+
26
+ =begin rdoc
27
+
28
+ === Bugzilla::XMLRPC
29
+
30
+ =end
31
+
32
+ class XMLRPC
33
+
34
+ =begin rdoc
35
+
36
+ ==== Bugzilla::XMLRPC#new(host, port = 443, path = '/xmlrpc.cgi', proxy_host = nil, proxy_port = nil)
37
+
38
+ =end
39
+
40
+ def initialize(host, port = 443, path = '/xmlrpc.cgi', proxy_host = nil, proxy_port = nil, timeout = 60)
41
+ path ||= '/xmlrpc.cgi'
42
+ use_ssl = port == 443 ? true : false
43
+ @xmlrpc = ::XMLRPC::Client.new(host, path, port, proxy_host, proxy_port, nil, nil, use_ssl, timeout)
44
+ end # def initialize
45
+
46
+ =begin rdoc
47
+
48
+ ==== Bugzilla::XMLRPC#call(cmd, params, user = nil, password = nil)
49
+
50
+ =end
51
+
52
+ def call(cmd, params = {}, user = nil, password = nil)
53
+ params = {} if params.nil?
54
+ params['Bugzilla_login'] = user unless user.nil? || password.nil?
55
+ params['Bugzilla_password'] = password unless user.nil? || password.nil?
56
+ @xmlrpc.call(cmd, params)
57
+ end # def call
58
+
59
+ =begin rdoc
60
+
61
+ ==== Bugzilla::XMLRPC#cookie
62
+
63
+ =end
64
+
65
+ def cookie
66
+ @xmlrpc.cookie
67
+ end # def cookie
68
+
69
+ =begin rdoc
70
+
71
+ ==== Bugzilla::XMLRPC#cookie=(val)
72
+
73
+ =end
74
+
75
+ def cookie=(val)
76
+ @xmlrpc.cookie = val
77
+ end # def cookie
78
+
79
+ end # class XMLRPC
80
+
81
+ end # module Bugzilla
@@ -44,7 +44,7 @@ module Bugzilla
44
44
  parser.separator ""
45
45
  parser.separator "RH Bugzilla specific options:"
46
46
  parser.on('--cc=EMAILS', 'filter out the result by Cc in bugs') {|v| opts[:query][:cc] ||= []; opts[:query][:cc].push(*v.split(','))}
47
- parser.on('--version=VERSION', 'filter out the result by the version in bugs') {|v| opts[:query][:version] ||= []; opts[:query][:version].push(*v.split(','))}
47
+ parser.on('--filterversion=VERSION', 'filter out the result by the version in bugs') {|v| opts[:query][:version] ||= []; opts[:query][:version].push(*v.split(','))}
48
48
  end # def parserhook
49
49
 
50
50
  def prehook(*args)
@@ -1,5 +1,5 @@
1
1
  # rhbugzilla.rb
2
- # Copyright (C) 2010 Red Hat, Inc.
2
+ # Copyright (C) 2010-2012 Red Hat, Inc.
3
3
  #
4
4
  # Authors:
5
5
  # Akira TAGOH <tagoh@redhat.com>
@@ -21,11 +21,11 @@
21
21
 
22
22
  require 'rubygems'
23
23
 
24
- begin
25
- gem 'ruby-bugzilla'
26
- rescue Gem::LoadError
27
- require File.join(File.dirname(__FILE__), "..", "lib", "bugzilla.rb")
28
- end
24
+ #begin
25
+ # gem 'ruby-bugzilla'
26
+ #rescue Gem::LoadError
27
+ # require File.join(File.dirname(__FILE__), "..", "bugzilla.rb")
28
+ #end
29
29
 
30
30
  module Bugzilla
31
31
 
@@ -34,21 +34,184 @@ module Bugzilla
34
34
  class RedHat < ::Bugzilla::Plugin::Template
35
35
 
36
36
  def initialize
37
- super
37
+ super
38
38
 
39
- @hostname = "bugzilla.redhat.com"
39
+ @hostname = "bugzilla.redhat.com"
40
40
  end # def initialize
41
41
 
42
- def prehook(cmd, opts)
42
+ def parserhook(*args)
43
+ parser, argv, opts, *etc = args
44
+ parser.separator ""
45
+ parser.separator "RH Bugzilla specific options:"
46
+ parser.on('--cc=EMAILS', 'filter out the result by Cc in bugs') {|v| opts[:query][:cc] ||= []; opts[:query][:cc].push(*v.split(','))}
47
+ parser.on('--version=VERSION', 'filter out the result by the version in bugs') {|v| opts[:query][:version] ||= []; opts[:query][:version].push(*v.split(','))}
48
+ end # def parserhook
49
+
50
+ def prehook(*args)
51
+ cmd, opts, *etc = args
43
52
  case cmd
44
53
  when :search
54
+ extra_field = 0
55
+
56
+ if opts.include?(:status) then
57
+ opts[:bug_status] = opts[:status]
58
+ opts.delete(:status)
59
+ end
60
+ if opts.include?(:id) then
61
+ opts[:bug_id] = opts[:id]
62
+ opts.delete(:id)
63
+ end
64
+ if opts.include?(:severity)
65
+ opts[:bug_severity] = opts[:severity]
66
+ end
67
+ if opts.include?(:summary) then
68
+ opts[:short_desc] = opts[:summary]
69
+ opts.delete(:summary)
70
+ end
71
+ if opts.include?(:cc) then
72
+ i = 1
73
+ opts[:cc].each do |e|
74
+ opts[eval(":emailcc#{i}")] = 1
75
+ opts[eval(":emailtype#{i}")] = :substring
76
+ opts[eval(":email#{i}")] = e
77
+ end
78
+ opts.delete(:cc)
79
+ end
80
+ if opts.include?(:creation_time) then
81
+ opts[sprintf("field0-%d-0", extra_field)] = :creation_ts
82
+ opts[sprintf("type0-%d-0", extra_field)] = :greaterthan
83
+ opts[sprintf("value0-%d-0", extra_field)] = opts[:creation_time]
84
+ opts.delete(:creation_time)
85
+ end
86
+ when :metrics
87
+ metricsopts = etc[0]
88
+ extra_field = 0
89
+
90
+ if opts.include?(:status) then
91
+ opts[:bug_status] = opts[:status]
92
+ opts.delete(:status)
93
+ end
94
+ if opts.include?(:id) then
95
+ opts[:bug_id] = opts[:id]
96
+ opts.delete(:id)
97
+ end
98
+ if opts.include?(:severity)
99
+ opts[:bug_severity] = opts[:severity]
100
+ end
101
+ if opts.include?(:summary) then
102
+ opts[:short_desc] = opts[:summary]
103
+ opts.delete(:summary)
104
+ end
105
+ if opts.include?(:cc) then
106
+ i = 1
107
+ opts[:cc].each do |e|
108
+ opts[eval(":emailcc#{i}")] = 1
109
+ opts[eval(":emailtype#{i}")] = :substring
110
+ opts[eval(":email#{i}")] = e
111
+ end
112
+ opts.delete(:cc)
113
+ end
114
+
115
+ if opts.include?(:creation_time) then
116
+ if opts[:creation_time].kind_of?(Array) then
117
+ opts[sprintf("field0-%d-0", extra_field)] = :creation_ts
118
+ opts[sprintf("type0-%d-0", extra_field)] = :greaterthan
119
+ opts[sprintf("value0-%d-0", extra_field)] = opts[:creation_time][0]
120
+ extra_field += 1
121
+ opts[sprintf("field0-%d-0", extra_field)] = :creation_ts
122
+ opts[sprintf("type0-%d-0", extra_field)] = :lessthan
123
+ opts[sprintf("value0-%d-0", extra_field)] = opts[:creation_time][1]
124
+ extra_field += 1
125
+ else
126
+ opts[sprintf("field0-%d-0", extra_field)] = :creation_ts
127
+ opts[sprintf("type0-%d-0", extra_field)] = :greaterthan
128
+ opts[sprintf("value0-%d-0", extra_field)] = opts[:creation_time]
129
+ extra_field += 1
130
+ end
131
+ opts.delete(:creation_time)
132
+ end
133
+ if opts.include?(:last_change_time) then
134
+ if opts[:last_change_time].kind_of?(Array) then
135
+ opts[:chfieldfrom] = opts[:last_change_time][0]
136
+ opts[:chfieldto] = opts[:last_change_time][1]
137
+ if opts[:bug_status] == 'CLOSED' then
138
+ opts[sprintf("field0-%d-0", extra_field)] = :bug_status
139
+ opts[sprintf("type0-%d-0", extra_field)] = :changedto
140
+ opts[sprintf("value0-%d-0", extra_field)] = opts[:bug_status]
141
+ extra_field += 1
142
+ end
143
+ end
144
+ opts.delete(:last_change_time)
145
+ end
146
+ if opts.include?(:metrics_closed_after) then
147
+ opts[sprintf("field0-%d-0", extra_field)] = :bug_status
148
+ opts[sprintf("type0-%d-0", extra_field)] = :changedafter
149
+ opts[sprintf("value0-%d-0", extra_field)] = opts[:metrics_closed_after]
150
+ extra_field += 1
151
+ opts.delete(:metrics_closed_after)
152
+ end
153
+ if opts.include?(:metrics_not_closed) then
154
+ opts[sprintf("field0-%d-0", extra_field)] = :bug_status
155
+ opts[sprintf("type0-%d-0", extra_field)] = :notequals
156
+ opts[sprintf("value0-%d-0", extra_field)] = 'CLOSED'
157
+ extra_field += 1
158
+ opts[sprintf("field0-%d-0", extra_field)] = :creation_ts
159
+ opts[sprintf("type0-%d-0", extra_field)] = :lessthan
160
+ opts[sprintf("value0-%d-0", extra_field)] = opts[:metrics_not_closed]
161
+ extra_field += 1
162
+ opts.delete(:metrics_not_closed)
163
+ end
45
164
  else
46
165
  end
47
166
  end # def prehook
48
167
 
49
- def posthook(cmd, opts)
168
+ def posthook(*args)
169
+ cmd, opts, *etc = args
50
170
  case cmd
51
171
  when :search
172
+ if opts.include?('bugs') then
173
+ opts['bugs'].each do |bug|
174
+ if bug.include?('bug_status') then
175
+ bug['status'] = bug['bug_status']
176
+ bug.delete('bug_status')
177
+ end
178
+ if bug.include?('bug_id') then
179
+ bug['id'] = bug['bug_id']
180
+ bug.delete('bug_id')
181
+ end
182
+ if bug.include?('bug_severity') then
183
+ bug['severity'] = bug['bug_severity']
184
+ bug.delete('bug_severity')
185
+ end
186
+ if bug.include?('short_desc') then
187
+ bug['summary'] = bug['short_desc']
188
+ bug.delete('short_desc')
189
+ end
190
+ end
191
+ end
192
+ when :metrics
193
+ metricsopts = etc[0]
194
+
195
+ if opts.include?('bugs') then
196
+ opts['bugs'].each do |bug|
197
+ if bug.include?('bug_status') then
198
+ bug['status'] = bug['bug_status']
199
+ bug.delete('bug_status')
200
+ end
201
+ if bug.include?('bug_id') then
202
+ bug['id'] = bug['bug_id']
203
+ bug.delete('bug_id')
204
+ end
205
+ if bug.include?('bug_severity') then
206
+ bug['severity'] = bug['bug_severity']
207
+ bug.delete('bug_severity')
208
+ end
209
+ if bug.include?('short_desc') then
210
+ bug['summary'] = bug['short_desc']
211
+ bug.delete('short_desc')
212
+ end
213
+ end
214
+ end
52
215
  else
53
216
  end
54
217
  end # def posthook
metadata CHANGED
@@ -1,107 +1,121 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruby-bugzilla
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 3
10
- version: 0.3.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Akira TAGOH
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-02-22 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-08-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 2
31
- - 0
32
- version: "2.0"
20
+ - !ruby/object:Gem::Version
21
+ version: '2.0'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: gruff
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: gruff
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
47
38
  type: :runtime
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: highline
51
39
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: highline
48
+ requirement: !ruby/object:Gem::Requirement
53
49
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
61
54
  type: :runtime
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: rmagick
65
55
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rmagick
64
+ requirement: !ruby/object:Gem::Requirement
67
65
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
75
70
  type: :runtime
76
- version_requirements: *id004
77
- - !ruby/object:Gem::Dependency
78
- name: bundler
79
71
  prerelease: false
80
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
81
73
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 15
86
- segments:
87
- - 1
88
- - 0
89
- version: "1.0"
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: bundler
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '1.0'
90
86
  type: :development
91
- version_requirements: *id005
92
- description: This aims to provide similar features to access to Bugzilla through WebService APIs in Ruby.
93
- email:
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '1.0'
94
+ description: This aims to provide similar features to access to Bugzilla through WebService
95
+ APIs in Ruby.
96
+ email:
94
97
  - akira@tagoh.org
95
- executables:
98
+ executables:
96
99
  - bzconsole
97
100
  - bzconsole~
98
101
  extensions: []
99
-
100
102
  extra_rdoc_files: []
101
-
102
- files:
103
- - lib/bugzilla.rb~
104
- - lib/bugzilla.rb
103
+ files:
104
+ - lib/bugzilla/version.rb
105
+ - lib/bugzilla/bugzilla.rb~
106
+ - lib/bugzilla/product.rb
107
+ - lib/bugzilla/skeleton.rb
108
+ - lib/bugzilla/user.rb
109
+ - lib/bugzilla/xmlrpc.rb
110
+ - lib/bugzilla/skelton.rb~
111
+ - lib/bugzilla/api_tmpl.rb~
112
+ - lib/bugzilla/bug.rb~
113
+ - lib/bugzilla/plugin.rb
114
+ - lib/bugzilla/bugzilla.rb
115
+ - lib/bugzilla/user.rb~
116
+ - lib/bugzilla/bug.rb
117
+ - lib/bugzilla/plugin.rb~
118
+ - lib/bugzilla/api_tmpl.rb
105
119
  - lib/ruby-bugzilla/rhbugzilla.rb~
106
120
  - lib/ruby-bugzilla/rhbugzilla.rb
107
121
  - README.rdoc
@@ -110,38 +124,26 @@ files:
110
124
  - bin/bzconsole~
111
125
  homepage: http://github.com/tagoh/ruby-bugzilla
112
126
  licenses: []
113
-
114
127
  post_install_message:
115
128
  rdoc_options: []
116
-
117
- require_paths:
129
+ require_paths:
118
130
  - lib
119
- required_ruby_version: !ruby/object:Gem::Requirement
131
+ required_ruby_version: !ruby/object:Gem::Requirement
120
132
  none: false
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- hash: 3
125
- segments:
126
- - 0
127
- version: "0"
128
- required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
138
  none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 23
134
- segments:
135
- - 1
136
- - 3
137
- - 6
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
138
142
  version: 1.3.6
139
143
  requirements: []
140
-
141
144
  rubyforge_project:
142
- rubygems_version: 1.8.11
145
+ rubygems_version: 1.8.24
143
146
  signing_key:
144
147
  specification_version: 3
145
148
  summary: Ruby binding for Bugzilla WebService APIs
146
149
  test_files: []
147
-