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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4612af405a2a24d589028a583d28b3217c7c44db120ad68d015c412efe86b16
4
- data.tar.gz: 8d66e4b320b585972be52e6085186858b2fd99dbd369b3d3c0919cc0cd36afa2
3
+ metadata.gz: 0af1114575e0707f202c03b2660d623e91f34422b607bfec18e688d658a44740
4
+ data.tar.gz: bda192469bb816b363a1a9725da3c134ec40fce2a29bcb8777baa253df8e4920
5
5
  SHA512:
6
- metadata.gz: bd2821ac72de327ed54318f5d2ac63c14c184dae26181e6ff38ba455466a067de75dffd48b3749ce5b9ba03ca542d98db4ac94818e929f9e6ce86df43406a4ff
7
- data.tar.gz: 48852e32ca730dc65bc3a4363bf87eb8d365742ea20add65ec22adf97e9e80fabf59716cf1cdcea171a234bda6f3dc7dac4ecf994314e26241863b66f3957380
6
+ metadata.gz: e411adb17ec8d8b92bc1180bced2f7975a957bcb1ac811647732b18ebd402aab598349f10a2258a1b9d5a02b5acbb0e1c21ecd9b654049a37a20f51e6e2ce256
7
+ data.tar.gz: 78dfc760cd59ba6b525ee4fca05e56a7b1f8150f3fd877256234d309c7e28ce547e60430ad6bc1180786105940cb07cda02d4403092d890c125b0590875ee237
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- return if Time.parse(@dx.last_modified) >= \
49
- File.mtime(File.expand_path(path))
50
- end
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
- @dx = self.method(command).call a2
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 = DxLite.new('directory[title, file_path, last_modified, description]/file(name, ' + \
207
- 'type, ext, ctime, mtime, atime, description, owner, ' + \
208
- 'group, permissions)')
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.2
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-24 00:00:00.000000000 Z
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