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.
@@ -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 = RFuseSymbolicFSOpts.parse(ARGV)
11
+ options = RFuseSymbolicFSOpts.parse(ARGV)
8
12
 
9
13
  filesystem = RFuseSymbolicFS.new(options)
10
14
  FuseFS.set_root( filesystem )
@@ -4,85 +4,84 @@ require 'rfuse_symbolic_fs_opts'
4
4
 
5
5
 
6
6
  class RFuseSymbolicFS
7
- # contents( path )
8
- # file?( path )
9
- # directory?( path )
10
- # read_file( path )
11
- # size( path )
12
- #
13
- # save
14
- # touch( path )
15
- # can_write?(path)
16
- # write_to(path,body)
17
- #
18
- # can_delete?(path)
19
- # delete( path )
20
- #
21
- # can_mkdir?( path )
22
- # mkdir( path )
23
- # can_rmdir( path )
24
- # rmdir( path )
25
- #
26
-
27
-
28
-
29
- def initialize( options )
30
- @base_dir = options.input
31
- end
32
-
33
- def contents(path)
34
- n_path = File.expand_path( @base_dir + path )
35
- Dir.chdir(n_path)
36
-
37
- files = Dir.glob('*')
38
- #Added command to OS X Finder not to index.
39
- files << 'metadata_never_index'
40
-
41
- return files
42
- end
43
-
44
- def file?(path)
45
- #If path ends with metadata_never_index it is a file
46
- if path =~ /metadata_never_index$/
47
- return true
48
- end
49
-
50
- return (not File.directory?( @base_dir + path ))
51
- end
52
-
53
- def directory?(path)
54
- File.directory?(@base_dir + path)
55
- end
56
-
57
- def read_file(path)
58
-
59
- #puts "read file #{path}"
60
- if File.exists?( @base_dir + path )
61
- return File.new(@base_dir + path , "r").read
62
- end
63
- return "ERROR, file not found\n"
64
-
65
- end
66
-
67
-
68
- def size(path)
69
- if File.exists?( @base_dir + path )
70
- return File.size( @base_dir + path )
71
- else
72
- return 16
73
- end
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
- options = RFuseSymbolicFSOpts.parse(ARGV)
81
- filesystem = RFuseSymbolicFS.new( options )
82
- FuseFS.set_root( filesystem )
79
+ options = RFuseSymbolicFSOpts.parse(ARGV)
80
+ filesystem = RFuseSymbolicFS.new( options )
81
+ FuseFS.set_root( filesystem )
83
82
 
84
- # Mount under a directory given on the command line.
85
- FuseFS.mount_under options.mountpoint
86
- FuseFS.run
83
+ # Mount under a directory given on the command line.
84
+ FuseFS.mount_under options.mountpoint
85
+ FuseFS.run
87
86
  end
88
87
 
@@ -9,7 +9,7 @@ class RFuseSymbolicFSOpts
9
9
  # Return a structure describing the options.
10
10
  #
11
11
  def self.parse(args)
12
- @VERSION = "0.0.2"
12
+ @VERSION = "0.0.3"
13
13
 
14
14
  # The options specified on the command line will be collected in *options*.
15
15
  # We set default values here.
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: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
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: 2010-07-28 00:00:00 +01:00
18
+ date: 2011-02-04 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency