dir-to-xml 0.4.3 → 0.5.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/dir-to-xml.rb +3 -40
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5724ab2239ea5a850d8ad3c261f1f3e55ff0874
|
4
|
+
data.tar.gz: 08fd250577adfefdad667a129a9faac9c9561922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0edd5aeca3dcf6a13161d0adb669af15e216081ef3d16179d68ef750dbfd7c388835cb9b1fa9bf0455bcc8b00a697c1550d0bb76718353655eb7715c9142c43
|
7
|
+
data.tar.gz: 797242126a3768d9e3371ccd8137318a9d1f8cfe566e1498fc76ce41dcb7f02e2921453aef273071faf6fb66362942c4a153d86896aadf9b248e9b8c361e76e8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dir-to-xml.rb
CHANGED
@@ -24,48 +24,11 @@ class DirToXML
|
|
24
24
|
@object = @h
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
28
|
-
@object = @h.select{|x| x[:
|
27
|
+
def filter(pattern=/.*/)
|
28
|
+
@object = @h.select {|x| x[:name] =~ pattern }
|
29
29
|
self
|
30
30
|
end
|
31
31
|
|
32
|
-
def sort_by(sym)
|
33
|
-
procs = [[:last_modified, lambda{|obj| obj\
|
34
|
-
.sort_by{|x| x[:last_modified]}}]]
|
35
|
-
proc1 = procs.assoc(sym).last
|
36
|
-
proc1.call(@object)
|
37
|
-
end
|
38
|
-
|
39
|
-
def sort_by_last_modified()
|
40
|
-
sort_by :last_modified
|
41
|
-
end
|
42
|
-
|
43
|
-
alias sort_by_lastmodified sort_by_last_modified
|
44
|
-
|
45
|
-
def to_h
|
46
|
-
@object || @h
|
47
|
-
end
|
48
|
-
|
49
|
-
class DirToXML
|
50
|
-
|
51
|
-
attr_reader :status
|
52
|
-
|
53
|
-
def initialize(path= '.')
|
54
|
-
super()
|
55
|
-
old_path = Dir.pwd
|
56
|
-
raise "Directory not found." unless File.exists? path
|
57
|
-
Dir.chdir path
|
58
|
-
|
59
|
-
a = Dir.glob("*").sort
|
60
|
-
|
61
|
-
command = a.include?('dir.xml') ? 'run' : 'new_run'
|
62
|
-
@doc, @status = self.send command, a
|
63
|
-
|
64
|
-
Dir.chdir old_path #File.expand_path('~')
|
65
|
-
@h = self.to_dynarex.to_h
|
66
|
-
@object = @h
|
67
|
-
end
|
68
|
-
|
69
32
|
def select_by_ext(ext)
|
70
33
|
@object = @h.select{|x| x[:ext][/#{ext}/]}
|
71
34
|
self
|
@@ -186,4 +149,4 @@ summary = "
|
|
186
149
|
File.write 'dir.xml', doc.xml(pretty: true)
|
187
150
|
[doc, "updated"]
|
188
151
|
end
|
189
|
-
end
|
152
|
+
end
|
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: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
iqgRYucyTfq3VLTy6wrGN2HJj8unXh4JIFjyEvR3yvcCYl6IaHxuDfgoDfBI6MeQ
|
32
32
|
Em7HctRLQorltw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-04-
|
34
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex
|
metadata.gz.sig
CHANGED
Binary file
|