ruby_bugzilla 0.2.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.
- data/.gitignore +17 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +23 -0
- data/README.md +42 -0
- data/Rakefile +6 -0
- data/lib/ruby_bugzilla/version.rb +3 -0
- data/lib/ruby_bugzilla.rb +144 -0
- data/ruby_bugzilla.gemspec +36 -0
- data/samples/bugzilla_credentials.yaml +14 -0
- data/spec/ruby_bugzilla_spec.rb +244 -0
- data/spec/spec_helper.rb +21 -0
- metadata +152 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2013 Red Hat, Inc.
|
2
|
+
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# RubyBugzilla
|
2
|
+
|
3
|
+
|
4
|
+
[](http://badge.fury.io/rb/ruby_bugzilla)
|
5
|
+
[](https://travis-ci.org/ManageIQ/ruby_bugzilla)
|
6
|
+
[](https://codeclimate.com/github/ManageIQ/ruby_bugzilla)
|
7
|
+
[](https://coveralls.io/r/ManageIQ/ruby_bugzilla)
|
8
|
+
[](https://gemnasium.com/ManageIQ/ruby_bugzilla)
|
9
|
+
|
10
|
+
A Ruby wrapper around the python-bugzilla CLI for easy access to the Bugzilla API
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
gem 'ruby_bugzilla'
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install ruby_bugzilla
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
If not already logged in to bugzilla, RubyBugzilla can login using
|
29
|
+
the crendentials in bugzilla_credentials.yaml
|
30
|
+
Copy sample/bugzilla_credentials.yaml to $HOME and edit the file
|
31
|
+
to contain your bugzilla credentials.
|
32
|
+
|
33
|
+
TODO: Write more usage instructions here
|
34
|
+
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'linux_admin'
|
3
|
+
|
4
|
+
class RubyBugzilla
|
5
|
+
|
6
|
+
CMD = '/usr/bin/bugzilla'
|
7
|
+
COOKIES_FILE = File.expand_path('~') + '/.bugzillacookies'
|
8
|
+
CREDS_FILE = File.expand_path('~') + '/.bugzilla_credentials.yaml'
|
9
|
+
|
10
|
+
def self.username=(un)
|
11
|
+
@username = un
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.username
|
15
|
+
@username
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.password=(pw)
|
19
|
+
@password = pw
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.password
|
23
|
+
@password
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.credentials(username = nil, password = nil)
|
27
|
+
self.username = username
|
28
|
+
self.password = password
|
29
|
+
|
30
|
+
if self.username.nil? || self.password.nil?
|
31
|
+
un_from_file, pw_from_file = self.credentials_from_file
|
32
|
+
self.username ||= un_from_file
|
33
|
+
self.password ||= pw_from_file
|
34
|
+
end
|
35
|
+
|
36
|
+
[self.username, self.password]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Ruby will catch and raise Erron::ENOENT: if there is no
|
40
|
+
# ~/.bugzilla_credentials.yaml file.
|
41
|
+
def self.credentials_from_file
|
42
|
+
begin
|
43
|
+
creds = YAML.load_file(CREDS_FILE)
|
44
|
+
rescue Errno::ENOENT => error
|
45
|
+
return [nil, nil]
|
46
|
+
end
|
47
|
+
|
48
|
+
[creds[:bugzilla_credentials][:username],
|
49
|
+
creds[:bugzilla_credentials][:password]]
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.options
|
53
|
+
begin
|
54
|
+
options = YAML.load_file(CREDS_FILE)
|
55
|
+
rescue Errno::ENOENT => error
|
56
|
+
return ["https://bugzilla.redhat.com/", false]
|
57
|
+
end
|
58
|
+
[options[:bugzilla_options][:bugzilla_uri],
|
59
|
+
options[:bugzilla_options][:debug]]
|
60
|
+
end
|
61
|
+
|
62
|
+
# Running "bugzilla login" generates the bugzilla cookies.
|
63
|
+
# If that cookie file exists assume the user already logged in.
|
64
|
+
def self.logged_in?
|
65
|
+
File.exists?(COOKIES_FILE)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.clear_login!
|
69
|
+
if File.exists?(COOKIES_FILE) then
|
70
|
+
File.delete(COOKIES_FILE)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.login!(username = nil, password = nil)
|
75
|
+
|
76
|
+
login_cmd = "#{CMD} "
|
77
|
+
output = "Already Logged In"
|
78
|
+
params = {}
|
79
|
+
|
80
|
+
raise "Please install python-bugzilla" unless File.exists?(File.expand_path(CMD))
|
81
|
+
|
82
|
+
unless self.logged_in?
|
83
|
+
username, password = self.credentials(username, password)
|
84
|
+
uri_opt, debug_opt = self.options
|
85
|
+
|
86
|
+
params["--bugzilla="] = "#{uri_opt}/xmlrpc.cgi" unless uri_opt.nil?
|
87
|
+
params["--debug"] = nil if debug_opt
|
88
|
+
params["login"] = [username, password]
|
89
|
+
|
90
|
+
begin
|
91
|
+
login_cmd_result = LinuxAdmin.run!(CMD, :params => params)
|
92
|
+
rescue => error
|
93
|
+
# A failed login attempt could result in a corrupt COOKIES_FILE
|
94
|
+
clear_login!
|
95
|
+
raise "#{self.string_command(CMD, params, password)} Failed.\n#{error}"
|
96
|
+
end
|
97
|
+
output = login_cmd_result.output
|
98
|
+
end
|
99
|
+
[self.string_command(CMD, params, password), output]
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.query(product, flag=nil, bug_status=nil, output_format=nil)
|
103
|
+
|
104
|
+
raise "Please install python-bugzilla" unless
|
105
|
+
File.exists?(File.expand_path(CMD))
|
106
|
+
|
107
|
+
raise ArgumentError, "product cannot be nil" if product.nil?
|
108
|
+
|
109
|
+
uri_opt, debug_opt = self.options
|
110
|
+
|
111
|
+
params = {}
|
112
|
+
|
113
|
+
params["--bugzilla="] = "#{uri_opt}/xmlrpc.cgi" unless uri_opt.nil?
|
114
|
+
params["query"] = nil
|
115
|
+
params["--product="] = product
|
116
|
+
params["--flag="] = flag unless flag.nil?
|
117
|
+
params["--bug_status="] = bug_status unless bug_status.nil?
|
118
|
+
params["--outputformat="] = output_format unless output_format.nil?
|
119
|
+
|
120
|
+
begin
|
121
|
+
query_cmd_result = LinuxAdmin.run!(CMD, :params => params)
|
122
|
+
rescue => error
|
123
|
+
raise "#{self.string_command(CMD, params)} Failed.\n#{error}"
|
124
|
+
end
|
125
|
+
|
126
|
+
[self.string_command(CMD, params), query_cmd_result.output]
|
127
|
+
end
|
128
|
+
|
129
|
+
private
|
130
|
+
def self.string_command(cmd, params = {}, password=nil)
|
131
|
+
scrubbed_str = str = ""
|
132
|
+
str << cmd
|
133
|
+
params.each do |param, value|
|
134
|
+
if value.kind_of?(Array)
|
135
|
+
str << " #{param} \"#{value.join(" ")}\" "
|
136
|
+
else
|
137
|
+
str << " #{param}\"#{value}\" "
|
138
|
+
end
|
139
|
+
end
|
140
|
+
scrubbed_str = str.sub(password, "********") unless password.nil?
|
141
|
+
scrubbed_str
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ruby_bugzilla/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
|
8
|
+
authors_hash = {"Joe VLcek"=>"jvlcek@redhat.com"}
|
9
|
+
|
10
|
+
spec.name = "ruby_bugzilla"
|
11
|
+
spec.version = RubyBugzilla::VERSION
|
12
|
+
spec.authors = authors_hash.keys
|
13
|
+
spec.email = authors_hash.values
|
14
|
+
spec.description = %q{
|
15
|
+
RubyBugzilla is a ruby wrapper around the python-bugzilla CLI for easy access to
|
16
|
+
the Bugzilla API from Ruby.}
|
17
|
+
spec.summary = %q{RubyBugzilla is a ruby wrapper around python-bugzilla}
|
18
|
+
spec.description = %q{
|
19
|
+
RubyBugzilla is a module allowing access the to python-bugzilla command
|
20
|
+
from Ruby.
|
21
|
+
}
|
22
|
+
spec.summary = %q{RubyBugzilla is a module providing a Ruby interface to python-bugzilla.}
|
23
|
+
spec.homepage = "http://github.com/ManageIQ/ruby-bugzilla"
|
24
|
+
spec.license = "MIT"
|
25
|
+
|
26
|
+
spec.files = `git ls-files`.split($/)
|
27
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
28
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
32
|
+
spec.add_development_dependency "rake"
|
33
|
+
spec.add_development_dependency "rspec"
|
34
|
+
spec.add_development_dependency "linux_admin", "~> 0.2.1"
|
35
|
+
spec.add_development_dependency "coveralls"
|
36
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Copy this file to .bugzilla_credentials.yaml
|
2
|
+
# in your home directory to use it for automated
|
3
|
+
# login to bugzilla
|
4
|
+
#
|
5
|
+
# Note: The dot to make it a hiden file:
|
6
|
+
# <dot>bugzilla_credentials.yaml
|
7
|
+
#
|
8
|
+
---
|
9
|
+
:bugzilla_options:
|
10
|
+
:bugzilla_uri: https://bugzilla.redhat.com/
|
11
|
+
:debug: true
|
12
|
+
:bugzilla_credentials:
|
13
|
+
:username: Your bugzilla login name
|
14
|
+
:password: Your bugzilla password
|
@@ -0,0 +1,244 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
class TempCredFile < Tempfile
|
5
|
+
def initialize(file)
|
6
|
+
f = super
|
7
|
+
f.puts("---")
|
8
|
+
f.puts(":bugzilla_credentials:")
|
9
|
+
f.puts(" :username: My Username")
|
10
|
+
f.puts(" :password: My Password")
|
11
|
+
f.puts(":bugzilla_options:")
|
12
|
+
f.puts(" :bugzilla_uri: MyURI")
|
13
|
+
f.puts(" :debug: MyDebug")
|
14
|
+
f.flush
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe RubyBugzilla do
|
19
|
+
saved_cmd = RubyBugzilla::CMD
|
20
|
+
saved_cookies_file = RubyBugzilla::COOKIES_FILE
|
21
|
+
saved_creds_file = RubyBugzilla::CREDS_FILE
|
22
|
+
|
23
|
+
def ignore_warnings(&block)
|
24
|
+
begin
|
25
|
+
v, $VERBOSE = $VERBOSE, nil
|
26
|
+
block.call if block
|
27
|
+
ensure
|
28
|
+
$VERBOSE = v
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Run after each tests to reset any faked RubyBugzilla constants.
|
33
|
+
after :each do
|
34
|
+
ignore_warnings do
|
35
|
+
RubyBugzilla::CMD = saved_cmd
|
36
|
+
RubyBugzilla::COOKIES_FILE = saved_cookies_file
|
37
|
+
RubyBugzilla::CREDS_FILE = saved_creds_file
|
38
|
+
RubyBugzilla.username = nil
|
39
|
+
RubyBugzilla.password = nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "#logged_in?" do
|
44
|
+
it "with an existing bugzilla cookie" do
|
45
|
+
Tempfile.open('ruby_bugzilla_spec') do |file|
|
46
|
+
ignore_warnings do
|
47
|
+
RubyBugzilla::COOKIES_FILE = file.path
|
48
|
+
end
|
49
|
+
RubyBugzilla.logged_in?.should be true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it "with no bugzilla cookie" do
|
54
|
+
ignore_warnings do
|
55
|
+
RubyBugzilla::COOKIES_FILE = '/This/file/does/not/exist'
|
56
|
+
end
|
57
|
+
RubyBugzilla.logged_in?.should be false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "#login!" do
|
62
|
+
|
63
|
+
it "when the bugzilla command is not found" do
|
64
|
+
ignore_warnings do
|
65
|
+
RubyBugzilla::CMD = '/This/cmd/does/not/exist'
|
66
|
+
end
|
67
|
+
expect{RubyBugzilla.login!}.to raise_exception
|
68
|
+
end
|
69
|
+
|
70
|
+
it "when the bugzilla login command produces output" do
|
71
|
+
# Fake the command and cookies file.
|
72
|
+
ignore_warnings do
|
73
|
+
RubyBugzilla::CMD = '/bin/echo'
|
74
|
+
RubyBugzilla::COOKIES_FILE = '/This/file/does/not/exist'
|
75
|
+
end
|
76
|
+
cmd, output = RubyBugzilla.login!("My Username", "My Password")
|
77
|
+
output.should include("login My Username My Password")
|
78
|
+
end
|
79
|
+
|
80
|
+
it "when the bugzilla login command produces output with arguments" do
|
81
|
+
# Fake the command and cookies file.
|
82
|
+
ignore_warnings do
|
83
|
+
RubyBugzilla::CMD = '/bin/echo'
|
84
|
+
RubyBugzilla::COOKIES_FILE = '/This/file/does/not/exist'
|
85
|
+
end
|
86
|
+
cmd, output = RubyBugzilla.login!("calvin", "hobbes")
|
87
|
+
output.should include("login calvin hobbes")
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
context "#query" do
|
93
|
+
|
94
|
+
it "when the bugzilla command is not found" do
|
95
|
+
ignore_warnings do
|
96
|
+
RubyBugzilla::CMD = '/This/cmd/does/not/exist'
|
97
|
+
end
|
98
|
+
expect{RubyBugzilla.query}.to raise_exception
|
99
|
+
end
|
100
|
+
|
101
|
+
it "when no product is specified" do
|
102
|
+
ignore_warnings do
|
103
|
+
RubyBugzilla::CMD = '/bin/echo'
|
104
|
+
end
|
105
|
+
expect{RubyBugzilla.query}.to raise_error(ArgumentError)
|
106
|
+
end
|
107
|
+
|
108
|
+
it "when the bugzilla query command produces output" do
|
109
|
+
# Fake the command and cookies file.
|
110
|
+
ignore_warnings do
|
111
|
+
RubyBugzilla::CMD = '/bin/echo'
|
112
|
+
RubyBugzilla::COOKIES_FILE = '/This/file/does/not/exist'
|
113
|
+
end
|
114
|
+
|
115
|
+
cmd, output = RubyBugzilla.login!("calvin", "hobbes")
|
116
|
+
cmd, output = RubyBugzilla.query('CloudForms Management Engine',
|
117
|
+
flag = '',
|
118
|
+
bug_status = 'NEW, ASSIGNED, POST, MODIFIED, ON_DEV, ON_QA, VERIFIED, RELEASE_PENDING',
|
119
|
+
output_format = 'BZ_ID: %{id} STATUS: %{bug_status} SUMMARY: %{summary}')
|
120
|
+
|
121
|
+
cmd.should include("query")
|
122
|
+
output.should include("BZ_ID:")
|
123
|
+
output.should include("STATUS:")
|
124
|
+
output.should include("SUMMARY:")
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
context "#credentials_from_file" do
|
130
|
+
it "when the YAML input file is not found" do
|
131
|
+
ignore_warnings do
|
132
|
+
RubyBugzilla::CREDS_FILE = '/This/cmd/does/not/exist'
|
133
|
+
end
|
134
|
+
un, pw = RubyBugzilla.credentials_from_file
|
135
|
+
un.should == nil
|
136
|
+
pw.should == nil
|
137
|
+
end
|
138
|
+
|
139
|
+
it "when the YAML input is valid" do
|
140
|
+
# Fake the credentials YAML file.
|
141
|
+
TempCredFile.open('ruby_bugzilla_spec') do |file|
|
142
|
+
ignore_warnings do
|
143
|
+
RubyBugzilla::CREDS_FILE = file.path
|
144
|
+
end
|
145
|
+
un, pw = RubyBugzilla.credentials_from_file
|
146
|
+
un.should == "My Username"
|
147
|
+
pw.should == "My Password"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
context "#credentials" do
|
153
|
+
it "with no arguments and when the YAML input file is not found" do
|
154
|
+
ignore_warnings do
|
155
|
+
RubyBugzilla::CREDS_FILE = '/This/cmd/does/not/exist'
|
156
|
+
end
|
157
|
+
un, pw = RubyBugzilla.credentials
|
158
|
+
un.should == nil
|
159
|
+
pw.should == nil
|
160
|
+
end
|
161
|
+
|
162
|
+
it "with no arguments and when the YAML input is valid" do
|
163
|
+
# Fake the credentials YAML file.
|
164
|
+
TempCredFile.open('ruby_bugzilla_spec') do |file|
|
165
|
+
ignore_warnings do
|
166
|
+
RubyBugzilla::CREDS_FILE = file.path
|
167
|
+
end
|
168
|
+
un, pw = RubyBugzilla.credentials
|
169
|
+
un.should == "My Username"
|
170
|
+
pw.should == "My Password"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
it "with arguments and when the YAML input file is not found" do
|
175
|
+
ignore_warnings do
|
176
|
+
RubyBugzilla::CREDS_FILE = '/This/cmd/does/not/exist'
|
177
|
+
end
|
178
|
+
un, pw = RubyBugzilla.credentials("test_un", "test_pw")
|
179
|
+
un.should == "test_un"
|
180
|
+
pw.should == "test_pw"
|
181
|
+
end
|
182
|
+
|
183
|
+
it "with arguments and valid YAML input, favor arguments" do
|
184
|
+
# Fake the credentials YAML file.
|
185
|
+
TempCredFile.open('ruby_bugzilla_spec') do |file|
|
186
|
+
ignore_warnings do
|
187
|
+
RubyBugzilla::CREDS_FILE = file.path
|
188
|
+
end
|
189
|
+
un, pw = RubyBugzilla.credentials("test_un", "test_pw")
|
190
|
+
un.should == "test_un"
|
191
|
+
pw.should == "test_pw"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
it "with password argument and valid YAML input, favor argument" do
|
196
|
+
# Fake the credentials YAML file.
|
197
|
+
TempCredFile.open('ruby_bugzilla_spec') do |file|
|
198
|
+
ignore_warnings do
|
199
|
+
RubyBugzilla::CREDS_FILE = file.path
|
200
|
+
end
|
201
|
+
un, pw = RubyBugzilla.credentials(nil, "test_pw")
|
202
|
+
un.should == "My Username"
|
203
|
+
pw.should == "test_pw"
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
it "with username argument and valid YAML input, favor argument" do
|
208
|
+
# Fake the credentials YAML file.
|
209
|
+
TempCredFile.open('ruby_bugzilla_spec') do |file|
|
210
|
+
ignore_warnings do
|
211
|
+
RubyBugzilla::CREDS_FILE = file.path
|
212
|
+
end
|
213
|
+
un, pw = RubyBugzilla.credentials("test_un")
|
214
|
+
un.should == "test_un"
|
215
|
+
pw.should == "My Password"
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
context "#options" do
|
222
|
+
it "when the YAML input is valid" do
|
223
|
+
# Fake the credentials YAML file.
|
224
|
+
TempCredFile.open('ruby_bugzilla_spec') do |file|
|
225
|
+
ignore_warnings do
|
226
|
+
RubyBugzilla::CREDS_FILE = file.path
|
227
|
+
end
|
228
|
+
uri, debug = RubyBugzilla.options
|
229
|
+
uri.should == "MyURI"
|
230
|
+
debug.should == "MyDebug"
|
231
|
+
end
|
232
|
+
end
|
233
|
+
it "when the YAML input is is not found" do
|
234
|
+
ignore_warnings do
|
235
|
+
RubyBugzilla::CREDS_FILE = '/This/cmd/does/not/exist'
|
236
|
+
end
|
237
|
+
uri, debug = RubyBugzilla.options
|
238
|
+
uri.should == "https://bugzilla.redhat.com/"
|
239
|
+
debug.should == false
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'ruby_bugzilla'
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
6
|
+
# loaded once.
|
7
|
+
#
|
8
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
|
+
config.run_all_when_everything_filtered = true
|
12
|
+
|
13
|
+
# Run specs in random order to surface order dependencies. If you find an
|
14
|
+
# order dependency and want to debug it, you can fix the order by providing
|
15
|
+
# the seed, which is printed after each run.
|
16
|
+
# --seed 1234
|
17
|
+
config.order = 'random'
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'coveralls'
|
21
|
+
Coveralls.wear!
|
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_bugzilla
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Joe VLcek
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-10-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
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: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
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: linux_admin
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.2.1
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.2.1
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: coveralls
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: ! '
|
95
|
+
|
96
|
+
RubyBugzilla is a module allowing access the to python-bugzilla command
|
97
|
+
|
98
|
+
from Ruby.
|
99
|
+
|
100
|
+
'
|
101
|
+
email:
|
102
|
+
- jvlcek@redhat.com
|
103
|
+
executables: []
|
104
|
+
extensions: []
|
105
|
+
extra_rdoc_files: []
|
106
|
+
files:
|
107
|
+
- .gitignore
|
108
|
+
- .travis.yml
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- lib/ruby_bugzilla.rb
|
114
|
+
- lib/ruby_bugzilla/version.rb
|
115
|
+
- ruby_bugzilla.gemspec
|
116
|
+
- samples/bugzilla_credentials.yaml
|
117
|
+
- spec/ruby_bugzilla_spec.rb
|
118
|
+
- spec/spec_helper.rb
|
119
|
+
homepage: http://github.com/ManageIQ/ruby-bugzilla
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
hash: -64370731141864933
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
137
|
+
requirements:
|
138
|
+
- - ! '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
segments:
|
142
|
+
- 0
|
143
|
+
hash: -64370731141864933
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 1.8.25
|
147
|
+
signing_key:
|
148
|
+
specification_version: 3
|
149
|
+
summary: RubyBugzilla is a module providing a Ruby interface to python-bugzilla.
|
150
|
+
test_files:
|
151
|
+
- spec/ruby_bugzilla_spec.rb
|
152
|
+
- spec/spec_helper.rb
|