foundry 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/TODO +1 -1
- data/lib/foundry/parsers/xml.rb +1 -0
- data/lib/foundry/version.rb +1 -1
- data/spec/parsers/xml_spec.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ca6092b68a8605fd24bfb04d857ae2d0253213bca1a4c2562ca9b41f22e15ef
|
4
|
+
data.tar.gz: d720a500cc14c347f4ff71a3a51fccdffbd619df4d0654052e6b24a9ef565906
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21f6b0e03b381751975bdc82edd6b18e01f66dd0d59ff2a4111e02ad2c8a166f017956737a85b53a6f07a66c442a05e1c0702ad47898b96a28bbe2bd1389b69a
|
7
|
+
data.tar.gz: ef1ec4256f0d53545a977a5a97abb632182b1475e983efb6c98078cf1087cea73faa54fdd605f8281dbae47884a8d92429d2551074def16fee9916116eef19cc
|
data/README.md
CHANGED
@@ -117,6 +117,10 @@ Inheritance support:
|
|
117
117
|
#
|
118
118
|
# <config inherit="file1.xml"><value2>value</value2></config>
|
119
119
|
#
|
120
|
+
# === file2.json.alt (functionally equivalent to the file above) ===
|
121
|
+
#
|
122
|
+
# <config><value2>value</value2><inherit>file1.xml</inherit></config>
|
123
|
+
#
|
120
124
|
# When using the YAML parser, the file contents would be as follows:
|
121
125
|
#
|
122
126
|
# === file1.yml ===
|
data/TODO
CHANGED
@@ -1 +1 @@
|
|
1
|
-
63b761d7-11d7-11e8-9f1a-8c85909b0be6 00000000-0000-0000-0000-000000000000 jzaleski jzaleski 1518647742
|
1
|
+
63b761d7-11d7-11e8-9f1a-8c85909b0be6 00000000-0000-0000-0000-000000000000 jzaleski jzaleski 1518647742 1518657310 d Add support for additional source-file types (e.g XML)
|
data/lib/foundry/parsers/xml.rb
CHANGED
@@ -11,6 +11,7 @@ if defined?(REXML::Document)
|
|
11
11
|
result = {}
|
12
12
|
root_node.children.each { |node| result[node.name] = node.text }
|
13
13
|
inherit = root_node.attributes['inherit']
|
14
|
+
raise KeyError unless result['inherit'].nil? || inherit.nil?
|
14
15
|
result['inherit'] = inherit unless inherit.nil?
|
15
16
|
result
|
16
17
|
end
|
data/lib/foundry/version.rb
CHANGED
data/spec/parsers/xml_spec.rb
CHANGED
@@ -6,6 +6,11 @@ describe Foundry::Parsers::XML do
|
|
6
6
|
eq({ 'foo' => 'bar' })
|
7
7
|
end
|
8
8
|
|
9
|
+
it 'will raise an error if the XML inheritance value is ambiguous' do
|
10
|
+
expect { subject.parse('<config inherit="biz"><foo>bar</foo><inherit>baz</inherit></config>') }.to \
|
11
|
+
raise_error KeyError
|
12
|
+
end
|
13
|
+
|
9
14
|
it 'will raise an error if the XML is not in the correct format' do
|
10
15
|
expect { subject.parse('<foo>bar</foo>') }.to raise_error ArgumentError
|
11
16
|
end
|