Skip to content

Commit ef447a7

Browse files
author
zappy-shu
committed
removing unnecessary puts
1 parent ceb54c4 commit ef447a7

File tree

8 files changed

+18
-101
lines changed

8 files changed

+18
-101
lines changed

lib/puppet_x/transforms/xdt_transform_insert_after.rb

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ def transform(source_node, transform_node)
1717

1818
xpath = @transform_arguments[0]
1919
insert_after_nodes = source_node.xpath(@transform_arguments[0])
20-
puts insert_after_nodes
2120
if insert_after_nodes.length == 0
2221
warn "Cannot find xpath '#{xpath}'"
2322
return

lib/puppet_x/xdt_transformer.rb

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ def initialize(source_doc, transform_doc)
88
@source_doc = source_doc
99
@transform_doc = transform_doc
1010
@doc_to_transform = source_doc.clone
11-
#puts @doc_to_transform
1211

1312
@xdt_namespace = XdtNamespace.new
1413
@locator_factory = XdtLocatorFactory.new

spec/acceptance/puppet_x/xdt_transformer_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ def compare_elements(expected, actual)
2626
expect(actual.name).to eql(expected.name)
2727
compare_namespaces(expected.namespace, actual.namespace)
2828
compare_attributes(expected, actual)
29-
3029
expect(actual.elements.length).to eql(expected.elements.length)
31-
expected.elements.each_with_index do |expected_child, i|
30+
expected.elements.each_with_index do |expected_child, i|
3231
compare_elements(expected_child, actual.elements[i])
3332
end
3433
end
@@ -41,6 +40,7 @@ def compare_elements(expected, actual)
4140
transform_doc = Nokogiri::XML(File.read("#{Dir.pwd}/spec/resources/transform_only/transform.xml"))
4241
expected_doc = Nokogiri::XML(File.read("#{Dir.pwd}/spec/resources/transform_only/expected.xml"))
4342
transformed_doc = XdtTransformer.new(source_doc, transform_doc).transform
43+
4444
File.write("#{Dir.pwd}/spec/resources/transform_only/.temp.actual.xml", transformed_doc.to_s)
4545
compare_elements(expected_doc.root, transformed_doc.root)
4646
end

spec/resources/expected.xml

-28
This file was deleted.

spec/resources/source.xml

-29
This file was deleted.

spec/resources/transform.xml

-26
This file was deleted.
+11-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1+
<?xml version="1.0"?>
12
<root>
2-
<insertafter a="aaa" b="bbb" />
3-
<insertafter_1 a="aaaa" c="cccc" />
4-
<insertbefore_2 a="aaaa" c="cccc" />
5-
<insertbefore a="aaa" b="bbb" />
6-
<removeattributes />
3+
<insertafter a="aaa" b="bbb"/>
4+
<insertafter_1 a="aaaa" c="cccc"/>
5+
<insertbefore_2 a="aaaa" c="cccc"/>
6+
<insertbefore a="aaa" b="bbb"/>
7+
<removeattributes/>
78
<replace a="aaaa" c="cccc">
8-
<replace_1 a="aaaa" c="cccc" />
9-
<replace_3 />
9+
<replace_1 a="aaaa" c="cccc"/>
10+
<replace_3/>
1011
</replace>
1112
<setattributes a="aaaa" b="bbb" c="cccc">
12-
<setattributes_1 />
13+
<setattributes_1/>
1314
</setattributes>
1415
<setallattributes a="aaaa" b="bbb" c="cccc">
15-
<setallattributes_1 />
16+
<setallattributes_1/>
1617
</setallattributes>
17-
<insert a="aaaa" c="cccc" />
18+
<insert a="aaaa" c="cccc"/>
1819
</root>
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
<?xml version="1.0"?>
12
<root>
23
<a:parent_with_prefix xmlns:a="http://prefix_namespace/">
3-
<a:child_with_prefix b="aaaa" />
4-
<child_without_prefix b="bbbb" />
4+
<a:child_with_prefix b="aaaa"/>
5+
<child_without_prefix b="bbbb"/>
56
</a:parent_with_prefix>
67
<parent_with_default_namespace xmlns="http://default_namespace/">
7-
<child_with_default_namespace a="aaaa" />
8+
<child_with_default_namespace a="aaaa"/>
89
</parent_with_default_namespace>
910
<parent_without_namespace>
10-
<child_without_namespace a="aaaa" />
11+
<child_without_namespace a="aaaa"/>
1112
</parent_without_namespace>
1213
</root>

0 commit comments

Comments
 (0)