ruby-bugzilla-nomagick 0.6.4.2

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