dir-to-xml 0.8.2 → 0.9.0

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
  SHA1:
3
- metadata.gz: 8ab508aac678d73d04dfc280a8124444d2238186
4
- data.tar.gz: 67015e70f7e481dcbe5cd17f463f01e677402c2e
3
+ metadata.gz: 6ba9da801c35ecbddd2ed5fd3aace787d067fe2b
4
+ data.tar.gz: 3afedd7094acbfa9f240bd74d325338439c5d1a9
5
5
  SHA512:
6
- metadata.gz: 94d5d3f5454277ad5a8cc6a2c5e8a78afa185d2d13ae4b7d4eaa33486bab7649a1997005337e6c79528c7984659afd2961650da3eecb975b185a75af23e3305e
7
- data.tar.gz: be19cb2cda2265b8ef25f206710fbf94f5f1b24cc15bef797eeec49dbae68c4e0e2a990f60267f6eeb8fec5e02cc7ca2739093cc7751b2792966ad6a01033047
6
+ metadata.gz: 3992e373581f366d0028663f7b58e78d9cfd45e96be93ab9e37e03862c18555c21cd322646aaf7fb75df095969a2dd088590d9ac635c44b0fe63fc4ec47e0d9e
7
+ data.tar.gz: 954b6e2a23e3233efb6701e222598ca956cb84939462b1f003b44f0b481bff23d4799cdece9da003127e645c009acda7c8ff421184c709a4192c0022b6450e6f
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/dir-to-xml.rb CHANGED
@@ -10,7 +10,7 @@ class DirToXML
10
10
  attr_reader :dx
11
11
 
12
12
  def initialize(x= '.', recursive: false, index: 'dir.xml')
13
-
13
+
14
14
  super()
15
15
 
16
16
  if x.is_a? Dynarex then
@@ -31,7 +31,7 @@ class DirToXML
31
31
  a = Dir.glob(File.join(path, "*")).map{|x| File.basename(x) }.sort
32
32
 
33
33
  a.delete index
34
-
34
+
35
35
  a2 = a.inject([]) do |r, filename|
36
36
 
37
37
  x = File.join(path, filename)
@@ -52,11 +52,19 @@ class DirToXML
52
52
  end
53
53
 
54
54
  command = File.exists?(File.join(path, index)) ? :refresh : :dxify
55
-
55
+
56
56
  @dx = self.method(command).call a2
57
57
 
58
58
  @a = @dx.to_a
59
59
  @object = @a
60
+
61
+ if recursive then
62
+
63
+ self.filter_by(type: :directory).to_a.each do |x|
64
+ path2 = File.join(path, x[:name])
65
+ dtx = DirToXML.new(path2, recursive: true)
66
+ end
67
+ end
60
68
 
61
69
  end
62
70
 
@@ -83,7 +91,7 @@ class DirToXML
83
91
  alias find_by_file find_by_filename
84
92
 
85
93
  def last_modified(ext=nil)
86
-
94
+
87
95
  if ext and ext != '*' then
88
96
  @object = @a.select{|x| x[:ext][/#{ext}/] or x[:type] == 'directory'}
89
97
  end
@@ -147,8 +155,8 @@ class DirToXML
147
155
  'type, ext, ctime, mtime, atime, description, owner, ' + \
148
156
  'group, permissions)', json_out: false)
149
157
 
150
- dx.title = 'Index of ' + File.basename(Dir.pwd)
151
- dx.file_path = Dir.pwd
158
+ dx.title = 'Index of ' + @path
159
+ dx.file_path = @path
152
160
 
153
161
  dx.import a
154
162
 
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.8.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  KsWUx1RJXP2nrd/DuPwuyaNM0fcsnnqFnbAO7RjbYXWS96dGA0WVmxdO7PcMnJ9K
32
32
  PneSyA3VrnMuNQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2017-01-02 00:00:00.000000000 Z
34
+ date: 2017-06-11 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.7'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.7.17
45
+ version: 1.7.22
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.7'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.7.17
55
+ version: 1.7.22
56
56
  description:
57
57
  email: james@jamesrobertson.eu
58
58
  executables: []
metadata.gz.sig CHANGED
Binary file