dir-to-xml 1.2.1 → 1.2.3

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: 5a981066889af6ae5fe3c1b95af1fe1b11847441f0e7be318f394311293bd583
4
- data.tar.gz: 3e930b643d528dced500e2352bd778524d481feca645a51a0b79f2057161eea3
3
+ metadata.gz: d551bade9cfc68eb4cc6181db4642b56fde754f913e579318d9df92009fac23e
4
+ data.tar.gz: ab750c2c8ad808f974c6d34fe426d58e5e6c7e751dab08b5b79dcf0bbbd0617e
5
5
  SHA512:
6
- metadata.gz: a215864766564c3e9c3fbf21665933fa2ab6c22a390472b9998a80e069188486292b94dbf596884301d7abc530190bb4ee27a7ffebbab4284999e31aa9abe623
7
- data.tar.gz: a452a6224daab6a70a97852e6741d5ea1db20ba5f08b58a55bcff64bb0a5b55abbc974ccc20e026a65577f5ebadd8aaf52c7ccb961908df1f9acd31ed0d70a4a
6
+ metadata.gz: 0e6ce861e1816744e1ce701519edd3e4b5685bc36d00d2efa2b1e3bac120056095c15d547b92ae0f36a5d3ea4b25729abf8e67d5cf20b5e9976c937c7d02ce0a
7
+ data.tar.gz: 6e054d864cde8354887f403299da67c8b48abcdd240ce3fc3f643809e06edad4357e8af9698cb421657f5ff4d2b41c1b20571d6130b816bcfa1517e2bae9901c
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/dir-to-xml.rb CHANGED
@@ -74,11 +74,33 @@ class DirToXML
74
74
 
75
75
  alias changes activity
76
76
 
77
- def directories()
77
+ # Returns a list of directory names
78
+ #
79
+ # note: if recursive is true then it will return a 1-dimensional Array
80
+ # object containing all directory paths including nested directories
81
+ #
82
+ def directories(recursive: false)
78
83
 
79
84
  a = @dx.all
80
85
  puts 'inside directories() a: ' + a.inspect if @debug
81
- a.select {|x| x.type == 'directory'}.map(&:name)
86
+
87
+ if recursive then
88
+
89
+ directories.flat_map do |dir_name|
90
+
91
+ #puts 'dir_name: ' + dir_name.inspect
92
+ #puts 'path+dir: ' + File.join(@path, dir_name).inspect
93
+ dtx = DirToXML.new(File.join(@path, dir_name), verbose: false, debug: false)
94
+ list = dtx.directories(recursive: true)
95
+ r = [File.join(@path, dir_name)]
96
+ r.concat list if list.any?
97
+
98
+ r
99
+ end
100
+
101
+ else
102
+ a.select {|x| x.type == 'directory'}.map(&:name)
103
+ end
82
104
 
83
105
  end
84
106
 
@@ -107,7 +129,7 @@ class DirToXML
107
129
 
108
130
  a = records.map {|x| x[:name]}
109
131
 
110
- if FileX.exists? File.join(@path, @index) then
132
+ if FileX.exist? File.join(@path, @index) then
111
133
 
112
134
  @dx = read()
113
135
 
@@ -164,7 +186,7 @@ class DirToXML
164
186
  else
165
187
 
166
188
  @dx = new_index(records)
167
- find_latest(records)
189
+ find_latest(records) if records.any?
168
190
 
169
191
  end
170
192
 
@@ -198,6 +220,8 @@ class DirToXML
198
220
  @latest_file[:path] = @path
199
221
  puts ':@latest_file: ' + @latest_file.inspect if @debug
200
222
 
223
+ return unless @recursive
224
+
201
225
  puts 'before directories()' if @debug
202
226
  dir_list = directories()
203
227
  puts 'dir_list: ' + dir_list.inspect if @debug
@@ -208,7 +232,7 @@ class DirToXML
208
232
 
209
233
  puts 'dir: ' + dir.inspect if @debug
210
234
  dtx2 = DirToXML.new(File.join(@path, dir), index: @index,
211
- recursive: true, verbose: false, debug: @debug)
235
+ recursive: @recursive, verbose: false, debug: @debug)
212
236
  [dir, dtx2.latest_file]
213
237
 
214
238
  end.reject {|_,latest| latest.nil? }.sort_by {|_, x| x[:mtime]}.last
@@ -262,7 +286,7 @@ class DirToXML
262
286
  dx.title = 'Index of ' + @path
263
287
  dx.file_path = @path
264
288
  dx.last_modified = Time.now
265
- dx.import records.reverse
289
+ dx.import records.reverse if records.any?
266
290
  dx.save File.join(@path, @index)
267
291
 
268
292
  return dx
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.1
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,32 +10,33 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
- YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwMjEwMTcwNzMwWhcN
15
- MjMwMjEwMTcwNzMwWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
- cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCjKYHi
17
- pAa4sq7iRTV7XB75YoxA+OKNh8nqMnSNeOw3lJ3UYW4ulFKOvD+2LddRH1DD3CrP
18
- 0AYx2MI56Pu/UgtLZkze5pMf6CqLn8MCvonuSjNTj01bDi+fq8xAKu85LwG3xVP3
19
- kqMCppRwlf7wtkc8tkC6vjc+GhggwTda8z7quTtiVpy2r3JJUs4QXDTqzfKNC+la
20
- dueojDyI3m6mmaGyoT3k3LpTc0Vjg3JeiYsyWxGvK6R0JWqZiv7uwlxtzvuK/v5h
21
- 1iMhim2hB/6pFZalAddVfzvPCQiRek7nDKxPgvMDze2GIzvrpOapntu18nC1FYnO
22
- kAC8vIStaFxmYzZYMB5h8C5q2xhJ3u6uGdyhpMuwvQOkhq4jdvI8SJ04eBhQH0DI
23
- ta8OyiPQoqwegXXhBGU35/yZczB6QFswBaw7jTFcya1YKFDvXmLWOl0g6UOFnl66
24
- QXnaC/xwRBh48VGALRPCgHuSf0Ag5LP+rv52s6Fbbs5B6syj059gNLO+DKkCAwEA
25
- AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU/5KH1BIb
26
- QxZC8hteME4fAEsveW8wJ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+ yEX/NYTeFgBlQvOt45Nnf+dtnIACJMguZkWkuFXfTGcKfgZVtemirco4OJvEDVkL
35
+ LgSLSrbDBCEGQCNhEsNZpN1tpRmoG/S6Cz0ghONvyvGe3oUXg8Tjt2auOeXJ6PB0
36
+ /4mJzXKb3M5rjD/PyDzU06flVZYZVtaq0G1u/4Gwr/t1x3B6nEal/NNHvYQ8vRyN
37
+ yu/2dFC/tlJR6wcd8KB/YxGAuDYtPO7zMoU=
37
38
  -----END CERTIFICATE-----
38
- date: 2022-02-21 00:00:00.000000000 Z
39
+ date: 2023-04-02 00:00:00.000000000 Z
39
40
  dependencies:
40
41
  - !ruby/object:Gem::Dependency
41
42
  name: dxlite
@@ -46,7 +47,7 @@ dependencies:
46
47
  version: '0.6'
47
48
  - - ">="
48
49
  - !ruby/object:Gem::Version
49
- version: 0.6.0
50
+ version: 0.6.5
50
51
  type: :runtime
51
52
  prerelease: false
52
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -56,7 +57,7 @@ dependencies:
56
57
  version: '0.6'
57
58
  - - ">="
58
59
  - !ruby/object:Gem::Version
59
- version: 0.6.0
60
+ version: 0.6.5
60
61
  description:
61
62
  email: digital.robertson@gmail.com
62
63
  executables: []
@@ -83,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
84
  - !ruby/object:Gem::Version
84
85
  version: '0'
85
86
  requirements: []
86
- rubygems_version: 3.2.22
87
+ rubygems_version: 3.4.4
87
88
  signing_key:
88
89
  specification_version: 4
89
90
  summary: Dir-to-xml saves a directory listing in the Dynarex XML format
metadata.gz.sig CHANGED
Binary file