ruby-bugzilla 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bzconsole +105 -11
- data/bin/bzconsole~ +100 -14
- data/lib/bugzilla/api_tmpl.rb +52 -0
- data/lib/bugzilla/api_tmpl.rb~ +51 -0
- data/lib/bugzilla/bug.rb +346 -0
- data/lib/bugzilla/bug.rb~ +323 -0
- data/lib/bugzilla/bugzilla.rb +141 -0
- data/lib/bugzilla/bugzilla.rb~ +140 -0
- data/lib/bugzilla/plugin.rb +82 -0
- data/lib/bugzilla/plugin.rb~ +82 -0
- data/lib/bugzilla/product.rb +156 -0
- data/lib/bugzilla/skeleton.rb +50 -0
- data/lib/bugzilla/skelton.rb~ +50 -0
- data/lib/bugzilla/user.rb +114 -0
- data/lib/bugzilla/user.rb~ +114 -0
- data/lib/bugzilla/version.rb +33 -0
- data/lib/bugzilla/xmlrpc.rb +81 -0
- data/lib/ruby-bugzilla/rhbugzilla.rb +1 -1
- data/lib/ruby-bugzilla/rhbugzilla.rb~ +173 -10
- metadata +101 -99
- data/lib/bugzilla.rb +0 -826
- data/lib/bugzilla.rb~ +0 -788
data/bin/bzconsole
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
2
3
|
# bzconsole.rb
|
3
4
|
# Copyright (C) 2010-2012 Red Hat, Inc.
|
4
5
|
#
|
@@ -30,14 +31,18 @@ require 'uri'
|
|
30
31
|
require 'highline/import'
|
31
32
|
|
32
33
|
begin
|
33
|
-
require 'bugzilla'
|
34
|
+
require 'bugzilla/xmlrpc'
|
35
|
+
require 'bugzilla/user'
|
36
|
+
require 'bugzilla/plugin'
|
37
|
+
require 'bugzilla/bug'
|
34
38
|
rescue LoadError
|
35
39
|
$:.push(File.join(File.dirname(__FILE__), '..', 'lib'))
|
36
|
-
require 'bugzilla'
|
40
|
+
require 'bugzilla/xmlrpc'
|
41
|
+
require 'bugzilla/user'
|
42
|
+
require 'bugzilla/plugin'
|
43
|
+
require 'bugzilla/bug'
|
37
44
|
end
|
38
45
|
|
39
|
-
$KCODE = 'u'
|
40
|
-
|
41
46
|
module BzConsole
|
42
47
|
|
43
48
|
class CommandTemplate
|
@@ -210,8 +215,9 @@ module BzConsole
|
|
210
215
|
login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
|
211
216
|
pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
|
212
217
|
proxy_host, proxy_port = get_proxy(info)
|
218
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
213
219
|
|
214
|
-
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port)
|
220
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
215
221
|
user = Bugzilla::User.new(xmlrpc)
|
216
222
|
begin
|
217
223
|
result = user.login({'login'=>login, 'password'=>pass, 'remember'=>true})
|
@@ -309,10 +315,11 @@ module BzConsole
|
|
309
315
|
login = opts[:command][:anonymous] == true ? nil : info[:User]
|
310
316
|
pass = opts[:command][:anonymous] == true ? nil : info[:Password]
|
311
317
|
proxy_host, proxy_port = get_proxy(info)
|
318
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
312
319
|
|
313
320
|
@plugin.run(:pre, host, :getbug, opts)
|
314
321
|
|
315
|
-
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port)
|
322
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
316
323
|
user = Bugzilla::User.new(xmlrpc)
|
317
324
|
user.session(login, pass) do
|
318
325
|
bug = Bugzilla::Bug.new(xmlrpc)
|
@@ -422,10 +429,11 @@ module BzConsole
|
|
422
429
|
login = opts[:command][:anonymous] == true ? nil : info[:User]
|
423
430
|
pass = opts[:command][:anonymous] == true ? nil : info[:Password]
|
424
431
|
proxy_host, proxy_port = get_proxy(info)
|
432
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
425
433
|
|
426
434
|
@plugin.run(:pre, host, :search, opts[:command][:query])
|
427
435
|
|
428
|
-
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port)
|
436
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
429
437
|
user = Bugzilla::User.new(xmlrpc)
|
430
438
|
user.session(login, pass) do
|
431
439
|
bug = Bugzilla::Bug.new(xmlrpc)
|
@@ -500,10 +508,11 @@ module BzConsole
|
|
500
508
|
login = opts[:command][:anonymous] == true ? nil : info[:User]
|
501
509
|
pass = opts[:command][:anonymous] == true ? nil : info[:Password]
|
502
510
|
proxy_host, proxy_port = get_proxy(info)
|
511
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
503
512
|
|
504
513
|
@plugin.run(:pre, host, :show, opts)
|
505
514
|
|
506
|
-
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port)
|
515
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
507
516
|
user = Bugzilla::User.new(xmlrpc)
|
508
517
|
user.session(login, pass) do
|
509
518
|
if opts[:command][:show][:mode] == :field then
|
@@ -665,8 +674,9 @@ module BzConsole
|
|
665
674
|
login = opts[:command][:anonymous] == true ? nil : info[:User]
|
666
675
|
pass = opts[:command][:anonymous] == true ? nil : info[:Password]
|
667
676
|
proxy_host, proxy_port = get_proxy(info)
|
677
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
668
678
|
|
669
|
-
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port)
|
679
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
670
680
|
user = Bugzilla::User.new(xmlrpc)
|
671
681
|
user.session(login, pass) do
|
672
682
|
bug = Bugzilla::Bug.new(xmlrpc)
|
@@ -782,6 +792,89 @@ module BzConsole
|
|
782
792
|
|
783
793
|
end # class Metrics
|
784
794
|
|
795
|
+
class Newbug < CommandTemplate
|
796
|
+
|
797
|
+
def initialize(plugin)
|
798
|
+
super
|
799
|
+
|
800
|
+
@n_args = 1
|
801
|
+
end # def initialize
|
802
|
+
|
803
|
+
def parse(parser, argv, opts)
|
804
|
+
opts[:newbug] = {}
|
805
|
+
|
806
|
+
parser.banner = sprintf("Usage: %s [global options] newbug [command options] <prefix>", File.basename(__FILE__))
|
807
|
+
parser.separator ""
|
808
|
+
parser.separator "Options:"
|
809
|
+
parser.on('-p', '--product=PRODUCT', 'The name of the product the bug is being filed against') {|v| opts[:newbug][:product] = v}
|
810
|
+
parser.on('-c', '--component=COMPONENT', 'The name of the component in PRODUCT') {|v| opts[:newbug][:component] = v}
|
811
|
+
parser.on('-s', '--summary=SUMMARY', 'A brief description of the bug being filed') {|v| opts[:newbug][:summary] = v}
|
812
|
+
parser.on('-v', '--version=VERSION', 'A version of PRODUCT that the bug was found in') {|v| opts[:newbug][:version] = v}
|
813
|
+
parser.on('-d', '--description=DESCRIPTION', 'The initial description for bug') {|v| opts[:newbug][:description] = v}
|
814
|
+
parser.on('--opsys=OPSYS', 'The operating system the bug was discovered on') {|v| opts[:newbug][:op_sys] = v}
|
815
|
+
parser.on('--platform=PLATFORM', 'What type of hardware the bug was experienced on') {|v| opts[:newbug][:platform] = v}
|
816
|
+
parser.on('--priority=PRIORITY', 'What order the bug will be fixed in by the developer') {|v| opts[:newbug][:priority] = v}
|
817
|
+
parser.on('--severity=SEVERITY', 'How severe the bug is') {|v| opts[:newbug][:severity] = v}
|
818
|
+
parser.on('--alias=ALIAS', 'A brief alias for the bug that can be used instead of a bug number') {|v| opts[:newbug][:alias] = v}
|
819
|
+
parser.on('--assigned_to=ASSGINEE', 'A user to assign the bug to') {|v| opts[:newbug][:assigned_to] = v}
|
820
|
+
parser.on('--comment_is_private', 'Make the description to private') {|v| opts[:newbug][:comment_is_private] = true}
|
821
|
+
parser.on('--groups=GROUPS', 'The list of group names to put this bug into') {|v| opts[:newbug][:groups] = v.split(/,/)}
|
822
|
+
parser.on('--qacontact=USER', 'The QA concact to assign the bug to') {|v| opts[:newbug][:qa_contact] = v}
|
823
|
+
parser.on('--status=STATUS', 'The status that the bug should start out as') {|v| opts[:newbug][:status] = v}
|
824
|
+
parser.on('--resolution=RESOLUTION', 'Set the resolution if filing a closed bug') {|v| opts[:newbug][:resolution] = v}
|
825
|
+
parser.on('--targetmilestone=MILESTONE', 'A valid target milestone for PRODUCT') {|v| opts[:newbug][:target_milestone] = v}
|
826
|
+
|
827
|
+
super
|
828
|
+
end # def parse
|
829
|
+
|
830
|
+
def do(argv, opts)
|
831
|
+
real_do(argv, opts) do |res|
|
832
|
+
if res.include?('id') then
|
833
|
+
printf("A bug has been filed as Bug#%s\n", res['id'])
|
834
|
+
else
|
835
|
+
p res
|
836
|
+
end
|
837
|
+
end
|
838
|
+
end # def do
|
839
|
+
|
840
|
+
private
|
841
|
+
|
842
|
+
def real_do(argv, opts)
|
843
|
+
conf = read_config(opts)
|
844
|
+
conf.freeze
|
845
|
+
# not supporting filing a bug to multiple bugzilla
|
846
|
+
prefix = argv[0]
|
847
|
+
unless conf.include?(prefix) then
|
848
|
+
raise RuntimeError, sprintf("No host information for %s", prefix)
|
849
|
+
end
|
850
|
+
|
851
|
+
info = conf[prefix]
|
852
|
+
uri = URI.parse(info[:URL])
|
853
|
+
host = uri.host
|
854
|
+
port = uri.port
|
855
|
+
path = uri.path.empty? ? nil : uri.path
|
856
|
+
login = opts[:command][:anonymous] == true ? nil : info[:User]
|
857
|
+
pass = opts[:command][:anonymous] == true ? nil : info[:Password]
|
858
|
+
proxy_host, proxy_port = get_proxy(info)
|
859
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
860
|
+
|
861
|
+
@plugin.run(:pre, host, :newbug, opts)
|
862
|
+
|
863
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
864
|
+
user = Bugzilla::User.new(xmlrpc)
|
865
|
+
user.session(login, pass) do
|
866
|
+
bug = Bugzilla::Bug.new(xmlrpc)
|
867
|
+
|
868
|
+
result = bug.create(opts[:command][:newbug])
|
869
|
+
|
870
|
+
@plugin.run(:post, host, :newbug, result)
|
871
|
+
|
872
|
+
yield result
|
873
|
+
end
|
874
|
+
end # def real_do
|
875
|
+
|
876
|
+
end # class Newbug
|
877
|
+
|
785
878
|
end # module BzConsole
|
786
879
|
|
787
880
|
begin
|
@@ -794,16 +887,17 @@ begin
|
|
794
887
|
opt.separator ""
|
795
888
|
opt.separator "Global options:"
|
796
889
|
opt.on('-c', '--config=FILE', 'read FILE as the configuration file.') {|v| opts[:config] = v}
|
890
|
+
opt.on('-t', '--timeout=SEC', 'Set XMLRPC timeout in a second.') {|v| opts[:timeout] = v.to_i}
|
797
891
|
opt.on('-h', '--help', 'show this message') {|x| opts[:help] = true}
|
798
892
|
|
799
|
-
cmds = BzConsole.constants.sort.map {|x| (k = eval("BzConsole::#{x}")).class == Class && x !=
|
893
|
+
cmds = BzConsole.constants.sort.map {|x| (k = eval("BzConsole::#{x}")).class == Class && x != :CommandTemplate ? x.downcase : nil}.compact
|
800
894
|
|
801
895
|
subargv = opt.order(ARGV);
|
802
896
|
|
803
897
|
command = subargv[0]
|
804
898
|
|
805
899
|
if subargv.length > 0 then
|
806
|
-
n = cmds.index(command)
|
900
|
+
n = cmds.index(command.to_sym)
|
807
901
|
unless n.nil? then
|
808
902
|
opts[:instance] = eval("BzConsole::#{cmds[n].capitalize}.new(Bugzilla::Plugin::Template.new)")
|
809
903
|
subargv = opts[:instance].parse(opt, subargv[1..-1], opts[:command])
|
data/bin/bzconsole~
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
# bzconsole.rb
|
3
|
-
# Copyright (C) 2010 Red Hat, Inc.
|
3
|
+
# Copyright (C) 2010-2012 Red Hat, Inc.
|
4
4
|
#
|
5
5
|
# Authors:
|
6
6
|
# Akira TAGOH <tagoh@redhat.com>
|
@@ -27,17 +27,17 @@ require 'rubygems'
|
|
27
27
|
require 'pp'
|
28
28
|
require 'gruff'
|
29
29
|
require 'uri'
|
30
|
-
|
31
|
-
|
32
|
-
$KCODE = 'u'
|
30
|
+
require 'highline/import'
|
33
31
|
|
34
32
|
begin
|
35
33
|
require 'bugzilla'
|
36
34
|
rescue LoadError
|
37
|
-
|
38
|
-
|
35
|
+
$:.push(File.join(File.dirname(__FILE__), '..', 'lib'))
|
36
|
+
require 'bugzilla'
|
39
37
|
end
|
40
38
|
|
39
|
+
$KCODE = 'u'
|
40
|
+
|
41
41
|
module BzConsole
|
42
42
|
|
43
43
|
class CommandTemplate
|
@@ -61,6 +61,12 @@ module BzConsole
|
|
61
61
|
parser.order(argv)
|
62
62
|
end # def parse
|
63
63
|
|
64
|
+
def do(argv)
|
65
|
+
raise RuntimeError, sprintf("No implementation for %s", self.class)
|
66
|
+
end # def do
|
67
|
+
|
68
|
+
protected
|
69
|
+
|
64
70
|
def read_config(opts)
|
65
71
|
fname = opts[:config].nil? ? @defaultyamlfile : opts[:config]
|
66
72
|
begin
|
@@ -69,16 +75,33 @@ module BzConsole
|
|
69
75
|
conf = {}
|
70
76
|
end
|
71
77
|
conf.each do |k, v|
|
72
|
-
if v.include?(:Plugin) then
|
78
|
+
if v.kind_of?(Hash) && v.include?(:Plugin) then
|
73
79
|
load(v[:Plugin])
|
74
80
|
end
|
75
81
|
end
|
76
82
|
conf
|
77
83
|
end # def read_config
|
78
84
|
|
79
|
-
def
|
80
|
-
|
81
|
-
|
85
|
+
def save_config(opts, conf)
|
86
|
+
fname = opts[:config].nil? ? @defaultyamlfile : opts[:config]
|
87
|
+
if File.exist?(fname) then
|
88
|
+
st = File.lstat(fname)
|
89
|
+
if st.mode & 0600 != 0600 then
|
90
|
+
raise RuntimeError, sprintf("The permissions of %s has to be 0600", fname)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
File.open(fname, "w") {|f| f.chmod(0600); f.write(conf.to_yaml)}
|
94
|
+
end # def save_config
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def get_proxy(info)
|
99
|
+
uri = info[:Proxy] || ENV["http_proxy"]
|
100
|
+
proxy_uri = uri.nil? ? nil : URI.parse(uri)
|
101
|
+
proxy_host = proxy_uri.nil? ? nil : proxy_uri.host
|
102
|
+
proxy_port = proxy_uri.nil? ? nil : proxy_uri.port
|
103
|
+
return proxy_host, proxy_port
|
104
|
+
end
|
82
105
|
|
83
106
|
end # class CommandTemplate
|
84
107
|
|
@@ -149,6 +172,60 @@ module BzConsole
|
|
149
172
|
|
150
173
|
end # class Setup
|
151
174
|
|
175
|
+
class Login < CommandTemplate
|
176
|
+
|
177
|
+
def initialize(plugin)
|
178
|
+
super
|
179
|
+
|
180
|
+
@n_args = 1
|
181
|
+
end # def initialize
|
182
|
+
|
183
|
+
def parse(parser, argv, opts)
|
184
|
+
opts[:output] = File.join(ENV['HOME'], '.ruby-bugzilla-cookie.yml')
|
185
|
+
parser.banner = sprintf("Usage: %s [global options] login [command options] <prefix> ...", File.basename(__FILE__))
|
186
|
+
parser.separator ""
|
187
|
+
parser.separator "Command options:"
|
188
|
+
parser.on('-o', '--output=FILE', 'FILE to store the cookie') {|v| opts[:output] = v}
|
189
|
+
|
190
|
+
super
|
191
|
+
end # def parse
|
192
|
+
|
193
|
+
def do(argv, opts)
|
194
|
+
conf = read_config(opts)
|
195
|
+
conf.freeze
|
196
|
+
cconf = read_config({:config=>opts[:command][:output]})
|
197
|
+
argv.each do |prefix|
|
198
|
+
if prefix.nil? then
|
199
|
+
raise ArgumentError, "No prefix to log in"
|
200
|
+
end
|
201
|
+
unless conf.include?(prefix) then
|
202
|
+
raise RuntimeError, sprintf("No host information for %s", prefix)
|
203
|
+
end
|
204
|
+
|
205
|
+
info = conf[prefix]
|
206
|
+
uri = URI.parse(info[:URL])
|
207
|
+
host = uri.host
|
208
|
+
port = uri.port
|
209
|
+
path = uri.path.empty? ? nil : uri.path
|
210
|
+
login = info[:User].nil? ? ask("Bugzilla ID: ") : info[:User]
|
211
|
+
pass = info[:Password].nil? ? ask("Bugzilla password: ") {|q| q.echo = false} : info[:Password]
|
212
|
+
proxy_host, proxy_port = get_proxy(info)
|
213
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
214
|
+
|
215
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
216
|
+
user = Bugzilla::User.new(xmlrpc)
|
217
|
+
begin
|
218
|
+
result = user.login({'login'=>login, 'password'=>pass, 'remember'=>true})
|
219
|
+
cconf[host] = xmlrpc.cookie
|
220
|
+
save_config({:config=>opts[:command][:output]}, cconf)
|
221
|
+
rescue XMLRPC::FaultException => e
|
222
|
+
printf("E: %s\n", e.message)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end # def do
|
226
|
+
|
227
|
+
end # class Login
|
228
|
+
|
152
229
|
class Getbug < CommandTemplate
|
153
230
|
|
154
231
|
def initialize(plugin)
|
@@ -232,10 +309,12 @@ module BzConsole
|
|
232
309
|
path = uri.path.empty? ? nil : uri.path
|
233
310
|
login = opts[:command][:anonymous] == true ? nil : info[:User]
|
234
311
|
pass = opts[:command][:anonymous] == true ? nil : info[:Password]
|
312
|
+
proxy_host, proxy_port = get_proxy(info)
|
313
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
235
314
|
|
236
315
|
@plugin.run(:pre, host, :getbug, opts)
|
237
316
|
|
238
|
-
xmlrpc = Bugzilla::XMLRPC.new(host, port, path)
|
317
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
239
318
|
user = Bugzilla::User.new(xmlrpc)
|
240
319
|
user.session(login, pass) do
|
241
320
|
bug = Bugzilla::Bug.new(xmlrpc)
|
@@ -344,10 +423,12 @@ module BzConsole
|
|
344
423
|
path = uri.path.empty? ? nil : uri.path
|
345
424
|
login = opts[:command][:anonymous] == true ? nil : info[:User]
|
346
425
|
pass = opts[:command][:anonymous] == true ? nil : info[:Password]
|
426
|
+
proxy_host, proxy_port = get_proxy(info)
|
427
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
347
428
|
|
348
429
|
@plugin.run(:pre, host, :search, opts[:command][:query])
|
349
430
|
|
350
|
-
xmlrpc = Bugzilla::XMLRPC.new(host, port, path)
|
431
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
351
432
|
user = Bugzilla::User.new(xmlrpc)
|
352
433
|
user.session(login, pass) do
|
353
434
|
bug = Bugzilla::Bug.new(xmlrpc)
|
@@ -421,10 +502,12 @@ module BzConsole
|
|
421
502
|
path = uri.path.empty? ? nil : uri.path
|
422
503
|
login = opts[:command][:anonymous] == true ? nil : info[:User]
|
423
504
|
pass = opts[:command][:anonymous] == true ? nil : info[:Password]
|
505
|
+
proxy_host, proxy_port = get_proxy(info)
|
506
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
424
507
|
|
425
508
|
@plugin.run(:pre, host, :show, opts)
|
426
509
|
|
427
|
-
xmlrpc = Bugzilla::XMLRPC.new(host, port, path)
|
510
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
428
511
|
user = Bugzilla::User.new(xmlrpc)
|
429
512
|
user.session(login, pass) do
|
430
513
|
if opts[:command][:show][:mode] == :field then
|
@@ -585,8 +668,10 @@ module BzConsole
|
|
585
668
|
path = uri.path.empty? ? nil : uri.path
|
586
669
|
login = opts[:command][:anonymous] == true ? nil : info[:User]
|
587
670
|
pass = opts[:command][:anonymous] == true ? nil : info[:Password]
|
671
|
+
proxy_host, proxy_port = get_proxy(info)
|
672
|
+
timeout = opts[:timeout].nil? ? 60 : opts[:timeout]
|
588
673
|
|
589
|
-
xmlrpc = Bugzilla::XMLRPC.new(host, port, path)
|
674
|
+
xmlrpc = Bugzilla::XMLRPC.new(host, port, path, proxy_host, proxy_port, timeout)
|
590
675
|
user = Bugzilla::User.new(xmlrpc)
|
591
676
|
user.session(login, pass) do
|
592
677
|
bug = Bugzilla::Bug.new(xmlrpc)
|
@@ -714,6 +799,7 @@ begin
|
|
714
799
|
opt.separator ""
|
715
800
|
opt.separator "Global options:"
|
716
801
|
opt.on('-c', '--config=FILE', 'read FILE as the configuration file.') {|v| opts[:config] = v}
|
802
|
+
opt.on('-t', '--timeout=SEC', 'Set XMLRPC timeout in a second.') {|v| opts[:timeout] = v.to_i}
|
717
803
|
opt.on('-h', '--help', 'show this message') {|x| opts[:help] = true}
|
718
804
|
|
719
805
|
cmds = BzConsole.constants.sort.map {|x| (k = eval("BzConsole::#{x}")).class == Class && x != "CommandTemplate" ? x.downcase : nil}.compact
|
@@ -0,0 +1,52 @@
|
|
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
|