dir-to-xml 0.9.1 → 1.0.0
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -2
- data/lib/dir-to-xml.rb +31 -16
- metadata +38 -34
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d6496a0f8c9d61c424059f610d41ec4694af6b0978becff48d288fa69f6e92a1
|
4
|
+
data.tar.gz: 727f869e42d65809b44ae09fa8047d8489b861030545dfc4697823bf0803f7f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66b044181149d1560fe343c4de959667475322503ac124a522b33a2b6ad8625b2325d7c949ec1dca2adc01c0fc03413d8b273b35ae973297afec99cb9bb95beb
|
7
|
+
data.tar.gz: 2e04fe70291f883a0c165baa5dd4337841682f34888d36a3a57763e4b1867d1746650ae2375a525eece11c576b75bdbd5503b21b263be691b5f9e7384e241840
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
�
|
1
|
+
<������H����?v:w��7v��^܇|�p
|
2
|
+
0�7z�bݹ�[w�m*��LO�绝�x_�������V�զ@q�j��k��s�!��\�������������z0
|
3
|
+
w7+=]$�UlBe&�7���N7D�Ѷ�l�����=y�L��5´՚�WNU��a��Z�}a��hH3+��TJTJ{�t�>�à�] :U=d�e��LČ�Boq�����`��/��2.Rш{:'ƣ�]�!7���u���z�1ۻ�� ��I�A1~���՜*]�M�?0�@��ڕ��jA=xy�K��VV�X��E��ľ�o-�⯿��,�m��g��r
|
data/lib/dir-to-xml.rb
CHANGED
@@ -2,18 +2,20 @@
|
|
2
2
|
|
3
3
|
# file: dir-to-xml.rb
|
4
4
|
|
5
|
-
require '
|
5
|
+
require 'dxlite'
|
6
6
|
|
7
7
|
|
8
8
|
class DirToXML
|
9
9
|
|
10
10
|
attr_reader :dx
|
11
11
|
|
12
|
-
def initialize(x= '.', recursive: false, index: 'dir.xml')
|
13
|
-
|
12
|
+
def initialize(x= '.', recursive: false, index: 'dir.xml', debug: false)
|
13
|
+
|
14
14
|
super()
|
15
15
|
|
16
|
-
|
16
|
+
@debug = debug
|
17
|
+
|
18
|
+
if x.is_a? DxLite then
|
17
19
|
|
18
20
|
@dx = x
|
19
21
|
@a = @dx.to_a
|
@@ -74,15 +76,19 @@ class DirToXML
|
|
74
76
|
@dx.filter &blk
|
75
77
|
end
|
76
78
|
|
77
|
-
def filter_by(pattern=/.*/, type: nil)
|
79
|
+
def filter_by(pattern=/.*/, type: nil, ext: nil)
|
78
80
|
|
79
81
|
@object = @a.select do |x|
|
80
82
|
|
81
83
|
pattern_match = x[:name] =~ pattern
|
84
|
+
|
82
85
|
type_match = type ? x[:type] == type.to_s : true
|
86
|
+
ext_match = ext ? x[:ext] == ext.to_s : true
|
87
|
+
|
88
|
+
pattern_match and type_match and ext_match
|
83
89
|
|
84
90
|
end
|
85
|
-
|
91
|
+
|
86
92
|
self
|
87
93
|
end
|
88
94
|
|
@@ -113,12 +119,15 @@ class DirToXML
|
|
113
119
|
@dx.save File.join(@path, @index)
|
114
120
|
end
|
115
121
|
|
116
|
-
def select_by_ext(ext)
|
122
|
+
def select_by_ext(ext, &blk)
|
123
|
+
|
124
|
+
@object = ext != '*' ? @a.select{|x| x[:ext][/#{ext}$/]} : @a
|
125
|
+
return if @object.empty?
|
117
126
|
|
118
|
-
|
119
|
-
dx = Dynarex.new json_out: false
|
127
|
+
dx = DxLite.new
|
120
128
|
dx.import @object
|
121
|
-
DirToXML.new(dx)
|
129
|
+
dtx = DirToXML.new(dx)
|
130
|
+
block_given? ? dtx.dx.all.map(&:name).each(&blk) : dtx
|
122
131
|
end
|
123
132
|
|
124
133
|
def sort_by(sym)
|
@@ -149,16 +158,18 @@ class DirToXML
|
|
149
158
|
@dx.clone
|
150
159
|
end
|
151
160
|
|
161
|
+
alias to_dx to_dynarex
|
162
|
+
|
152
163
|
private
|
153
164
|
|
154
165
|
def dxify(a)
|
155
166
|
|
156
|
-
dx =
|
167
|
+
dx = DxLite.new('directory[title, file_path, description]/file(name, ' + \
|
157
168
|
'type, ext, ctime, mtime, atime, description, owner, ' + \
|
158
|
-
'group, permissions)'
|
169
|
+
'group, permissions)')
|
159
170
|
|
160
|
-
dx.title = 'Index of ' + @path
|
161
|
-
dx.file_path = @path
|
171
|
+
dx.title = 'Index of ' + File.expand_path(@path)
|
172
|
+
dx.file_path = File.expand_path(@path)
|
162
173
|
|
163
174
|
dx.import a
|
164
175
|
|
@@ -170,14 +181,18 @@ class DirToXML
|
|
170
181
|
|
171
182
|
def refresh(cur_files)
|
172
183
|
|
173
|
-
|
184
|
+
puts 'inside refresh' if @debug
|
185
|
+
dx = DxLite.new(File.join(@path, @index), debug: @debug)
|
174
186
|
|
175
187
|
prev_files = dx.to_a
|
188
|
+
|
189
|
+
#puts 'prev_files: ' + prev_files.inspect
|
190
|
+
#puts 'cur_files: ' + cur_files.inspect
|
176
191
|
|
177
192
|
cur_files.each do |x|
|
178
193
|
|
179
194
|
file = prev_files.find {|item| item[:name] == x[:name] }
|
180
|
-
|
195
|
+
#puts 'found : ' + file.inspect if @debug
|
181
196
|
x[:description] = file[:description] if file and file[:description]
|
182
197
|
end
|
183
198
|
|
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: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,51 +10,55 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
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GWHQFECAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUEmUqvmku
|
26
|
+
azMk41rHySinmAUmae8wJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAUyL0Sh3Ld6sK0fldg057McECcaOIyB/nKJApz1er
|
29
|
+
ET9qYthBvhpcaNNo19NFuf9W9UyaE6RI9Eb07DvGYyVP/b0yTrIKyzXzSAwFmrek
|
30
|
+
3VUVAhdqOIrIrf16Zpm4NoOGTOst+6sXZ9KQ52DPPwxdLbRCL7HkUFBMIVf2x2LV
|
31
|
+
XflA8IOlSUPH2vmHJnE0yfs7Lzd5+xYpKeOzQSHo0p+SBDzIim3mOZ3ryf4IZQhv
|
32
|
+
wh0fYGJ2iC/w3rPA78Awm6FNPlGCPjgPIz4mliMicRI/sZmFQvn8+2HYWEzDDOO8
|
33
|
+
zYvUB7rkjDGXYqN1Ft3N6EOuNworOFjUlcPrDFCQHf4UgPjD6Z8WbYkI9c7LWtjc
|
34
|
+
HJCyl/PVyS0Srbl8IPn7JsgUCS7S02KOnVzukQ7PTc1wBlAZ4mNb7N9EOp90GP9a
|
35
|
+
YSREEphg3phQsU9LV4Dlc2Id4gB3W+//c1Ek6TFieKoVemKMkbtB1lgqsEpTCfwh
|
36
|
+
oNUg84DlSmZ2z9LKagBVAlDy
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2021-01-23 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
41
|
+
name: dxlite
|
38
42
|
requirement: !ruby/object:Gem::Requirement
|
39
43
|
requirements:
|
40
|
-
- - "~>"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '1.7'
|
43
44
|
- - ">="
|
44
45
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
46
|
+
version: 0.3.0
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.3'
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
49
53
|
requirements:
|
50
|
-
- - "~>"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '1.7'
|
53
54
|
- - ">="
|
54
55
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
56
|
+
version: 0.3.0
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.3'
|
56
60
|
description:
|
57
|
-
email:
|
61
|
+
email: digital.robertson@gmail.com
|
58
62
|
executables: []
|
59
63
|
extensions: []
|
60
64
|
extra_rdoc_files: []
|
@@ -72,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
76
|
requirements:
|
73
77
|
- - ">="
|
74
78
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.
|
79
|
+
version: 2.5.3
|
76
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
81
|
requirements:
|
78
82
|
- - ">="
|
@@ -80,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
84
|
version: '0'
|
81
85
|
requirements: []
|
82
86
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
87
|
+
rubygems_version: 2.7.10
|
84
88
|
signing_key:
|
85
89
|
specification_version: 4
|
86
90
|
summary: Dir-to-xml saves a directory listing in the Dynarex XML format
|
metadata.gz.sig
CHANGED
Binary file
|