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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06e0a6a5af77ff4656cf34b9abe0c9e2b483e39b
4
- data.tar.gz: c493a5b38daf25b9b37a1b87567f5ff3bc28d704
3
+ metadata.gz: 30da50a0a1fdef4b0f49ec83c0bece988dfa032b
4
+ data.tar.gz: 4bea2ee73b51dee8de463e46d4d5d18481a6d0bd
5
5
  SHA512:
6
- metadata.gz: 65e7f27ac49b10b1f4d1c06ed085461c358d794c5401e62de45ccaca036e115ca7d9a28a20cd355e07fe859c69dd1b8a7ce0cb4c17061469efb369fcf8b8667d
7
- data.tar.gz: 1adabe9c3cbeec1ee6e329ba7dbca7c0d6dcd8185e6559c6860f31caa13f02b50cd339ddb7bec577bcc2776bb53b15dc08dd99bf9067f9b3245b1b33466d9b18
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
- reg_buffer = read(s)
117
+
118
+ r = RXFHelper.read(s)
119
+ reg_buffer = r.first
120
+ raise "read file error" unless reg_buffer
116
121
 
117
- if s.strip[/^\[/] then
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 = s.split(/(?=^[^:]+$)/).map do |raw_section|
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.1.18
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