dir-to-xml 0.5.0 → 0.6.1

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
  SHA1:
3
- metadata.gz: f5724ab2239ea5a850d8ad3c261f1f3e55ff0874
4
- data.tar.gz: 08fd250577adfefdad667a129a9faac9c9561922
3
+ metadata.gz: ed5f8bafed3e8cfa92001c6d5c54f70d7064249d
4
+ data.tar.gz: 87274e0a85304ff94b2c078e38f5cd87dedf1745
5
5
  SHA512:
6
- metadata.gz: c0edd5aeca3dcf6a13161d0adb669af15e216081ef3d16179d68ef750dbfd7c388835cb9b1fa9bf0455bcc8b00a697c1550d0bb76718353655eb7715c9142c43
7
- data.tar.gz: 797242126a3768d9e3371ccd8137318a9d1f8cfe566e1498fc76ce41dcb7f02e2921453aef273071faf6fb66362942c4a153d86896aadf9b248e9b8c361e76e8
6
+ metadata.gz: 9fb91655f1708f30ec7d4ec33d315fc9c373284d17a9635e8f4b1e1220374c579ac2f3a39787aa116803a882514eb4841da18a894c8f24cc17d563c142eb0ec9
7
+ data.tar.gz: 405474333bf1a6c012ed1f89130a027e237c82869668ba4c35bfbc9e299a47b719afd79957650905aa37c3f7c649d6f5f83525b48966f351fe6ed70693cbb736
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- �(��9���
1
+ (l�lpŋ�/��X�B6'��(z�qs���+�Ui��;%>�.��+�rI�����Ac�� �z��U��kf�T�oJb$A|�t0�n���dGw,V[�R�"R�A#����{���v�K{TA����ߍ�e�&�
data.tar.gz.sig CHANGED
Binary file
data/lib/dir-to-xml.rb CHANGED
@@ -8,8 +8,9 @@ class DirToXML
8
8
 
9
9
  attr_reader :status
10
10
 
11
- def initialize(path= '.')
11
+ def initialize(path= '.', recursive: false)
12
12
  super()
13
+
13
14
  old_path = Dir.pwd
14
15
  raise "Directory not found." unless File.exists? path
15
16
  Dir.chdir path
@@ -22,6 +23,10 @@ class DirToXML
22
23
  Dir.chdir old_path #File.expand_path('~')
23
24
  @h = self.to_dynarex.to_h
24
25
  @object = @h
26
+
27
+ @path = path
28
+ @recursive = recursive
29
+
25
30
  end
26
31
 
27
32
  def filter(pattern=/.*/)
@@ -29,8 +34,23 @@ class DirToXML
29
34
  self
30
35
  end
31
36
 
37
+ def last_modified()
38
+ a = sort_by :last_modified
39
+ a2 = a.reject {|x| x[:name] == 'dir.xml'}
40
+
41
+
42
+ lm = a2[-1]
43
+
44
+ if @recursive and lm[:type] == 'directory' then
45
+ return [lm, DirToXML.new(File.join(@path, lm[:name])).last_modified]
46
+ else
47
+ lm
48
+ end
49
+ end
50
+
32
51
  def select_by_ext(ext)
33
- @object = @h.select{|x| x[:ext][/#{ext}/]}
52
+
53
+ @object = ext != '*' ? @h.select{|x| x[:ext][/#{ext}/]} : @h
34
54
  self
35
55
  end
36
56
 
@@ -149,4 +169,4 @@ summary = "
149
169
  File.write 'dir.xml', doc.xml(pretty: true)
150
170
  [doc, "updated"]
151
171
  end
152
- end
172
+ 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.5.0
4
+ version: 0.6.1
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-27 00:00:00.000000000 Z
34
+ date: 2015-08-12 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex
@@ -42,7 +42,7 @@ dependencies:
42
42
  version: '1.5'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.5.2
45
+ version: 1.5.33
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  version: '1.5'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.5.2
55
+ version: 1.5.33
56
56
  description:
57
57
  email: james@r0bertson.co.uk
58
58
  executables: []
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.4.6
83
+ rubygems_version: 2.4.8
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Dir-to-xml saves a directory listing in the Dynarex XML format
metadata.gz.sig CHANGED
Binary file