rfuse_symbolic_fs 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rfuse_symbolic_fs +5 -1
- data/lib/rfuse_symbolic_fs.rb +73 -74
- data/lib/rfuse_symbolic_fs_opts.rb +1 -1
- metadata +4 -4
data/bin/rfuse_symbolic_fs
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
+
|
5
|
+
rfuse_symbolic_dir = File.expand_path( File.join( File.dirname(__FILE__), '..', 'lib') )
|
6
|
+
$LOAD_PATH.unshift(rfuse_symbolic_dir) unless $LOAD_PATH.include?(rfuse_symbolic_dir)
|
7
|
+
|
4
8
|
require 'rfuse_symbolic_fs'
|
5
9
|
require 'rfuse_symbolic_fs_opts'
|
6
10
|
|
7
|
-
options
|
11
|
+
options = RFuseSymbolicFSOpts.parse(ARGV)
|
8
12
|
|
9
13
|
filesystem = RFuseSymbolicFS.new(options)
|
10
14
|
FuseFS.set_root( filesystem )
|
data/lib/rfuse_symbolic_fs.rb
CHANGED
@@ -4,85 +4,84 @@ require 'rfuse_symbolic_fs_opts'
|
|
4
4
|
|
5
5
|
|
6
6
|
class RFuseSymbolicFS
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
7
|
+
# http://rubydoc.info/gems/fusefs/0.7.0/FuseFS/MetaDir
|
8
|
+
# contents( path )
|
9
|
+
# file?( path )
|
10
|
+
# directory?( path )
|
11
|
+
# read_file( path )
|
12
|
+
# size( path )
|
13
|
+
#
|
14
|
+
# save
|
15
|
+
# touch( path )
|
16
|
+
# can_write?(path)
|
17
|
+
# write_to(path,body)
|
18
|
+
#
|
19
|
+
# can_delete?(path)
|
20
|
+
# delete( path )
|
21
|
+
#
|
22
|
+
# can_mkdir?( path )
|
23
|
+
# mkdir( path )
|
24
|
+
# can_rmdir( path )
|
25
|
+
# rmdir( path )
|
26
|
+
#
|
27
|
+
|
28
|
+
def initialize( options )
|
29
|
+
@base_dir = options.input
|
30
|
+
end
|
31
|
+
|
32
|
+
def contents(path)
|
33
|
+
n_path = File.expand_path( File.join(@base_dir, path ) )
|
34
|
+
Dir.chdir(n_path)
|
35
|
+
|
36
|
+
files = Dir.glob('*')
|
37
|
+
#Added command to OS X Finder not to index.
|
38
|
+
files << 'metadata_never_index'
|
39
|
+
|
40
|
+
return files
|
41
|
+
end
|
42
|
+
|
43
|
+
def file?(path)
|
44
|
+
#If path ends with metadata_never_index it is a file
|
45
|
+
if path =~ /metadata_never_index$/
|
46
|
+
return true
|
47
|
+
end
|
48
|
+
|
49
|
+
return (not File.directory?( File.join( @base_dir, path ) ) )
|
50
|
+
end
|
51
|
+
|
52
|
+
def directory?(path)
|
53
|
+
File.directory?( File.join( @base_dir, path ) )
|
54
|
+
end
|
55
|
+
|
56
|
+
def read_file(path)
|
57
|
+
|
58
|
+
#puts "read file #{path}"
|
59
|
+
if File.exists?( File.join( @base_dir, path ) )
|
60
|
+
return File.new( File.join( @base_dir, path ) , "r").read
|
61
|
+
end
|
62
|
+
return "ERROR, file not found\n"
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
def size(path)
|
68
|
+
if File.exists?( File.join( @base_dir, path ) )
|
69
|
+
return File.size( File.join( @base_dir, path ) )
|
70
|
+
else
|
71
|
+
return 16
|
72
|
+
end
|
73
|
+
end
|
75
74
|
end
|
76
75
|
|
77
76
|
|
78
77
|
if $0 == __FILE__
|
79
78
|
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
options = RFuseSymbolicFSOpts.parse(ARGV)
|
80
|
+
filesystem = RFuseSymbolicFS.new( options )
|
81
|
+
FuseFS.set_root( filesystem )
|
83
82
|
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
# Mount under a directory given on the command line.
|
84
|
+
FuseFS.mount_under options.mountpoint
|
85
|
+
FuseFS.run
|
87
86
|
end
|
88
87
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfuse_symbolic_fs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Morgan Prior
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-04 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|