rfusefs 1.0.1.RC0 → 1.0.1.RC1
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.
- data/lib/fuse/fusedir.rb +14 -2
- data/lib/fuse/rfusefs-fuse.rb +1 -1
- data/lib/fusefs/pathmapper.rb +24 -12
- data/lib/rfusefs/version.rb +1 -1
- data/rfusefs.gemspec +1 -1
- data/spec/rfusefs_spec.rb +0 -2
- metadata +4 -7
data/lib/fuse/fusedir.rb
CHANGED
@@ -123,6 +123,7 @@ module FuseFS
|
|
123
123
|
|
124
124
|
# Write the contents of str to file at path
|
125
125
|
# @abstract FuseFS api
|
126
|
+
# @return [void]
|
126
127
|
def write_to(path,str);end
|
127
128
|
|
128
129
|
# @abstract FuseFS api
|
@@ -131,6 +132,7 @@ module FuseFS
|
|
131
132
|
|
132
133
|
# Delete the file at path
|
133
134
|
# @abstract FuseFS api
|
135
|
+
# @return [void]
|
134
136
|
def delete(path);end
|
135
137
|
|
136
138
|
# @abstract FuseFS api
|
@@ -139,6 +141,7 @@ module FuseFS
|
|
139
141
|
|
140
142
|
# Make a directory at path
|
141
143
|
# @abstract FuseFS api
|
144
|
+
# @return [void]
|
142
145
|
def mkdir(path);end
|
143
146
|
|
144
147
|
# @abstract FuseFS api
|
@@ -147,15 +150,17 @@ module FuseFS
|
|
147
150
|
|
148
151
|
# Remove the directory at path
|
149
152
|
# @abstract FuseFS api
|
153
|
+
# @return [void]
|
150
154
|
def rmdir(path);end
|
151
155
|
|
152
156
|
# Neat toy. Called when a file is touched or has its timestamp explicitly modified
|
153
157
|
# @abstract FuseFS api
|
158
|
+
# @return [void]
|
154
159
|
def touch(path,modtime);end
|
155
160
|
|
156
161
|
# Move a file or directory.
|
157
162
|
# @abstract FuseFS api
|
158
|
-
# @return [
|
163
|
+
# @return [Boolean] true to indicate the rename has been handled,
|
159
164
|
# otherwise will fallback to copy/delete
|
160
165
|
def rename(from_path,to_path);end
|
161
166
|
|
@@ -163,7 +168,8 @@ module FuseFS
|
|
163
168
|
# @abstract FuseFS api
|
164
169
|
# @param mode [String] "r","w" or "rw", with "a" if file is opened for append
|
165
170
|
# @param rfusefs [Boolean] will be "true" if RFuseFS extensions are available
|
166
|
-
# @return [
|
171
|
+
# @return [nil] to indicate raw operations are not implemented
|
172
|
+
# @return [Object] a filehandle
|
167
173
|
# Under RFuseFS this object will be passed back in to the other raw
|
168
174
|
# methods as the optional parameter _raw_
|
169
175
|
#
|
@@ -177,6 +183,7 @@ module FuseFS
|
|
177
183
|
# This method can also be invoked (without raw) outside of an open file context. See
|
178
184
|
# FUSE documentation on truncate() vs ftruncate()
|
179
185
|
# @abstract FuseFS api
|
186
|
+
# @return [void]
|
180
187
|
def raw_truncate(path,off,raw=nil);end
|
181
188
|
|
182
189
|
# Read _sz_ bytes from file at path (or filehandle raw) starting at offset off
|
@@ -186,14 +193,17 @@ module FuseFS
|
|
186
193
|
# @param [Fixnum] size
|
187
194
|
# @param [Object] raw the filehandle returned by {#raw_open}
|
188
195
|
# @abstract FuseFS api
|
196
|
+
# @return [void]
|
189
197
|
def raw_read(path,offset,size,raw=nil);end
|
190
198
|
|
191
199
|
# Write _sz_ bytes from file at path (or filehandle raw) starting at offset off
|
192
200
|
# @abstract FuseFS api
|
201
|
+
# @return [void]
|
193
202
|
def raw_write(path,off,sz,buf,raw=nil);end
|
194
203
|
|
195
204
|
# Close the file previously opened at path (or filehandle raw)
|
196
205
|
# @abstract FuseFS api
|
206
|
+
# @return [void]
|
197
207
|
def raw_close(path,raw=nil);end
|
198
208
|
|
199
209
|
# RFuseFS extension.
|
@@ -205,10 +215,12 @@ module FuseFS
|
|
205
215
|
|
206
216
|
# RFuseFS extension.
|
207
217
|
# Called when the filesystem is mounted
|
218
|
+
# @return [void]
|
208
219
|
def mounted();end
|
209
220
|
|
210
221
|
# RFuseFS extension.
|
211
222
|
# Called when the filesystem is unmounted
|
223
|
+
# @return [void]
|
212
224
|
def unmounted();end
|
213
225
|
|
214
226
|
end
|
data/lib/fuse/rfusefs-fuse.rb
CHANGED
data/lib/fusefs/pathmapper.rb
CHANGED
@@ -30,9 +30,15 @@ module FuseFS
|
|
30
30
|
|
31
31
|
# @!visibility private
|
32
32
|
def init_file(real_path,options)
|
33
|
-
@options
|
33
|
+
@options.merge!(options)
|
34
34
|
@real_path = real_path
|
35
35
|
@files = nil
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
39
|
+
def init_dir(options)
|
40
|
+
@options.merge!(options)
|
41
|
+
self
|
36
42
|
end
|
37
43
|
|
38
44
|
# @return [Boolean] true if node represents a file, otherwise false
|
@@ -147,19 +153,10 @@ module FuseFS
|
|
147
153
|
# @return [MNode]
|
148
154
|
# a node representing the mapped path. See {#node}
|
149
155
|
def map_file(real_path,new_path,options = {})
|
150
|
-
|
151
|
-
components = new_path.to_s.scan(/[^\/]+/)
|
152
|
-
|
153
|
-
#create a hash of hashes to represent our directory structure
|
154
|
-
new_file = components.inject(@root) { |parent_dir, file|
|
155
|
-
parent_dir.files[file] ||= MNode.new(parent_dir)
|
156
|
-
}
|
157
|
-
new_file.init_file(real_path,options)
|
158
|
-
|
159
|
-
return new_file
|
156
|
+
make_node(new_path).init_file(real_path,options)
|
160
157
|
end
|
161
158
|
alias :mapFile :map_file
|
162
|
-
|
159
|
+
|
163
160
|
# Retrieve in memory node for a mapped path
|
164
161
|
#
|
165
162
|
# @param [String] path
|
@@ -224,6 +221,13 @@ module FuseFS
|
|
224
221
|
@allow_write && file?(path)
|
225
222
|
end
|
226
223
|
|
224
|
+
# Note we don't impleemnt can_mkdir? so this can
|
225
|
+
# only be called by code. Really only useful to
|
226
|
+
# create empty directories
|
227
|
+
def mkdir(path,options = {})
|
228
|
+
make_node(path).init_dir(options)
|
229
|
+
end
|
230
|
+
|
227
231
|
# @!visibility private
|
228
232
|
def write_to(path,contents)
|
229
233
|
File.open(unmap(path),"w") do |f|
|
@@ -306,6 +310,14 @@ module FuseFS
|
|
306
310
|
end
|
307
311
|
|
308
312
|
private
|
313
|
+
|
314
|
+
def make_node(path)
|
315
|
+
#split path into components
|
316
|
+
components = path.to_s.scan(/[^\/]+/)
|
317
|
+
components.inject(@root) { |parent_dir, file|
|
318
|
+
parent_dir.files[file] ||= MNode.new(parent_dir)
|
319
|
+
}
|
320
|
+
end
|
309
321
|
|
310
322
|
def recursive_cleanup(dir_node,&block)
|
311
323
|
dir_node.files.delete_if do |path,child|
|
data/lib/rfusefs/version.rb
CHANGED
data/rfusefs.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.has_rdoc = 'yard'
|
21
21
|
s_extra_rdoc_files = 'History.rdoc'
|
22
22
|
|
23
|
-
s.add_dependency("rfuse", ">= 1.0.
|
23
|
+
s.add_dependency("rfuse", ">= 1.0.4RC1")
|
24
24
|
s.add_development_dependency("rake")
|
25
25
|
s.add_development_dependency("rspec")
|
26
26
|
s.add_development_dependency("yard")
|
data/spec/rfusefs_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfusefs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.1.
|
4
|
+
version: 1.0.1.RC1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rfuse
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.0.
|
21
|
+
version: 1.0.4RC1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.0.
|
29
|
+
version: 1.0.4RC1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,9 +175,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
175
|
- - ! '>='
|
176
176
|
- !ruby/object:Gem::Version
|
177
177
|
version: '0'
|
178
|
-
segments:
|
179
|
-
- 0
|
180
|
-
hash: -2524811135440594792
|
181
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
179
|
none: false
|
183
180
|
requirements:
|