dir-to-xml 1.2.0 → 1.2.1
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
- checksums.yaml.gz.sig +0 -0
- data/lib/dir-to-xml.rb +32 -18
- data.tar.gz.sig +0 -0
- metadata +2 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a981066889af6ae5fe3c1b95af1fe1b11847441f0e7be318f394311293bd583
|
4
|
+
data.tar.gz: 3e930b643d528dced500e2352bd778524d481feca645a51a0b79f2057161eea3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a215864766564c3e9c3fbf21665933fa2ab6c22a390472b9998a80e069188486292b94dbf596884301d7abc530190bb4ee27a7ffebbab4284999e31aa9abe623
|
7
|
+
data.tar.gz: a452a6224daab6a70a97852e6741d5ea1db20ba5f08b58a55bcff64bb0a5b55abbc974ccc20e026a65577f5ebadd8aaf52c7ccb961908df1f9acd31ed0d70a4a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/dir-to-xml.rb
CHANGED
@@ -75,7 +75,11 @@ class DirToXML
|
|
75
75
|
alias changes activity
|
76
76
|
|
77
77
|
def directories()
|
78
|
-
|
78
|
+
|
79
|
+
a = @dx.all
|
80
|
+
puts 'inside directories() a: ' + a.inspect if @debug
|
81
|
+
a.select {|x| x.type == 'directory'}.map(&:name)
|
82
|
+
|
79
83
|
end
|
80
84
|
|
81
85
|
def find_all_by_ext(s)
|
@@ -97,8 +101,9 @@ class DirToXML
|
|
97
101
|
def new_scan()
|
98
102
|
|
99
103
|
t = Time.now
|
104
|
+
puts '_new_scan() @path: ' + @path.inspect if @debug
|
100
105
|
records = scan_dir @path
|
101
|
-
puts '
|
106
|
+
puts '_new_scan() records: ' + records.inspect if @debug
|
102
107
|
|
103
108
|
a = records.map {|x| x[:name]}
|
104
109
|
|
@@ -122,32 +127,39 @@ class DirToXML
|
|
122
127
|
|
123
128
|
end
|
124
129
|
|
125
|
-
#
|
126
|
-
# compare the file date with index file last modified date
|
130
|
+
# Add any new files
|
127
131
|
#
|
128
|
-
|
132
|
+
@new_files = a - a2
|
129
133
|
|
130
|
-
|
134
|
+
if @new_files.any? then
|
135
|
+
@dx.import @new_files.map {|filename| getfile_info(filename) }
|
136
|
+
end
|
131
137
|
|
132
|
-
|
138
|
+
if (@deleted_files + @new_files).any? then
|
133
139
|
|
134
|
-
|
140
|
+
@dx.last_modified = Time.now.to_s
|
141
|
+
@dx.save
|
135
142
|
|
136
|
-
|
137
|
-
find_latest(select_records) if select_records.any?
|
143
|
+
new_scan()
|
138
144
|
|
139
|
-
|
140
|
-
#
|
141
|
-
@new_files = a - a2
|
145
|
+
else
|
142
146
|
|
143
|
-
|
147
|
+
# check for newly modified files
|
148
|
+
# compare the file date with index file last modified date
|
149
|
+
#
|
150
|
+
dtx_last_modified = Time.parse(@dx.last_modified)
|
144
151
|
|
145
|
-
|
146
|
-
|
152
|
+
select_records = records.select do |file|
|
153
|
+
|
154
|
+
file[:mtime] > dtx_last_modified or file[:type] == 'directory'
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
puts 'select_records: ' + select_records.inspect if @debug
|
147
159
|
|
160
|
+
find_latest(select_records) if select_records.any?
|
148
161
|
end
|
149
162
|
|
150
|
-
@dx.last_modified = Time.now.to_s if @deleted_files.any?
|
151
163
|
|
152
164
|
else
|
153
165
|
|
@@ -166,7 +178,7 @@ class DirToXML
|
|
166
178
|
t = Time.now
|
167
179
|
puts 'read path: ' + File.join(@path, index).inspect if @Debug
|
168
180
|
|
169
|
-
dx = DxLite.new(File.join(@path, index), autosave:
|
181
|
+
dx = DxLite.new(File.join(@path, index), autosave: false)
|
170
182
|
|
171
183
|
t2 = Time.now - t
|
172
184
|
puts ("%s read in %.2f seconds" % [@index, t2]).info if @verbose
|
@@ -186,7 +198,9 @@ class DirToXML
|
|
186
198
|
@latest_file[:path] = @path
|
187
199
|
puts ':@latest_file: ' + @latest_file.inspect if @debug
|
188
200
|
|
201
|
+
puts 'before directories()' if @debug
|
189
202
|
dir_list = directories()
|
203
|
+
puts 'dir_list: ' + dir_list.inspect if @debug
|
190
204
|
|
191
205
|
if dir_list.any? then
|
192
206
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dir-to-xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,28 +35,8 @@ cert_chain:
|
|
35
35
|
m7hEq9GAsvYejQNMhcxlvi+e70d3QiEg+2SVsBHaUGURzv0LjycCOjOaUxQA5swC
|
36
36
|
JKGINad8xoEL7XIDoO6EnBcY
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-02-
|
38
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
|
-
- !ruby/object:Gem::Dependency
|
41
|
-
name: c32
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - "~>"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0.3'
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 0.3.0
|
50
|
-
type: :runtime
|
51
|
-
prerelease: false
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - "~>"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '0.3'
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: 0.3.0
|
60
40
|
- !ruby/object:Gem::Dependency
|
61
41
|
name: dxlite
|
62
42
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|