rfusefs 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile +3 -1
- data/History.rdoc +6 -0
- data/README.rdoc +4 -5
- data/lib/fuse/fusedir.rb +15 -0
- data/lib/fuse/rfusefs-fuse.rb +446 -414
- data/lib/fusefs/metadir.rb +5 -5
- data/lib/fusefs/pathmapper.rb +7 -7
- data/lib/fusefs/sqlitemapper.rb +7 -2
- data/lib/rfusefs.rb +20 -48
- data/lib/rfusefs/version.rb +1 -1
- data/rfusefs.gemspec +2 -2
- data/samples/demo.rb +2 -2
- data/spec/metadir_spec.rb +280 -275
- data/spec/mount_unmount_spec.rb +2 -2
- data/spec/pathmapper_spec.rb +79 -79
- data/spec/rfusefs_spec.rb +505 -497
- data/spec/sample_spec.rb +12 -9
- data/spec/spec_helper.rb +3 -3
- data/spec/sqlitemapper_spec.rb +12 -12
- metadata +26 -27
- data/.travis.yml +0 -8
data/spec/sample_spec.rb
CHANGED
@@ -5,26 +5,29 @@ require 'pathname'
|
|
5
5
|
require 'hello'
|
6
6
|
|
7
7
|
describe "Access Hello World sample from Ruby file operations" do
|
8
|
-
let(:mountpoint) { Pathname.new(Dir.mktmpdir("rfusefs_sample")) }
|
9
8
|
|
10
9
|
before(:all) do
|
10
|
+
mountpoint = Pathname.new(Dir.mktmpdir("rfusefs_sample"))
|
11
11
|
hello = HelloDir.new()
|
12
12
|
FuseFS.mount(hello,mountpoint)
|
13
|
-
#Give FUSE some time to get started
|
13
|
+
#Give FUSE some time to get started
|
14
14
|
sleep(0.5)
|
15
|
+
@mountpoint = mountpoint
|
15
16
|
end
|
16
|
-
|
17
|
+
|
17
18
|
after(:all) do
|
19
|
+
mountpoint = @mountpoint
|
18
20
|
FuseFS.unmount(mountpoint)
|
19
|
-
|
20
|
-
FileUtils.rmdir(mountpoint)
|
21
|
+
FileUtils.rmdir(mountpoint)
|
21
22
|
end
|
22
|
-
|
23
|
+
let(:mountpoint) { @mountpoint }
|
24
|
+
|
23
25
|
it "should list expected root directory contents" do
|
24
|
-
Dir.entries(mountpoint.to_s).
|
26
|
+
expect(Dir.entries(mountpoint.to_s)).to match_array([".","..","hello.txt"])
|
25
27
|
end
|
26
|
-
|
28
|
+
|
27
29
|
it "should output the expected sample contents" do
|
28
|
-
(mountpoint + "hello.txt").read().
|
30
|
+
expect((mountpoint + "hello.txt").read()).to eq("Hello, World!\n")
|
31
|
+
puts "Done!!"
|
29
32
|
end
|
30
33
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -16,16 +16,16 @@ module RFuseFSHelper
|
|
16
16
|
def pathnames(*args)
|
17
17
|
args.collect {|x| Pathname.new(x) }
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def permissions(mode)
|
21
21
|
return (mode & 07777)
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def filetype(mode)
|
25
25
|
return (mode & RFuse::Stat::S_IFMT)
|
26
26
|
end
|
27
27
|
|
28
|
-
FuseContext = Struct.new(:uid,:gid)
|
28
|
+
FuseContext = Struct.new(:uid,:gid)
|
29
29
|
def fuse_context(uid=Process.uid,gid=Process.gid)
|
30
30
|
FuseContext.new(uid,gid)
|
31
31
|
end
|
data/spec/sqlitemapper_spec.rb
CHANGED
@@ -87,14 +87,14 @@ describe "SqliteMapper" do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should map files from a sqlite database" do
|
90
|
-
fs.directory?("/").
|
91
|
-
fs.directory?("/textfiles").
|
92
|
-
fs.directory?("/pictures/201103").
|
93
|
-
fs.file?("/textfiles/hello").
|
94
|
-
fs.directory?("/textfiles/hello").
|
95
|
-
fs.file?("/artist/album/mysong.mp3").
|
96
|
-
fs.directory?("/artist/album/mysong.mp3").
|
97
|
-
fs.file?("/some/unknown/path").
|
90
|
+
expect(fs.directory?("/")).to be_truthy
|
91
|
+
expect(fs.directory?("/textfiles")).to be_truthy
|
92
|
+
expect(fs.directory?("/pictures/201103")).to be_truthy
|
93
|
+
expect(fs.file?("/textfiles/hello")).to be_truthy
|
94
|
+
expect(fs.directory?("/textfiles/hello")).to be_falsey
|
95
|
+
expect(fs.file?("/artist/album/mysong.mp3")).to be_truthy
|
96
|
+
expect(fs.directory?("/artist/album/mysong.mp3")).to be_falsey
|
97
|
+
expect(fs.file?("/some/unknown/path")).to be_falsey
|
98
98
|
end
|
99
99
|
|
100
100
|
context "an updated database" do
|
@@ -103,15 +103,15 @@ describe "SqliteMapper" do
|
|
103
103
|
fixture.pathmap("added.txt","/textfiles/added.txt")
|
104
104
|
fixture.db_force_write()
|
105
105
|
fs.rescan; sleep(0.3)
|
106
|
-
fs.file?("/textfiles/added.txt").
|
106
|
+
expect(fs.file?("/textfiles/added.txt")).to be_truthy
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should remove files and directories no longer mapped" do
|
110
110
|
fixture.unpathmap("/textfiles/hello")
|
111
111
|
fixture.db_force_write()
|
112
112
|
fs.rescan; sleep(0.3)
|
113
|
-
fs.file?("/textfiles/hello").
|
114
|
-
fs.directory?("/textfiles").
|
113
|
+
expect(fs.file?("/textfiles/hello")).to be_falsey
|
114
|
+
expect(fs.directory?("/textfiles")).to be_falsey
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
@@ -126,7 +126,7 @@ describe "SqliteMapper" do
|
|
126
126
|
|
127
127
|
hello_path = (@mountpoint + "textfiles/hello")
|
128
128
|
hello_path.open do |f|
|
129
|
-
f.read.
|
129
|
+
expect(f.read).to eq("/textfiles/hello")
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfusefs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Gardner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rfuse
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: yard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: redcarpet
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: sqlite3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: sys-filesystem
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: ffi-xattr
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 0.1.1
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.1.1
|
125
125
|
description: A more Ruby like way to write FUSE filesystems - inspired by (compatible
|
@@ -130,8 +130,7 @@ executables: []
|
|
130
130
|
extensions: []
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
|
-
- .gitignore
|
134
|
-
- .travis.yml
|
133
|
+
- ".gitignore"
|
135
134
|
- Gemfile
|
136
135
|
- History.rdoc
|
137
136
|
- README.rdoc
|
@@ -171,17 +170,17 @@ require_paths:
|
|
171
170
|
- lib
|
172
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
172
|
requirements:
|
174
|
-
- -
|
173
|
+
- - ">="
|
175
174
|
- !ruby/object:Gem::Version
|
176
175
|
version: '0'
|
177
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
177
|
requirements:
|
179
|
-
- -
|
178
|
+
- - ">="
|
180
179
|
- !ruby/object:Gem::Version
|
181
180
|
version: '0'
|
182
181
|
requirements: []
|
183
182
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
183
|
+
rubygems_version: 2.2.2
|
185
184
|
signing_key:
|
186
185
|
specification_version: 4
|
187
186
|
summary: Filesystem in Ruby Userspace
|