dir-to-xml 1.0.2 → 1.0.3
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.tar.gz.sig +0 -0
- data/lib/dir-to-xml.rb +34 -26
- metadata +8 -8
- 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: 0af1114575e0707f202c03b2660d623e91f34422b607bfec18e688d658a44740
|
4
|
+
data.tar.gz: bda192469bb816b363a1a9725da3c134ec40fce2a29bcb8777baa253df8e4920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e411adb17ec8d8b92bc1180bced2f7975a957bcb1ac811647732b18ebd402aab598349f10a2258a1b9d5a02b5acbb0e1c21ecd9b654049a37a20f51e6e2ce256
|
7
|
+
data.tar.gz: 78dfc760cd59ba6b525ee4fca05e56a7b1f8150f3fd877256234d309c7e28ce547e60430ad6bc1180786105940cb07cda02d4403092d890c125b0590875ee237
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dir-to-xml.rb
CHANGED
@@ -37,17 +37,19 @@ class DirToXML
|
|
37
37
|
if File.exists? filepath then
|
38
38
|
|
39
39
|
@dx = DxLite.new(File.join(@path, @index), debug: @debug)
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
# has the directory been modified since last time?
|
44
|
-
#
|
45
|
-
if @dx and @dx.respond_to? :last_modified and \
|
46
|
-
@dx.last_modified.length > 0 then
|
47
40
|
|
48
|
-
|
49
|
-
|
50
|
-
|
41
|
+
else
|
42
|
+
|
43
|
+
@dx = DxLite.new('directory[title, file_path, last_modified, ' + \
|
44
|
+
'description]/fi`le(name, type, ext, ctime, mtime, atime, ' + \
|
45
|
+
'description, owner, group, permissions)')
|
46
|
+
|
47
|
+
puts 'before title' if @debug
|
48
|
+
@dx.title = 'Index of ' + File.expand_path(@path)
|
49
|
+
@dx.file_path = File.expand_path(@path)
|
50
|
+
@dx.last_modified = ''
|
51
|
+
|
52
|
+
end
|
51
53
|
|
52
54
|
puts 'before Dir.glob' if @debug
|
53
55
|
|
@@ -74,6 +76,20 @@ class DirToXML
|
|
74
76
|
|
75
77
|
end
|
76
78
|
|
79
|
+
# has the directory been modified since last time?
|
80
|
+
#
|
81
|
+
if @dx and @dx.respond_to? :last_modified and \
|
82
|
+
@dx.last_modified.length > 0 then
|
83
|
+
|
84
|
+
puts 'nothing to do' if @debug
|
85
|
+
|
86
|
+
file = a2.max_by {|x| x[:mtime]}
|
87
|
+
return if Time.parse(@dx.last_modified) >= (file[:mtime])
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
|
77
93
|
if @dx and @dx.respond_to? :last_modified \
|
78
94
|
and @dx.last_modified.length > 0 then
|
79
95
|
|
@@ -94,7 +110,10 @@ class DirToXML
|
|
94
110
|
|
95
111
|
command = File.exists?(File.join(path, index)) ? :refresh : :dxify
|
96
112
|
|
97
|
-
|
113
|
+
self.method(command).call a2
|
114
|
+
puts '@dx: ' + @dx.inspect if @debug
|
115
|
+
puts '@dx.last_modified: ' + @dx.last_modified.inspect if @debug
|
116
|
+
|
98
117
|
|
99
118
|
@a = @dx.to_a
|
100
119
|
|
@@ -203,26 +222,15 @@ class DirToXML
|
|
203
222
|
|
204
223
|
def dxify(a)
|
205
224
|
|
206
|
-
dx =
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
dx.title = 'Index of ' + File.expand_path(@path)
|
211
|
-
dx.file_path = File.expand_path(@path)
|
212
|
-
dx.last_modified = Time.now.to_s
|
213
|
-
|
214
|
-
dx.import a
|
215
|
-
|
216
|
-
dx.save File.join(@path, @index)
|
217
|
-
|
218
|
-
return dx
|
225
|
+
@dx.last_modified = Time.now.to_s
|
226
|
+
@dx.import a
|
227
|
+
@dx.save File.join(@path, @index)
|
219
228
|
|
220
229
|
end
|
221
230
|
|
222
231
|
def refresh(cur_files)
|
223
232
|
|
224
|
-
puts 'inside refresh' if @debug
|
225
|
-
|
233
|
+
puts 'inside refresh' if @debug
|
226
234
|
|
227
235
|
prev_files = @dx.to_a
|
228
236
|
|
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.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,28 +35,28 @@ cert_chain:
|
|
35
35
|
YSREEphg3phQsU9LV4Dlc2Id4gB3W+//c1Ek6TFieKoVemKMkbtB1lgqsEpTCfwh
|
36
36
|
oNUg84DlSmZ2z9LKagBVAlDy
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-01-
|
38
|
+
date: 2021-01-28 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dxlite
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.3.0
|
47
44
|
- - "~>"
|
48
45
|
- !ruby/object:Gem::Version
|
49
46
|
version: '0.3'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.3.2
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 0.3.0
|
57
54
|
- - "~>"
|
58
55
|
- !ruby/object:Gem::Version
|
59
56
|
version: '0.3'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.3.2
|
60
60
|
description:
|
61
61
|
email: digital.robertson@gmail.com
|
62
62
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|