bugzilla 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +17 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Dockerfile +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +76 -0
- data/LICENSE.txt +21 -0
- data/README.md +48 -0
- data/Rakefile +26 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bugzilla.gemspec +34 -0
- data/lib/bugzilla.rb +12 -0
- data/lib/bugzilla/api_template.rb +44 -0
- data/lib/bugzilla/bug.rb +356 -0
- data/lib/bugzilla/bugzilla.rb +149 -0
- data/lib/bugzilla/classification.rb +74 -0
- data/lib/bugzilla/group.rb +43 -0
- data/lib/bugzilla/plugin.rb +67 -0
- data/lib/bugzilla/plugins/nvbugzilla.rb +49 -0
- data/lib/bugzilla/plugins/rhbugzilla.rb +210 -0
- data/lib/bugzilla/product.rb +179 -0
- data/lib/bugzilla/skeleton.rb +42 -0
- data/lib/bugzilla/user.rb +182 -0
- data/lib/bugzilla/utils.rb +53 -0
- data/lib/bugzilla/version.rb +27 -0
- data/lib/bugzilla/xmlrpc.rb +92 -0
- metadata +211 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9761a11f0f99b65c5eec3f00eb1c5c55d6d1bb2a
|
4
|
+
data.tar.gz: 238b099db1ef12341eac6113d7f6690b937f300a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fc81def3b29529d4fa352cd36d399df0fa3e06235821426586bcafabc048b04f9d05661211a1b1b3cee7c19cad2658f5b59b4f7a73ff0bf9fde6fc48e9860844
|
7
|
+
data.tar.gz: 8e20719abe62d43d7b0a69424867b8195a0f2799c84a14799ff1166d3e26e894abd237217bb827d96dccb80d6e8ec51b6f8e9da2806243759e33ffa6305e26cc
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
- CC_TEST_REPORTER_ID=6fafabefb822f683bd58458b718f8ddaadcb2acd886b0214a017e4fb6489b243
|
4
|
+
language: ruby
|
5
|
+
rvm:
|
6
|
+
- 2.4.0
|
7
|
+
before_install:
|
8
|
+
- sudo apt-get -qq update
|
9
|
+
- sudo apt-get install -y libxml2-dev libmagickcore-dev libmagickwand-dev
|
10
|
+
before_script:
|
11
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
12
|
+
- chmod +x ./cc-test-reporter
|
13
|
+
- ./cc-test-reporter before-build
|
14
|
+
script:
|
15
|
+
- bundle exec rake spec
|
16
|
+
after_script:
|
17
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at vpereirabr@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Dockerfile
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bugzilla (0.10.0)
|
5
|
+
gruff (~> 0)
|
6
|
+
highline
|
7
|
+
xmlrpc (~> 0.3.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.5.2)
|
13
|
+
public_suffix (>= 2.0.2, < 4.0)
|
14
|
+
ast (2.4.0)
|
15
|
+
crack (0.4.3)
|
16
|
+
safe_yaml (~> 1.0.0)
|
17
|
+
diff-lcs (1.3)
|
18
|
+
docile (1.1.5)
|
19
|
+
gruff (0.7.0)
|
20
|
+
rmagick (~> 2.13, >= 2.13.4)
|
21
|
+
hashdiff (0.3.7)
|
22
|
+
highline (1.7.10)
|
23
|
+
json (2.1.0)
|
24
|
+
minitest (5.11.3)
|
25
|
+
parallel (1.12.1)
|
26
|
+
parser (2.5.0.2)
|
27
|
+
ast (~> 2.4.0)
|
28
|
+
powerpack (0.1.1)
|
29
|
+
public_suffix (3.0.2)
|
30
|
+
rainbow (3.0.0)
|
31
|
+
rake (10.5.0)
|
32
|
+
rmagick (2.16.0)
|
33
|
+
rspec (2.99.0)
|
34
|
+
rspec-core (~> 2.99.0)
|
35
|
+
rspec-expectations (~> 2.99.0)
|
36
|
+
rspec-mocks (~> 2.99.0)
|
37
|
+
rspec-core (2.99.2)
|
38
|
+
rspec-expectations (2.99.2)
|
39
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
40
|
+
rspec-mocks (2.99.4)
|
41
|
+
rubocop (0.52.1)
|
42
|
+
parallel (~> 1.10)
|
43
|
+
parser (>= 2.4.0.2, < 3.0)
|
44
|
+
powerpack (~> 0.1)
|
45
|
+
rainbow (>= 2.2.2, < 4.0)
|
46
|
+
ruby-progressbar (~> 1.7)
|
47
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
48
|
+
ruby-progressbar (1.9.0)
|
49
|
+
safe_yaml (1.0.4)
|
50
|
+
simplecov (0.15.1)
|
51
|
+
docile (~> 1.1.0)
|
52
|
+
json (>= 1.8, < 3)
|
53
|
+
simplecov-html (~> 0.10.0)
|
54
|
+
simplecov-html (0.10.2)
|
55
|
+
unicode-display_width (1.3.0)
|
56
|
+
webmock (3.3.0)
|
57
|
+
addressable (>= 2.3.6)
|
58
|
+
crack (>= 0.3.2)
|
59
|
+
hashdiff
|
60
|
+
xmlrpc (0.3.0)
|
61
|
+
|
62
|
+
PLATFORMS
|
63
|
+
ruby
|
64
|
+
|
65
|
+
DEPENDENCIES
|
66
|
+
bugzilla!
|
67
|
+
bundler (~> 1.16)
|
68
|
+
minitest (~> 5.0)
|
69
|
+
rake (< 11.0)
|
70
|
+
rspec (~> 2.0)
|
71
|
+
rubocop
|
72
|
+
simplecov
|
73
|
+
webmock
|
74
|
+
|
75
|
+
BUNDLED WITH
|
76
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Victor Pereira
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Bugzilla
|
2
|
+
|
3
|
+
[![Build
|
4
|
+
Status](https://travis-ci.org/vpereira/bugzilla.svg?branch=master)](https://travis-ci.org/vpereira/bugzilla)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/36383c479e2c8a9e8182/maintainability)](https://codeclimate.com/github/vpereira/bugzilla/maintainability)
|
6
|
+
[![Test
|
7
|
+
Coverage](https://api.codeclimate.com/v1/badges/36383c479e2c8a9e8182/test_coverage)](https://codeclimate.com/github/vpereira/bugzilla/test_coverage)
|
8
|
+
|
9
|
+
A revamp from the ruby-bugzilla. Code refactoring and added specs are the main
|
10
|
+
differences. The bzconsole app, was moved as well for its own gem, named ```bzconsole```
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'bugzilla'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install bugzilla
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
TODO: Write usage instructions here
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
35
|
+
|
36
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bugzilla. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
41
|
+
|
42
|
+
## License
|
43
|
+
|
44
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
45
|
+
|
46
|
+
## Code of Conduct
|
47
|
+
|
48
|
+
Everyone interacting in the Bugzilla project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bugzilla/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
require 'rubocop/rake_task'
|
8
|
+
|
9
|
+
RuboCop::RakeTask.new
|
10
|
+
|
11
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
12
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
13
|
+
end
|
14
|
+
|
15
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
16
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
17
|
+
spec.rcov = true
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Open an irb session preloaded with ruby-bugzilla"
|
21
|
+
task :console do
|
22
|
+
sh "irb -rubygems -I lib -r bugzilla.rb"
|
23
|
+
end
|
24
|
+
|
25
|
+
task default: :spec
|
26
|
+
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bugzilla"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bugzilla.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "bugzilla/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bugzilla"
|
8
|
+
spec.version = Bugzilla::VERSION
|
9
|
+
spec.authors = ["Victor Pereira"]
|
10
|
+
spec.email = ["vpereirabr@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby gem to access bugzilla}
|
13
|
+
spec.description = %q{My work is a revamp from ruby-bugzilla from Akira TAGOH}
|
14
|
+
spec.homepage = "https://github.com/vpereira/bugzilla"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
|
+
spec.add_development_dependency "rake", "< 11.0"
|
26
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
27
|
+
spec.add_development_dependency 'rspec', '~> 2.0'
|
28
|
+
spec.add_development_dependency 'rubocop'
|
29
|
+
spec.add_development_dependency 'webmock'
|
30
|
+
spec.add_development_dependency 'simplecov'
|
31
|
+
spec.add_runtime_dependency 'gruff', '~> 0'
|
32
|
+
spec.add_runtime_dependency 'highline'
|
33
|
+
spec.add_runtime_dependency 'xmlrpc', '~> 0.3.0'
|
34
|
+
end
|
data/lib/bugzilla.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'bugzilla/version'
|
2
|
+
require 'bugzilla/bug'
|
3
|
+
require 'bugzilla/bugzilla'
|
4
|
+
require 'bugzilla/classification'
|
5
|
+
require 'bugzilla/group'
|
6
|
+
require 'bugzilla/plugin'
|
7
|
+
require 'bugzilla/product'
|
8
|
+
require 'bugzilla/user'
|
9
|
+
require 'bugzilla/utils'
|
10
|
+
require 'bugzilla/version'
|
11
|
+
require 'bugzilla/xmlrpc'
|
12
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# api_template.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 'bugzilla/skeleton'
|
21
|
+
require 'bugzilla/bugzilla'
|
22
|
+
|
23
|
+
module Bugzilla
|
24
|
+
# rdoc
|
25
|
+
#
|
26
|
+
# === Bugzilla::APITemplate
|
27
|
+
#
|
28
|
+
|
29
|
+
class APITemplate < Skeleton
|
30
|
+
def initialize(iface)
|
31
|
+
super
|
32
|
+
# iface is a Bugzilla::XMLRPC object
|
33
|
+
@bz = Bugzilla.new(iface)
|
34
|
+
end # def initialize
|
35
|
+
|
36
|
+
def method_missing(symbol, *args)
|
37
|
+
if @bz.respond_to?(symbol)
|
38
|
+
@bz.__send__(symbol, *args)
|
39
|
+
else
|
40
|
+
super
|
41
|
+
end
|
42
|
+
end # def method_missing
|
43
|
+
end # class APITemplate
|
44
|
+
end # module Bugzilla
|
data/lib/bugzilla/bug.rb
ADDED
@@ -0,0 +1,356 @@
|
|
1
|
+
# bug.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 'bugzilla/api_template'
|
21
|
+
|
22
|
+
module Bugzilla
|
23
|
+
# rdoc
|
24
|
+
#
|
25
|
+
# === Bugzilla::Bug
|
26
|
+
#
|
27
|
+
# Bugzilla::Bug class is to access
|
28
|
+
# the Bugzilla::WebService::Bug API that allows you to file
|
29
|
+
# a new bug in Bugzilla or get information about bugs that
|
30
|
+
# have already been filed.
|
31
|
+
#
|
32
|
+
|
33
|
+
class Bug < APITemplate
|
34
|
+
FIELDS_SUMMARY = %w[id product component status severity summary].freeze
|
35
|
+
FIELDS_DETAILS = FIELDS_SUMMARY + %w[assigned_to internals priority resolution]
|
36
|
+
FIELDS_ALL = %w[alias assigned_to blocks cc classification
|
37
|
+
component creation_time creator deadline
|
38
|
+
depends_on dupe_of estimated_time groups
|
39
|
+
id is_cc_accessible is_confirmed is_open
|
40
|
+
is_creator_accessible keywords last_change_time
|
41
|
+
op_sys platform priority product qa_contact
|
42
|
+
remaining_time resolution see_also severity
|
43
|
+
status summary target_milestone update_token
|
44
|
+
url version whiteboard
|
45
|
+
external_bugs internals].freeze
|
46
|
+
|
47
|
+
# rdoc
|
48
|
+
#
|
49
|
+
# ==== Bugzilla::Bug#get_bugs(bugs, fields = Bugzilla::Bug::FIELDS_SUMMARY)
|
50
|
+
#
|
51
|
+
# Get the _bugs_ information from Bugzilla. either of String
|
52
|
+
# or Numeric or Array would be acceptable for _bugs_. you can
|
53
|
+
# specify the fields you want to look up with _fields_.
|
54
|
+
#
|
55
|
+
# FWIW this name conflicts to Bugzilla API but this isn's a
|
56
|
+
# primitive method since get_bugs method in WebService API is
|
57
|
+
# actually deprecated.
|
58
|
+
#
|
59
|
+
|
60
|
+
def get_bugs(bugs, fields = FIELDS_SUMMARY)
|
61
|
+
params = {}
|
62
|
+
|
63
|
+
params['ids'] = case bugs
|
64
|
+
when Array
|
65
|
+
bugs
|
66
|
+
when Integer || String
|
67
|
+
[bugs]
|
68
|
+
else
|
69
|
+
raise ArgumentError, format('Unknown type of arguments: %s', bugs.class)
|
70
|
+
end
|
71
|
+
|
72
|
+
unless fields.nil?
|
73
|
+
unless (fields - FIELDS_ALL).empty?
|
74
|
+
raise ArgumentError, format('Invalid fields: %s', (FIELDS_ALL - fields).join(' '))
|
75
|
+
end
|
76
|
+
params['include_fields'] = fields
|
77
|
+
end
|
78
|
+
|
79
|
+
result = get(params)
|
80
|
+
|
81
|
+
if fields.nil? || fields == FIELDS_ALL
|
82
|
+
get_comments(bugs).each do |id, c|
|
83
|
+
result['bugs'].each do |r|
|
84
|
+
next unless r['id'].to_s == id.to_s
|
85
|
+
r['comments'] = c['comments']
|
86
|
+
r['comments'] = [] if r['comments'].nil?
|
87
|
+
break
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# 'bugs' is only in interests.
|
93
|
+
# XXX: need to deal with 'faults' ?
|
94
|
+
result['bugs']
|
95
|
+
end # def get_bugs
|
96
|
+
|
97
|
+
# rdoc
|
98
|
+
#
|
99
|
+
# ==== Bugzilla::Bug#get_comments(bugs)
|
100
|
+
#
|
101
|
+
|
102
|
+
def get_comments(bugs)
|
103
|
+
|
104
|
+
params = {}
|
105
|
+
|
106
|
+
# TODO
|
107
|
+
# this construction should be refactored to a method
|
108
|
+
params['ids'] = case bugs
|
109
|
+
when Array
|
110
|
+
bugs
|
111
|
+
when Integer || String
|
112
|
+
[bugs]
|
113
|
+
else
|
114
|
+
raise ArgumentError, format('Unknown type of arguments: %s', bugs.class)
|
115
|
+
end
|
116
|
+
|
117
|
+
result = comments(params)
|
118
|
+
|
119
|
+
# not supporting comment_ids. so drop "comments".
|
120
|
+
ret = result['bugs']
|
121
|
+
# creation_time was added in Bugzilla 4.4. copy the 'time' value to creation_time if not available for compatibility.
|
122
|
+
unless check_version(4.4)[0]
|
123
|
+
ret.each do |_id, o|
|
124
|
+
o['comments'].each do |c|
|
125
|
+
c['creation_time'] = c['time'] unless c.include?('creation_time')
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
ret
|
131
|
+
end # def get_comments
|
132
|
+
|
133
|
+
# rdoc
|
134
|
+
#
|
135
|
+
# ==== Bugzilla::Bug#fields(params)
|
136
|
+
#
|
137
|
+
# Raw Bugzilla API to obtain the information about valid bug
|
138
|
+
# fields, including the lists of legal values for each field.
|
139
|
+
#
|
140
|
+
# See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
141
|
+
#
|
142
|
+
|
143
|
+
# rdoc
|
144
|
+
#
|
145
|
+
# ==== Bugzilla::Bug#legal_values(params)
|
146
|
+
#
|
147
|
+
# Raw Bugzilla API to obtain the information what values are
|
148
|
+
# allowed for a particular field.
|
149
|
+
#
|
150
|
+
# See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
151
|
+
#
|
152
|
+
|
153
|
+
# rdoc
|
154
|
+
#
|
155
|
+
# ==== Bugzilla::Bug#attachments(params)
|
156
|
+
#
|
157
|
+
# Raw Bugzilla API to obtain the information about
|
158
|
+
# attachments, given a list of bugs and/or attachment ids.
|
159
|
+
#
|
160
|
+
# See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
161
|
+
#
|
162
|
+
|
163
|
+
# rdoc
|
164
|
+
#
|
165
|
+
# ==== Bugzilla::Bug#comments(params)
|
166
|
+
#
|
167
|
+
# Raw Bugzilla API to obtain the information about comments,
|
168
|
+
# given a list of bugs and/or comment ids.
|
169
|
+
#
|
170
|
+
# See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
171
|
+
#
|
172
|
+
|
173
|
+
# rdoc
|
174
|
+
#
|
175
|
+
# ==== Bugzilla::Bug#get(params)
|
176
|
+
#
|
177
|
+
# Raw Bugzilla API to obtain the information about particular
|
178
|
+
# bugs in the database.
|
179
|
+
#
|
180
|
+
# See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
181
|
+
#
|
182
|
+
|
183
|
+
# rdoc
|
184
|
+
#
|
185
|
+
# ==== Bugzilla::Bug#history(params)
|
186
|
+
#
|
187
|
+
# Raw Bugzilla API to obtain the history of changes for
|
188
|
+
# particular bugs in the database.
|
189
|
+
#
|
190
|
+
# See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
191
|
+
#
|
192
|
+
|
193
|
+
# rdoc
|
194
|
+
#
|
195
|
+
# ==== Bugzilla::Bug#search(params)
|
196
|
+
#
|
197
|
+
# Raw Bugzilla API to search for bugs based on particular
|
198
|
+
# criteria.
|
199
|
+
#
|
200
|
+
# See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
201
|
+
#
|
202
|
+
|
203
|
+
# rdoc
|
204
|
+
#
|
205
|
+
# ==== Bugzilla::Bug#create(params)
|
206
|
+
#
|
207
|
+
# Raw Bugzilla API to create a new bug in Bugzilla.
|
208
|
+
#
|
209
|
+
# See http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
|
210
|
+
#
|
211
|
+
|
212
|
+
protected
|
213
|
+
|
214
|
+
def _fields(cmd, *args)
|
215
|
+
requires_version(cmd, 3.6)
|
216
|
+
params = {}
|
217
|
+
a = args[0]
|
218
|
+
case a
|
219
|
+
when Array
|
220
|
+
is = a.map { |x| x.is_a?(Integer) }.uniq
|
221
|
+
params['ids'] = a if is.size == 1 && is[0]
|
222
|
+
ss = a.map { |x| x.is_a?(String) }.uniq
|
223
|
+
params['names'] = a if ss.size == 1 && ss[0]
|
224
|
+
when Hash
|
225
|
+
params = a
|
226
|
+
when Integer
|
227
|
+
params['ids'] = [a]
|
228
|
+
when String
|
229
|
+
params['names'] = [a]
|
230
|
+
else
|
231
|
+
raise ArgumentError, 'Invalid parameters'
|
232
|
+
end
|
233
|
+
@iface.call(cmd, params)
|
234
|
+
end # def _fields
|
235
|
+
|
236
|
+
def _legal_values(cmd, *args)
|
237
|
+
raise ArgumentError, 'Invalid parameters' unless args[0].is_a?(Hash)
|
238
|
+
|
239
|
+
@iface.call(cmd, args[0])
|
240
|
+
end # def _legal_values
|
241
|
+
|
242
|
+
def _attachments(cmd, *args)
|
243
|
+
requires_version(cmd, 3.6)
|
244
|
+
|
245
|
+
raise ArgumentError, 'Invalid parameters' unless args[0].is_a?(Hash)
|
246
|
+
|
247
|
+
@iface.call(cmd, args[0])
|
248
|
+
end # def _attachments
|
249
|
+
|
250
|
+
def _comments(cmd, *args)
|
251
|
+
requires_version(cmd, 3.4)
|
252
|
+
|
253
|
+
raise ArgumentError, 'Invalid parameters' unless args[0].is_a?(Hash)
|
254
|
+
|
255
|
+
@iface.call(cmd, args[0])
|
256
|
+
end # def _comments
|
257
|
+
|
258
|
+
def _get(cmd, *args)
|
259
|
+
params = {}
|
260
|
+
|
261
|
+
a = args[0]
|
262
|
+
|
263
|
+
case a
|
264
|
+
when Hash
|
265
|
+
params = a
|
266
|
+
when Array
|
267
|
+
params['ids'] = a
|
268
|
+
when Integer || String
|
269
|
+
params['ids'] = [a]
|
270
|
+
else
|
271
|
+
raise ArgumentError, 'Invalid parameters'
|
272
|
+
end
|
273
|
+
|
274
|
+
params['permissive'] = true if check_version(3.4)[0]
|
275
|
+
|
276
|
+
@iface.call(cmd, params)
|
277
|
+
end # def _get
|
278
|
+
|
279
|
+
def _history(cmd, *args)
|
280
|
+
requires_version(cmd, 3.4)
|
281
|
+
|
282
|
+
params = {}
|
283
|
+
a = args[0]
|
284
|
+
case a
|
285
|
+
when Hash
|
286
|
+
params = a
|
287
|
+
when Array
|
288
|
+
params['ids'] = a
|
289
|
+
when Integer || String
|
290
|
+
params['ids'] = [a]
|
291
|
+
else
|
292
|
+
raise ArgumentError, 'Invalid parameters'
|
293
|
+
end
|
294
|
+
|
295
|
+
@iface.call(cmd, params)
|
296
|
+
end # def _history
|
297
|
+
|
298
|
+
def _search(cmd, *args)
|
299
|
+
requires_version(cmd, 3.4)
|
300
|
+
|
301
|
+
raise ArgumentError, 'Invalid parameters' unless args[0].is_a?(Hash)
|
302
|
+
|
303
|
+
@iface.call(cmd, args[0])
|
304
|
+
end # def _search
|
305
|
+
|
306
|
+
def _create(cmd, *args)
|
307
|
+
raise ArgumentError, 'Invalid parameters' unless args[0].is_a?(Hash)
|
308
|
+
|
309
|
+
required_fields = %i[product component summary version]
|
310
|
+
defaulted_fields = %i[description op_sys platform priority severity]
|
311
|
+
|
312
|
+
res = check_version('3.0.4')
|
313
|
+
required_fields.push(*defaulted_fields) unless res[0]
|
314
|
+
required_fields.each do |f|
|
315
|
+
raise ArgumentError, format("Required fields isn't given: %s", f) unless args[0].include?(f)
|
316
|
+
end
|
317
|
+
res = check_version(4.0)
|
318
|
+
if res[0]
|
319
|
+
if args[0].include?('commentprivacy')
|
320
|
+
args[0]['comment_is_private'] = args[0]['commentprivacy']
|
321
|
+
args[0].delete('commentprivacy')
|
322
|
+
end
|
323
|
+
else
|
324
|
+
raise ArgumentError, "groups field isn't available in this bugzilla" if args[0].include?('groups')
|
325
|
+
raise ArgumentError, "comment_is_private field isn't available in this bugzilla" if args[0].include?('comment_is_private')
|
326
|
+
end
|
327
|
+
|
328
|
+
@iface.call(cmd, args[0])
|
329
|
+
end # def _create
|
330
|
+
|
331
|
+
def __add_attachment(cmd, *_args)
|
332
|
+
requires_version(cmd, 4.0)
|
333
|
+
# FIXME
|
334
|
+
end # def _add_attachment
|
335
|
+
|
336
|
+
def __add_comment(cmd, *_args)
|
337
|
+
requires_version(cmd, 3.2)
|
338
|
+
# FIXME
|
339
|
+
end # def _add_comment
|
340
|
+
|
341
|
+
def __update(cmd, *_args)
|
342
|
+
requires_version(cmd, 4.0)
|
343
|
+
# FIXME
|
344
|
+
end # def _update
|
345
|
+
|
346
|
+
def __update_see_also(cmd, *_args)
|
347
|
+
requires_version(cmd, 3.4)
|
348
|
+
# FIXME
|
349
|
+
end # def _update_see_also
|
350
|
+
|
351
|
+
def __update_tags(cmd, *_args)
|
352
|
+
requires_version(cmd, 4.4)
|
353
|
+
# FIXME
|
354
|
+
end # def _update_tags
|
355
|
+
end # class Bug
|
356
|
+
end # module Bugzilla
|