rfusefs 1.0.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- #No hidden files (except for .gitignore)
2
- .*
3
- !.gitignore
4
- !.travis.yml
5
- #Files generated by rake
6
- doc
7
- pkg
8
- #Jedit stupid default backup settings
9
- *'`'
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "1.8.7"
4
- - "1.9.3"
5
- - "2.0.0"
6
- before_install:
7
- - sudo apt-get update -qq
8
- - sudo apt-get install -qq libfuse-dev
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in rfusefs.gemspec
4
- gemspec
@@ -1,28 +0,0 @@
1
- === 1.0.1 / 2013-12-19
2
-
3
- * Add FuseFS.main to create pretty usage messages
4
-
5
- * Support extended attributes in filesystems
6
-
7
- * Updates and cleanup of PathMapperFS
8
-
9
- * Provide SqliteMapperFS
10
-
11
- === 1.0.0 / 2012-08-07
12
-
13
- * Depend on new rfuse 1.0.0, Ruby 1.9
14
-
15
- * API breaking changes
16
-
17
- * order of arguments to {FuseFS.mount}, {FuseFS.start} changed
18
- to account for better option handling in RFuse
19
-
20
- === 0.8.0 / 2011-02-19
21
-
22
- * Initial port from fusefs
23
-
24
- * Improved raw methods
25
- * new "times" api for including atime,mtime,ctime in stat results
26
- * metadir allow mv directories
27
- * includes PathMapperFS
28
-
@@ -1,107 +0,0 @@
1
- = rfusefs
2
-
3
- * https://rubygems.org/gems/rfusefs
4
- * https://github.com/lwoggardner/rfusefs
5
-
6
- {<img src="https://badge.fury.io/rb/rfusefs.png" alt="Gem Version" />}[http://badge.fury.io/rb/rfusefs]
7
- == DESCRIPTION
8
-
9
- RFuseFS is a port of the FuseFS[http://rubygems.org/gems/fusefs/]
10
- library aimed at allowing Ruby programmers to quickly and easily create
11
- virtual filesystems with little more than a few lines of code.
12
-
13
- RFuseFS is api compatible with FuseFS (0.7.0)
14
-
15
- == SYNOPSIS
16
-
17
- FuseFS provides a layer of abstraction to a programmer who wants to create a
18
- virtual filesystem via FUSE.
19
-
20
- First define a virtual directory by subclassing {FuseFS::FuseDir}
21
-
22
- See samples under /samples and also the following starter classes
23
-
24
- * {FuseFS::FuseDir}
25
- * {FuseFS::MetaDir}
26
- * {FuseFS::DirLink}
27
- * {FuseFS::PathMapperFS}
28
- * {FuseFS::SqliteMapperFS}
29
-
30
- Then start your filesystem with
31
-
32
- * {FuseFS.start}
33
- * {FuseFS.main}
34
-
35
- Finally to use the filesystem open up your favourite file browser/terminal and
36
- explore the contents under <mountpoint>
37
-
38
- Happy Filesystem Hacking!
39
-
40
- === the hello world filesystem in 14 LOC
41
-
42
- require 'rfusefs'
43
-
44
- class HelloDir
45
-
46
- def contents(path)
47
- ['hello.txt']
48
- end
49
-
50
- def file?(path)
51
- path == '/hello.txt'
52
- end
53
-
54
- def read_file(path)
55
- "Hello, World!\n"
56
- end
57
-
58
- end
59
-
60
- # Usage: #{$0} mountpoint [mount_options]
61
- FuseFS.main() { |options| HelloDir.new }
62
-
63
- == REQUIREMENTS:
64
-
65
- * FUSE (http://fuse.sourceforge.org)
66
- * Ruby (>=1.9)
67
- * rfuse (~> 1.0)
68
-
69
- == INSTALL:
70
-
71
- * gem install rfusefs
72
-
73
- == DEVELOPERS:
74
-
75
- After checking out the source, run:
76
-
77
- $ bundle install # install dependencies
78
- $ rake spec # run tests
79
- $ rake yard # generate docs
80
-
81
-
82
- == LICENSE:
83
-
84
- (The MIT License)
85
-
86
- * Copyright (c) 2005 Greg Millam. (FuseFS)
87
- * Copyright (c) 2009 Kyle Maxwell. (FuseFS)
88
- * Copyright (c) 2012 Grant Gardner. (RFuseFS)
89
-
90
- Permission is hereby granted, free of charge, to any person obtaining
91
- a copy of this software and associated documentation files (the
92
- 'Software'), to deal in the Software without restriction, including
93
- without limitation the rights to use, copy, modify, merge, publish,
94
- distribute, sublicense, and/or sell copies of the Software, and to
95
- permit persons to whom the Software is furnished to do so, subject to
96
- the following conditions:
97
-
98
- The above copyright notice and this permission notice shall be
99
- included in all copies or substantial portions of the Software.
100
-
101
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
102
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
103
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
104
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
105
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
106
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
107
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,22 +0,0 @@
1
- # -*- ruby -*-
2
- require "bundler/gem_tasks"
3
- require 'yard'
4
- require 'rspec/core/rake_task'
5
- require 'rake/clean'
6
-
7
- CLOBBER.include [ "pkg/","doc/" ]
8
-
9
- YARD::Rake::YardocTask.new do |t|
10
- # Need this because YardocTask does not read the gemspec
11
- t.files = ['lib/**/*.rb', '-','History.rdoc'] # optional
12
- end
13
-
14
- RSpec::Core::RakeTask.new(:spec)
15
-
16
- desc "FuseFS compatibility specs"
17
- RSpec::Core::RakeTask.new("spec:fusefs") do |t|
18
- t.pattern = 'spec-fusefs/**/*_spec.rb'
19
- end
20
-
21
- task :default => ["spec","spec:fusefs"]
22
- # vim: syntax=ruby
data/TODO.txt DELETED
@@ -1,6 +0,0 @@
1
-
2
- = TODO
3
-
4
- Fix (or remove) samples
5
-
6
-
@@ -1,31 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "rfusefs/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "rfusefs"
7
- s.version = RFuseFS::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Grant Gardner"]
10
- s.email = ["grant@lastweekend.com.au"]
11
- s.homepage = "http://rubygems.org/gems/rfusefs"
12
- s.summary = %q{Filesystem in Ruby Userspace}
13
- s.description = %q{A more Ruby like way to write FUSE filesystems - inspired by (compatible with) FuseFS, implemented over RFuse}
14
-
15
- s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {test,spec,spec-fusefs}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
- s.require_paths = ["lib"]
19
-
20
- s.has_rdoc = 'yard'
21
- s_extra_rdoc_files = 'History.rdoc'
22
-
23
- s.add_dependency("rfuse", ">= 1.0.5")
24
- s.add_development_dependency("rake")
25
- s.add_development_dependency("rspec")
26
- s.add_development_dependency("yard")
27
- s.add_development_dependency("redcarpet")
28
- s.add_development_dependency("sqlite3")
29
- s.add_development_dependency("sys-filesystem")
30
- s.add_development_dependency("ffi-xattr", ">= 0.1.1")
31
- end
@@ -1,57 +0,0 @@
1
- require "rubygems"
2
- require 'rfusefs'
3
- require 'fusefs/metadir'
4
- require 'fusefs/dirlink'
5
-
6
- include FuseFS
7
-
8
- root = MetaDir.new
9
- root.stats.total_space = 1024*1024
10
- root.stats.total_nodes = 1024
11
- root.stats.strict = true
12
-
13
- class Counter
14
- def initialize
15
- @counter = 0
16
- end
17
- def to_s
18
- @counter += 1
19
- @counter.to_s + "\n"
20
- end
21
- def size
22
- @counter.to_s.size
23
- end
24
- end
25
-
26
- class Randwords
27
- def initialize(*ary)
28
- @ary = ary.flatten
29
- end
30
- def to_s
31
- @ary[rand(@ary.size)].to_s + "\n"
32
- end
33
- def size
34
- @size ||= @ary.map{|v| v.size}.max
35
- end
36
- end
37
-
38
- root.write_to('/hello',"Hello, World!\n")
39
-
40
- progress = '.'
41
-
42
- root.write_to('/progress',progress)
43
-
44
- Thread.new do
45
- 20.times do
46
- sleep 5
47
- progress << '.'
48
- end
49
- end
50
-
51
- root.write_to('/counter',Counter.new)
52
- root.write_to('/color',Randwords.new('red','blue','green','purple','yellow','bistre','burnt sienna','jade'))
53
- root.write_to('/animal',Randwords.new('duck','dog','cat','duck billed platypus','silly fella'))
54
-
55
- root.mkdir("/#{ENV['USER']}",FuseFS::DirLink.new(ENV['HOME']))
56
-
57
- FuseFS.main(ARGV) { | options | root }
@@ -1,74 +0,0 @@
1
- # dictfs.rb
2
-
3
- require "rubygems"
4
- require 'fusefs'
5
- include FuseFS
6
-
7
- #TODO: GG Don't know which "dict" this was referring to
8
- require 'dict'
9
-
10
- class DictFS < FuseFS::FuseDir
11
- def initialize
12
- @servers = ['dict.org','alt0.dict.org']
13
- @database = DICT::ALL_DATABASES
14
- @strategy = 'exact'
15
- @match_strategy = DICT::DEFAULT_MATCH_STRATEGY
16
- @port = DICT::DEFAULT_PORT
17
-
18
- @dict = DICT.new(@servers, @port, false, false)
19
- @dict.client("%s v%s" % ["Dictionary","1.0"])
20
- end
21
- def contents(path)
22
- # The 'readme' file
23
- ['readme']
24
- end
25
- def file?(path)
26
- base, rest = split_path(path)
27
- rest.nil? # DictFS doesn't have subdirs.
28
- end
29
- def read_file(path)
30
- word, rest = split_path(path)
31
- word.downcase!
32
- if word == "readme"
33
- return %Q[
34
- DictFS: You may not see the files, but if you cat any file here, it will look
35
- that file up on dict.org!
36
- ].lstrip
37
- end
38
- puts "Looking up #{word}"
39
- m = @dict.match(@database, @strategy, word)
40
- if m
41
- contents = []
42
- m.each do |db,words|
43
- words.each do |w|
44
- defs = @dict.define(db,w)
45
- str = []
46
- defs.each do |d|
47
- str << "Definition of '#{w}' (by #{d.description})"
48
- d.definition.each do |line|
49
- str << " #{line.strip}"
50
- end
51
- contents << str.join("\n")
52
- end
53
- end
54
- end
55
- contents << ''
56
- contents.join("\n")
57
- else
58
- "No dictionary definitions found\n"
59
- end
60
- end
61
- end
62
-
63
- if (File.basename($0) == File.basename(__FILE__))
64
- unless (ARGV.length > 0 && File.directory?(ARGV[0]))
65
- puts "Usage: #{$0} <mountpoint> <mount_options>"
66
- exit
67
- end
68
-
69
- root = DictFS.new
70
-
71
- # Set the root FuseFS
72
- FuseFS.start(root,*ARGV)
73
-
74
- end
@@ -1,20 +0,0 @@
1
- class HelloDir
2
- def contents(path)
3
- ['hello.txt']
4
- end
5
-
6
- def file?(path)
7
- path == '/hello.txt'
8
- end
9
-
10
- def read_file(path)
11
- "Hello, World!\n"
12
- end
13
-
14
- end
15
-
16
- if __FILE__ == $0
17
- require 'rfusefs'
18
- hellodir = HelloDir.new
19
- FuseFS.start(hellodir,*ARGV)
20
- end
@@ -1,53 +0,0 @@
1
- # openurifs.rb
2
- #
3
-
4
- require "rubygems"
5
- require 'fusefs'
6
- include FuseFS
7
-
8
- require 'open-uri'
9
-
10
- class OpenUriFS < FuseFS::FuseDir
11
- def contents(path)
12
- # The 'readme' file
13
- []
14
- end
15
- def directory?(path)
16
- uri = scan_path(path)
17
- fn = uri.pop
18
- return true if fn =~ /\.(com|org|net|us|de|jp|ru|uk|biz|info)$/
19
- return true if fn =~ /^\d+\.\d+\.\d+\.\d+$/
20
- ! (fn =~ /\./) # Does the last item doesn't contain a '.' ?
21
- end
22
- def file?(path)
23
- !directory?(path)
24
- end
25
- def read_file(path)
26
- proto, rest = split_path(path)
27
- uri = "#{proto}://#{rest}"
28
- open(uri).read
29
- end
30
- end
31
-
32
- if (File.basename($0) == File.basename(__FILE__))
33
- if (ARGV.size != 1)
34
- puts "Usage: #{$0} <directory>"
35
- exit
36
- end
37
-
38
- dirname = ARGV.shift
39
-
40
- unless File.directory?(dirname)
41
- puts "Usage: #{dirname} is not a directory."
42
- exit
43
- end
44
-
45
- root = OpenUriFS.new
46
-
47
- # Set the root FuseFS
48
- FuseFS.set_root(root)
49
-
50
- FuseFS.mount_under(dirname)
51
-
52
- FuseFS.run # This doesn't return until we're unmounted.
53
- end
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # RailsFS, as written by _why_the_lucky_stiff
4
- #
5
- # Full instructions:
6
- # http://redhanded.hobix.com/inspect/railsfsAfterACoupleMinutesOfToolingWithFuseWhoa.html
7
- #
8
- =begin
9
- Instructions cut and paste from _why's blog:
10
-
11
- Save the railfs.rb script as script/filesys in your Rails app. (If you'd
12
- rather not cut-and-paste the above, it's here.)
13
-
14
- Now, run mkdir ~/railsmnt. Then, script/filesys ~/railsmnt. The rules are as
15
- follows:
16
-
17
- * ls ~/railsmnt will give you a list of tables.
18
- * ls ~/railsmnt/table will list IDs from the table.
19
- * cat ~/railsmnt/table/id will display a record in YAML.
20
- * vim ~/railsmnt/table/id to edit the record in YAML!
21
-
22
- =end
23
-
24
- require "rubygems"
25
- require 'fusefs'
26
- require File.dirname(__FILE__) + '/../config/environment'
27
-
28
- class RailsFS < FuseFS::FuseDir
29
- def initialize
30
- @classes = {}
31
- require 'find'
32
- Find.find( File.join(RAILS_ROOT, 'app/models') ) do |model|
33
- if /(\w+)\.rb$/ =~ model
34
- model = $1
35
- ( @classes[model] = Kernel::const_get( Inflector.classify( model ) ) ).
36
- find :first rescue @classes.delete( model )
37
- end
38
- end
39
- end
40
- def directory? path
41
- tname, key = scan_path path
42
- table = @classes[tname]
43
- if table.nil?; false # /table
44
- elsif key; false # /table/id
45
- else; true end
46
- end
47
- def file? path
48
- tname, key = scan_path path
49
- table = @classes[tname]
50
- key and table and table.find( key )
51
- end
52
- def can_delete?; true end
53
- def can_write? path; file? path end
54
- def contents path
55
- tname, key = scan_path path
56
- table = @classes[tname]
57
- if tname.nil?; @classes.keys.sort # /
58
- else; table.find( :all ).map { |o| o.id.to_s } end # /table
59
- end
60
- def write_to path, body
61
- obj = YAML::load( body )
62
- obj.save
63
- end
64
- def read_file path
65
- tname, key = scan_path path
66
- table = @classes[tname]
67
- YAML::dump( table.find( key ) )
68
- end
69
- end
70
-
71
- if (File.basename($0) == File.basename(__FILE__))
72
- root = RailsFS.new
73
- FuseFS.set_root(root)
74
- FuseFS.mount_under(ARGV[0])
75
- FuseFS.run # This doesn't return until we're unmounted.
76
- end
77
-