dgd-tools 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dgd-tools/skotos_xml_obj.rb +20 -6
- data/lib/dgd-tools/version.rb +1 -1
- 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: '0025088ef0df415ef00766a3bfeb9416938e236f771f2bba67a3a9527116c009'
|
4
|
+
data.tar.gz: da1493ee48cf879fa86b24c9a551c19edb6ed9d99c11df6c28592361aad97909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b9d8e75885bed1f6f102bb7b8edd608c7ff72ae0ab68aecb153785cfe734ee3c446d58f0511e48b0e4aba4c5fdc73b98a7f4fd6578054524bdfa59a98c9bf34
|
7
|
+
data.tar.gz: 9d0aa1bd573057eb89be293ef43f5dab2f0228907455c489c00a1bab7a9971a872ee4cf5919cad2ae359363de8c51597e292f90d3740299dde38f55a06c7fa6f
|
data/Gemfile.lock
CHANGED
@@ -8,6 +8,8 @@ require "tempfile"
|
|
8
8
|
|
9
9
|
module SkotOS; end
|
10
10
|
|
11
|
+
# TODO: remove <Core:Property property="revisions"> from anywhere in the XML tree
|
12
|
+
|
11
13
|
class SkotOS::XMLObject
|
12
14
|
attr_reader :pretty
|
13
15
|
|
@@ -49,9 +51,16 @@ class SkotOS::XMLObject
|
|
49
51
|
diff
|
50
52
|
end
|
51
53
|
|
54
|
+
def self.skip_ignored_files(list)
|
55
|
+
list.select do |path|
|
56
|
+
!path[/,v$/] && # Ignore files ending in comma-v
|
57
|
+
!path[/-backup-\d+-\d+-\d+\.xml/] # Ignore files ending in -backup-[DATE].xml
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
52
61
|
def self.diff_dirs(dir1, dir2)
|
53
|
-
entries1 = Dir.glob("*", base: dir1).to_a
|
54
|
-
entries2 = Dir.glob("*", base: dir2).to_a
|
62
|
+
entries1 = skip_ignored_files(Dir.glob("*", base: dir1).to_a)
|
63
|
+
entries2 = skip_ignored_files(Dir.glob("*", base: dir2).to_a)
|
55
64
|
|
56
65
|
only_in_1 = entries1 - entries2
|
57
66
|
only_in_2 = entries2 - entries1
|
@@ -72,22 +81,27 @@ class SkotOS::XMLObject
|
|
72
81
|
else
|
73
82
|
o1 = from_file(in_1)
|
74
83
|
o2 = from_file(in_2)
|
75
|
-
|
84
|
+
this_diff = diff_between(o1, o2, o1_name: in_1, o2_name: in_2)
|
85
|
+
diff << this_diff unless this_diff.strip == ""
|
76
86
|
end
|
77
87
|
end
|
78
88
|
diff
|
79
89
|
end
|
80
90
|
|
81
91
|
def self.remove_undiffed(doc)
|
82
|
-
if doc.root && doc.root.element?
|
83
|
-
|
92
|
+
if doc.root && doc.root.element?
|
93
|
+
ignored_top_elements = ["program", "clone", "owner"]
|
94
|
+
ignored_top_elements.each do |attr|
|
95
|
+
if doc.root.attribute(attr)
|
96
|
+
doc.root.remove_attribute(attr)
|
97
|
+
end
|
98
|
+
end
|
84
99
|
end
|
85
100
|
end
|
86
101
|
|
87
102
|
def self.system_call(cmd, fail_ok: false)
|
88
103
|
f = Tempfile.new("system_call_xml_diff_")
|
89
104
|
begin
|
90
|
-
puts "Running command: #{cmd.inspect}..."
|
91
105
|
system(cmd, out: f)
|
92
106
|
unless fail_ok || $?.success?
|
93
107
|
f.rewind
|
data/lib/dgd-tools/version.rb
CHANGED