fffs 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fffs/directory.rb +16 -2
- data/lib/fffs/file.rb +6 -0
- data/lib/fffs/link.rb +6 -0
- metadata +3 -3
data/lib/fffs/directory.rb
CHANGED
@@ -71,12 +71,16 @@ class Directory < Hash
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def push (file)
|
74
|
-
self[file.name]
|
74
|
+
if self[file.name].is_a?(Directory) && file.is_a?(Directory)
|
75
|
+
self[file.name].merge(file)
|
76
|
+
else
|
77
|
+
self[file.name] = file
|
78
|
+
end
|
75
79
|
end
|
76
80
|
|
77
81
|
alias << push
|
78
82
|
|
79
|
-
def merge (dir)
|
83
|
+
def merge! (dir)
|
80
84
|
dir.each_value {|file|
|
81
85
|
self << file
|
82
86
|
}
|
@@ -88,6 +92,16 @@ class Directory < Hash
|
|
88
92
|
"#{__path}/".sub(%r{/*/}, '/')
|
89
93
|
end
|
90
94
|
|
95
|
+
def save (path)
|
96
|
+
require 'fileutils'
|
97
|
+
|
98
|
+
FileUtils.mkpath(path)
|
99
|
+
|
100
|
+
each_value {|f|
|
101
|
+
f.save("#{path}/#{f.name}")
|
102
|
+
}
|
103
|
+
end
|
104
|
+
|
91
105
|
def inspect
|
92
106
|
output = "#{self.path}\n"
|
93
107
|
|
data/lib/fffs/file.rb
CHANGED
data/lib/fffs/link.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- meh.
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-04-15 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|