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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bedae7ff16304641a20a9fe56eb1e6113bfe57641e6deedc05f23068303426b
4
- data.tar.gz: 7d9956ee4dee5c1893e39d95a965e1ecc28ae5bda10cfb9b61c6cb0793174675
3
+ metadata.gz: '0025088ef0df415ef00766a3bfeb9416938e236f771f2bba67a3a9527116c009'
4
+ data.tar.gz: da1493ee48cf879fa86b24c9a551c19edb6ed9d99c11df6c28592361aad97909
5
5
  SHA512:
6
- metadata.gz: 81163aa4aca58ce6e5231c951244d74f9e979558d9164883ebc3ce11069c700b4ea15da3adca85cf668d053473060a721cfd56b3dc6830d22ab307ccf37d4678
7
- data.tar.gz: c7bc8985bddaf46ca782ef9be6e84472b8f783c3edaa5477c9602975fb4b58aee8869b883582350fab613f53140bb91fd9d757354ae13d6231c127bf8c6b835d
6
+ metadata.gz: 6b9d8e75885bed1f6f102bb7b8edd608c7ff72ae0ab68aecb153785cfe734ee3c446d58f0511e48b0e4aba4c5fdc73b98a7f4fd6578054524bdfa59a98c9bf34
7
+ data.tar.gz: 9d0aa1bd573057eb89be293ef43f5dab2f0228907455c489c00a1bab7a9971a872ee4cf5919cad2ae359363de8c51597e292f90d3740299dde38f55a06c7fa6f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dgd-tools (0.1.2)
4
+ dgd-tools (0.1.4)
5
5
  nokogiri (~> 1.10.5)
6
6
 
7
7
  GEM
@@ -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
- diff << diff_between(o1, o2, o1_name: in_1, o2_name: in_2)
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? && doc.root.attribute("owner")
83
- doc.root.remove_attribute("owner")
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
@@ -1,3 +1,3 @@
1
1
  module DGD
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dgd-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Gibbs