Class: RFuseSymbolicFS

Inherits:
Object
  • Object
show all
Defined in:
lib/rfuse_symbolic_fs.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ RFuseSymbolicFS

rubydoc.info/gems/fusefs/0.7.0/FuseFS/MetaDir contents( path ) file?( path ) directory?( path ) read_file( path ) size( path )

save touch( path ) can_write?(path) write_to(path,body)

can_delete?(path) delete( path )

can_mkdir?( path ) mkdir( path ) can_rmdir( path ) rmdir( path )



28
29
30
# File 'lib/rfuse_symbolic_fs.rb', line 28

def initialize( options )
  @base_dir = options.input
end

Instance Method Details

#contents(path) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/rfuse_symbolic_fs.rb', line 32

def contents(path)
  n_path = File.expand_path( File.join(@base_dir, path ) )
  Dir.chdir(n_path)  

  files = Dir.glob('*')
  #Added command to OS X Finder not to index.
  files << 'metadata_never_index'

  return files
end

#directory?(path) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/rfuse_symbolic_fs.rb', line 52

def directory?(path)
  File.directory?( File.join( @base_dir, path ) )
end

#file?(path) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
46
47
48
49
50
# File 'lib/rfuse_symbolic_fs.rb', line 43

def file?(path)
  #If path ends with metadata_never_index it is a file
  if path =~ /metadata_never_index$/
    return true
  end

  return (not File.directory?( File.join( @base_dir, path ) ) )
end

#read_file(path) ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'lib/rfuse_symbolic_fs.rb', line 56

def read_file(path)

  #puts "read file #{path}"
  if File.exists?( File.join( @base_dir, path ) )
    return File.new( File.join( @base_dir, path ) , "r").read
  end
  return "ERROR, file not found\n"

end

#size(path) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/rfuse_symbolic_fs.rb', line 67

def size(path)
  if File.exists?( File.join( @base_dir, path ) )
    return File.size( File.join( @base_dir, path ) )
  else
    return 16
  end
end