dir-to-xml 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/dir-to-xml.rb +21 -11
- metadata +1 -1
- 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: f155b43f7372db3ad7636b3c54f8369d78387d155ec4230f24b2ecf6a6b7d206
|
4
|
+
data.tar.gz: 3def96a9380e89e249275346f39ca5d6eebcbc60996e66c5d2a5786d9a250f03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ade701a7b673a6305a73f52f10ce05e828588f4d235acc747aa5adb72a7e02a4dd11ac7312f0661ef843a8df9d848943eb8ddac53c954bc4b5176b0838efcfa0
|
7
|
+
data.tar.gz: a542531fdbfe27e2621c7f0db8b034b32528f0aa284e4038c9ee1239655e419a00d9e5e82c98ab5c7e86e634e1cba56677e1186318b8e58598632f08fb8b8af6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dir-to-xml.rb
CHANGED
@@ -16,6 +16,7 @@ class DirToXML
|
|
16
16
|
@debug = debug
|
17
17
|
|
18
18
|
@dx = nil
|
19
|
+
@activity = {new: [], modified: []}
|
19
20
|
|
20
21
|
if x.is_a? DxLite then
|
21
22
|
|
@@ -41,7 +42,7 @@ class DirToXML
|
|
41
42
|
else
|
42
43
|
|
43
44
|
@dx = DxLite.new('directory[title, file_path, last_modified, ' + \
|
44
|
-
'description]/
|
45
|
+
'description]/file(name, type, ext, ctime, mtime, atime, ' + \
|
45
46
|
'description, owner, group, permissions)')
|
46
47
|
|
47
48
|
puts 'before title' if @debug
|
@@ -84,24 +85,33 @@ class DirToXML
|
|
84
85
|
puts 'nothing to do' if @debug
|
85
86
|
|
86
87
|
file = a2.max_by {|x| x[:mtime]}
|
88
|
+
puts 'file: ' + file.inspect if @debug
|
87
89
|
return if Time.parse(@dx.last_modified) >= (file[:mtime])
|
88
90
|
|
89
91
|
end
|
90
92
|
|
91
93
|
|
92
94
|
|
93
|
-
if @dx and @dx.respond_to? :last_modified
|
94
|
-
and @dx.last_modified.length > 0 then
|
95
|
+
if @dx and @dx.respond_to? :last_modified then
|
95
96
|
|
96
|
-
|
97
|
+
if @dx.last_modified.length > 0 then
|
97
98
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
99
|
+
t = Time.parse(@dx.last_modified)
|
100
|
+
|
101
|
+
# find the most recently modified cur_files
|
102
|
+
recent = a2.select {|x| x[:mtime] > t }.map {|x| x[:name]} \
|
103
|
+
- %w(dir.xml dir.json)
|
104
|
+
|
105
|
+
# is it a new file or recently modified?
|
106
|
+
new_files = recent - @dx.to_a.map {|x| x[:name]}
|
107
|
+
modified = recent - new_files
|
108
|
+
|
109
|
+
else
|
110
|
+
|
111
|
+
new_files = a2.select {|x| x[:type] == 'file'}.map {|x| x[:name]}
|
112
|
+
modified = []
|
113
|
+
|
114
|
+
end
|
105
115
|
|
106
116
|
@activity = {modified: modified, new: new_files}
|
107
117
|
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|