xml-registry 0.1.18 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/xml-registry.rb +14 -7
- metadata +30 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30da50a0a1fdef4b0f49ec83c0bece988dfa032b
|
4
|
+
data.tar.gz: 4bea2ee73b51dee8de463e46d4d5d18481a6d0bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f07f197eb12aaeb44c80c909299cb5a6f4f07f2c5aae95c73aca1809c9de155e0b26d0a27ce980540df94d9b88d129f8cdcb246d1791669209b3ca5ce549446
|
7
|
+
data.tar.gz: 038204172e70170be75a87c21c12bd600e65f41a203cfdd4ebf58acf8102647ad915c1b5fbc29b2fe5d6ae17c355aa06d283ca69fb4c255414dbc30b315d49c7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/xml-registry.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# file: xml-registry.rb
|
4
4
|
|
5
5
|
require 'rexle'
|
6
|
+
require 'rxfhelper'
|
6
7
|
|
7
8
|
class XMLRegistry
|
8
9
|
|
@@ -28,7 +29,8 @@ class XMLRegistry
|
|
28
29
|
# example: set_key 'app/gtd/funday', 'friday'
|
29
30
|
#
|
30
31
|
def set_key(path, value)
|
31
|
-
|
32
|
+
|
33
|
+
puts "set_key : path: %s value: %s" % [path,value]
|
32
34
|
# if the 1st element doesn't exist create it
|
33
35
|
e = path.split('/',2).first
|
34
36
|
@doc.root.add_element Rexle::Element.new(e) unless @doc.root.element e
|
@@ -112,17 +114,20 @@ class XMLRegistry
|
|
112
114
|
#reg.import s
|
113
115
|
#
|
114
116
|
def import(s)
|
115
|
-
|
117
|
+
|
118
|
+
r = RXFHelper.read(s)
|
119
|
+
reg_buffer = r.first
|
120
|
+
raise "read file error" unless reg_buffer
|
116
121
|
|
117
|
-
if
|
122
|
+
if reg_buffer.strip[/^\[/] then
|
118
123
|
|
119
124
|
reg_items = reg_buffer.gsub(/\n/,'').split(/(?=\[.[^\]]+\])/).map do |x|
|
120
125
|
[x[/^\[(.[^\]]+)\]/,1], Hash[*($').scan(/"([^"]+)"="(.[^"]*)"/).flatten]]
|
121
126
|
end
|
122
127
|
|
123
128
|
else
|
124
|
-
|
125
|
-
reg_items =
|
129
|
+
|
130
|
+
reg_items = reg_buffer.split(/(?=^[^:]+$)/).map do |raw_section|
|
126
131
|
|
127
132
|
lines = raw_section.lines.to_a
|
128
133
|
next if lines.first.strip.empty?
|
@@ -133,7 +138,7 @@ class XMLRegistry
|
|
133
138
|
reg_items.compact!
|
134
139
|
|
135
140
|
end
|
136
|
-
|
141
|
+
|
137
142
|
reg_items.each do |path, items|
|
138
143
|
items.each {|k,value| self.set_key("%s/%s" % [path,k], value)}
|
139
144
|
end
|
@@ -204,4 +209,6 @@ class XMLRegistry
|
|
204
209
|
out
|
205
210
|
end
|
206
211
|
|
207
|
-
end
|
212
|
+
end
|
213
|
+
|
214
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml-registry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -30,7 +30,35 @@ cert_chain:
|
|
30
30
|
4KclOqKpfBFvuefX+F9YSO3aO94nnzhV
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
date: 2013-08-10 00:00:00.000000000 Z
|
33
|
-
dependencies:
|
33
|
+
dependencies:
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rexle
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rxfhelper
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
34
62
|
description:
|
35
63
|
email: james@r0bertson.co.uk
|
36
64
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|