diffxml 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/README.md +15 -3
- data/diffxml.gemspec +2 -2
- data/lib/diffXML/utils.rb +0 -0
- data/lib/{diffXML/diffxml.rb → diffxml.rb} +5 -1
- data/rspec/diffXML_spec.rb +7 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d871e64db84a5cc14093173aca4a62d5896880c6
|
4
|
+
data.tar.gz: eebd239d3d555f4b181531258c6d79bc4fbe6683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a258ae04d23b3fdc976a7ee0c57bab1093a4b72bba2f2a4c137461bb3c6a4f4d94efd2f30ca4051f9b533fcb587a8bd329216a2a06b7bc15cb9689eebbf11e5f
|
7
|
+
data.tar.gz: e265b9a461d3390b818263176e24cdc727f49520969832343e1c4076a0ecd1be284beb7f84b0c1969d78275daeccddd8969942c48c57efc79c66b0093a573eaf
|
data/.DS_Store
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -23,6 +23,11 @@ Or install it yourself as:
|
|
23
23
|
$ gem install diffxml
|
24
24
|
|
25
25
|
## Usage
|
26
|
+
Require the gem with:
|
27
|
+
```ruby
|
28
|
+
require 'DiffXML'
|
29
|
+
```
|
30
|
+
This will be fixed in an update to allow a proper require
|
26
31
|
|
27
32
|
Pass two xml documents to the gem using
|
28
33
|
```ruby
|
@@ -31,10 +36,17 @@ DiffXML.compareXML(doc1, doc2)
|
|
31
36
|
the returned value will be an array with the XPaths of all nodes that were not matched.
|
32
37
|
|
33
38
|
## To Do
|
34
|
-
Plans to return the values of both nodes that are at the XPath in the array, as well as the XPath location are in the works.
|
35
|
-
General upkeep and a more rigorous test set are also planned.
|
39
|
+
* Plans to return the values of both nodes that are at the XPath in the array, as well as the XPath location are in the works.
|
40
|
+
* General upkeep and a more rigorous test set are also planned.
|
41
|
+
* RDoc implementation for documentation.
|
42
|
+
* optimize searches
|
43
|
+
* Add ignore capabilities for XPaths
|
44
|
+
* Refactor Utility methods into seperate file
|
45
|
+
|
46
|
+
## Known Issues
|
47
|
+
* With large XML documents, specifically with tested documents over 1500 elements, but possibly fewer, the gem will reach a point where it cannot allocate memory.
|
36
48
|
|
37
49
|
## Contributing
|
38
50
|
|
39
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/pbubnar/
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/pbubnar/diffxml.
|
40
52
|
|
data/diffxml.gemspec
CHANGED
@@ -4,13 +4,13 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "diffxml"
|
7
|
-
spec.version = '0.1.
|
7
|
+
spec.version = '0.1.2'
|
8
8
|
spec.authors = ["Jake Bubnar"]
|
9
9
|
spec.email = ["jake@pjbapps.com"]
|
10
10
|
spec.licenses = ["MIT"]
|
11
11
|
spec.summary = 'A simple xml comparison tool to get a list of diffs between two files passed to it'
|
12
12
|
spec.description = 'Goes through each child to find the XPaths of each final child, and compares them to the path in the second file'
|
13
|
-
spec.homepage = 'https://github.com/pbubnar/
|
13
|
+
spec.homepage = 'https://github.com/pbubnar/diff-xml'
|
14
14
|
|
15
15
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
16
16
|
# delete this section to allow pushing this gem to any host.
|
File without changes
|
@@ -15,7 +15,11 @@ module DiffXML
|
|
15
15
|
if node.parent.name.eql? 'document'
|
16
16
|
return path
|
17
17
|
else
|
18
|
-
|
18
|
+
if path.nil?
|
19
|
+
getPath(node, node.name)
|
20
|
+
else
|
21
|
+
getPath(node.parent, "#{node.parent.name}/#{path}")
|
22
|
+
end
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
data/rspec/diffXML_spec.rb
CHANGED
@@ -14,13 +14,18 @@ describe DiffXML do
|
|
14
14
|
|
15
15
|
it 'should return an XPath for a given node' do
|
16
16
|
node = xml1.element_children[0].element_children[2].element_children[0].element_children[0]
|
17
|
-
expect(DiffXML.getPath(node, node.name)).to eql '
|
17
|
+
expect(DiffXML.getPath(node, node.name)).to eql 'doc/third/firstthird/finalChild'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return an XPath for a given node when no name is passed in' do
|
21
|
+
node = xml1.element_children[0].element_children[2].element_children[0].element_children[0]
|
22
|
+
expect(DiffXML.getPath(node)).to eql 'doc/third/firstthird/finalChild'
|
18
23
|
end
|
19
24
|
|
20
25
|
it 'should Collect all XPaths of the children into an array' do
|
21
26
|
DiffXML.collectXPaths(xml1)
|
22
27
|
expect(DiffXML.getXPathArray.size).to be 3
|
23
|
-
expect(DiffXML.getXPathArray).to eql %w[
|
28
|
+
expect(DiffXML.getXPathArray).to eql %w[doc/first doc/second doc/third/firstthird/finalChild]
|
24
29
|
end
|
25
30
|
|
26
31
|
it 'should retrieve and compare a node from a second document using a Path' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffxml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Bubnar
|
@@ -93,9 +93,10 @@ files:
|
|
93
93
|
- README.md
|
94
94
|
- Rakefile
|
95
95
|
- diffxml.gemspec
|
96
|
-
- lib/diffXML/
|
96
|
+
- lib/diffXML/utils.rb
|
97
|
+
- lib/diffxml.rb
|
97
98
|
- rspec/diffXML_spec.rb
|
98
|
-
homepage: https://github.com/pbubnar/
|
99
|
+
homepage: https://github.com/pbubnar/diff-xml
|
99
100
|
licenses:
|
100
101
|
- MIT
|
101
102
|
metadata: {}
|