bicho 0.0.5 → 0.0.6
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/lib/bicho/client.rb +9 -5
- data/lib/bicho/plugins/novell.rb +23 -11
- data/lib/bicho/query.rb +2 -0
- data/lib/bicho/version.rb +1 -1
- data/test/test_novell_plugin.rb +10 -0
- metadata +5 -5
data/lib/bicho/client.rb
CHANGED
@@ -176,12 +176,16 @@ module Bicho
|
|
176
176
|
case response
|
177
177
|
when Net::HTTPSuccess
|
178
178
|
bugs = []
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
179
|
+
begin
|
180
|
+
xml = Nokogiri::XML.parse(response.body)
|
181
|
+
xml.root.xpath("//xmlns:entry/xmlns:link/@href", xml.root.namespace).each do |attr|
|
182
|
+
uri = URI.parse attr.value
|
183
|
+
bugs << uri.query.split("=")[1]
|
184
|
+
end
|
185
|
+
return bugs
|
186
|
+
rescue Nokogiri::XML::XPath::SyntaxError
|
187
|
+
raise "Named query '#{what}' not found"
|
183
188
|
end
|
184
|
-
return bugs
|
185
189
|
when Net::HTTPRedirect
|
186
190
|
raise "HTTP redirect not supported in named_query"
|
187
191
|
else
|
data/lib/bicho/plugins/novell.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# Copyright (c) 2011 SUSE LINUX Products GmbH
|
3
|
-
#
|
3
|
+
# =>
|
4
4
|
# Author: Duncan Mac-Vicar P. <dmacvicar@suse.de>
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining
|
@@ -40,22 +40,34 @@ module Bicho
|
|
40
40
|
class Novell
|
41
41
|
|
42
42
|
OSCRC_CREDENTIALS = "https://api.opensuse.org"
|
43
|
+
DEFAULT_OSCRC_PATH = File.join(ENV['HOME'], '.oscrc')
|
44
|
+
|
45
|
+
def self.oscrc_path=(path)
|
46
|
+
@oscrc_path = path
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.oscrc_path
|
50
|
+
@oscrc_path ||= DEFAULT_OSCRC_PATH
|
51
|
+
end
|
43
52
|
|
44
53
|
def to_s
|
45
|
-
self.class.to_s
|
54
|
+
self.class.to_s
|
46
55
|
end
|
47
56
|
|
48
|
-
def self.oscrc_credentials
|
49
|
-
oscrc = IniFile.new(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
if
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
+
def self.oscrc_credentials
|
58
|
+
oscrc = IniFile.new(oscrc_path)
|
59
|
+
urls = [OSCRC_CREDENTIALS]
|
60
|
+
urls << "#{OSCRC_CREDENTIALS}/" if not OSCRC_CREDENTIALS.end_with?('/')
|
61
|
+
urls.each do |section|
|
62
|
+
if oscrc.has_section?(section)
|
63
|
+
user = oscrc[section]['user']
|
64
|
+
pass = oscrc[section]['pass']
|
65
|
+
if user && pass
|
66
|
+
return {:user => user, :password => pass}
|
67
|
+
end
|
57
68
|
end
|
58
69
|
end
|
70
|
+
raise "No valid .oscrc credentials for bnc. #{user} #{pass}"
|
59
71
|
end
|
60
72
|
|
61
73
|
def transform_api_url_hook(url, logger)
|
data/lib/bicho/query.rb
CHANGED
data/lib/bicho/version.rb
CHANGED
data/test/test_novell_plugin.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'helper')
|
2
|
+
require 'bicho/plugins/novell'
|
2
3
|
|
3
4
|
class NovellPlugin_test < Test::Unit::TestCase
|
4
5
|
|
@@ -14,4 +15,13 @@ class NovellPlugin_test < Test::Unit::TestCase
|
|
14
15
|
|
15
16
|
end
|
16
17
|
|
18
|
+
def test_oscrc_parsing
|
19
|
+
Bicho::Plugins::Novell.oscrc_path = "/space/tmp/oscrc-uwe"
|
20
|
+
plugin = Bicho::Plugins::Novell.new
|
21
|
+
credentials = Bicho::Plugins::Novell.oscrc_credentials
|
22
|
+
assert_not_nil(credentials)
|
23
|
+
assert(credentials.has_key?(:user))
|
24
|
+
assert(credentials.has_key?(:password))
|
25
|
+
end
|
26
|
+
|
17
27
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bicho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Duncan Mac-Vicar P.
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-03-09 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements: []
|
142
142
|
|
143
143
|
rubyforge_project: bicho
|
144
|
-
rubygems_version: 1.
|
144
|
+
rubygems_version: 1.5.2
|
145
145
|
signing_key:
|
146
146
|
specification_version: 3
|
147
147
|
summary: Library to access bugzilla
|