fffs 0.0.4 → 0.0.5

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.
@@ -71,12 +71,16 @@ class Directory < Hash
71
71
  end
72
72
 
73
73
  def push (file)
74
- self[file.name] = file
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
@@ -45,6 +45,12 @@ class File
45
45
  @parent << self
46
46
  end
47
47
 
48
+ def save (path)
49
+ ::File.open(path, 'wb') {|f|
50
+ f.write content
51
+ }
52
+ end
53
+
48
54
  def to_s
49
55
  @content
50
56
  end
data/lib/fffs/link.rb CHANGED
@@ -42,6 +42,12 @@ class Link
42
42
  handle.content rescue ''
43
43
  end
44
44
  end
45
+
46
+ def save (path)
47
+ require 'fileutils'
48
+
49
+ FileUtils.ln_sf path, to
50
+ end
45
51
  end
46
52
 
47
53
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
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: 2010-12-04 00:00:00 +01:00
17
+ date: 2011-04-15 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20