rfusefs 1.0.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module FuseFS
2
2
 
3
3
  # A full in-memory filesystem defined with hashes. It is writable to the
4
- # user that mounted it
4
+ # user that mounted it
5
5
  # may create and edit files within it, as well as the programmer
6
6
  # === Usage
7
7
  # root = Metadir.new()
@@ -14,10 +14,10 @@ module FuseFS
14
14
  # Because Metadir is fully recursive, you can mount your own or other defined
15
15
  # directory structures under it. For example, to mount a dictionary filesystem
16
16
  # (see samples/dictfs.rb), use:
17
- #
17
+ #
18
18
  # root.mkdir("/dict",DictFS.new())
19
- #
20
- class MetaDir
19
+ #
20
+ class MetaDir
21
21
 
22
22
  DEFAULT_FS = FuseDir.new()
23
23
 
@@ -66,7 +66,7 @@ module FuseFS
66
66
  # Extended attributes
67
67
  def xattr(path)
68
68
  pathmethod(:xattr,path) do | path |
69
- @xattr[path]
69
+ @xattr[path]
70
70
  end
71
71
  end
72
72
 
@@ -13,7 +13,7 @@ module FuseFS
13
13
  #
14
14
  class PathMapperFS < FuseDir
15
15
 
16
- # Represents a mappted file or directory
16
+ # Represents a mapped file or directory
17
17
  class MNode
18
18
 
19
19
  # Merge extended attributes with the ones from the underlying file
@@ -112,10 +112,10 @@ module FuseFS
112
112
  end
113
113
 
114
114
  # Compatibility and convenience method
115
- # @param [:pm_real_path,String,Symbol] key
116
- # @return [String] {#real_path} if key == :pm_real_path
115
+ # @param [:pm_real_path,String,Symbol] key
116
+ # @return [String] {#real_path} if key == :pm_real_path
117
117
  # @return [MNode] the node representing the file named key
118
- # @return [Object] shortcut for {#options}[key]
118
+ # @return [Object] shortcut for {#options}[key]
119
119
  def[](key)
120
120
  case key
121
121
  when :pm_real_path
@@ -266,7 +266,7 @@ module FuseFS
266
266
  # @yieldparam [Hash] filesystem node
267
267
  # @yieldreturn [true,false] should this node be deleted
268
268
  def cleanup(&block)
269
- recursive_cleanup(@root,&block)
269
+ recursive_cleanup(@root,&block)
270
270
  end
271
271
 
272
272
 
@@ -379,7 +379,7 @@ module FuseFS
379
379
  file.sysseek(offset)
380
380
  file.syswrite(buf[0,sz])
381
381
  end
382
-
382
+
383
383
  # @!visibility private
384
384
  def raw_sync(path,datasync,file=nil)
385
385
  file = @openfiles[path] unless file
@@ -393,7 +393,7 @@ module FuseFS
393
393
  # @!visibility private
394
394
  def raw_close(path,file=nil)
395
395
  file = @openfiles.delete(path) unless file
396
-
396
+
397
397
  if file && !file.closed?
398
398
  begin
399
399
  flags = file.fcntl(Fcntl::F_GETFL) & Fcntl::O_ACCMODE
@@ -15,7 +15,7 @@ module FuseFS
15
15
  # Maintains a count of the number of times through the scan loop
16
16
  attr_reader :scan_id
17
17
 
18
- #
18
+ #
19
19
  #
20
20
  # @param [String] db_path Path to Sqlite database
21
21
  # @param [String] sql query
@@ -55,7 +55,7 @@ module FuseFS
55
55
  end
56
56
 
57
57
  # FuseFS callback when filesystem is unmounted
58
- #
58
+ #
59
59
  # Stops the database watching threads
60
60
  # @api FuseFS
61
61
  def unmounted()
@@ -88,6 +88,11 @@ module FuseFS
88
88
  cleanup() { |file_node| file_node.options[:sqlite_scan_id] != @scan_id }
89
89
  end
90
90
 
91
+ # Rescan on HUP signal
92
+ def sighup
93
+ rescan()
94
+ end
95
+
91
96
  private
92
97
 
93
98
  def scan_loop()
@@ -45,28 +45,14 @@ module FuseFS
45
45
  # end
46
46
  #
47
47
  def FuseFS.main(argv=ARGV,options=[],option_usage="",device=nil,exec=File.basename($0))
48
- options = RFuse.parse_options(argv,*options)
49
-
50
- if options[:mountpoint]
51
- begin
52
- fs = yield options
53
- rescue StandardError => ex
54
- puts ex.message
55
- puts ex.backtrace.join("\n")
56
- end
57
-
58
- puts RFuse.usage(device,exec) if options[:help] || !fs
59
- puts "Options:\n" if options[:help]
60
-
61
- FuseFS.start(fs,*argv) if fs || options[:help]
62
-
63
- puts option_usage if options[:help]
64
- else
65
- puts "rfusefs: failed, no mountpoint provided",RFuse.usage(device,exec)
48
+ RFuse.main(argv,options,option_usage,device,exec) do |options,argv|
49
+ root = yield options
50
+ FuseFS.set_root(root)
51
+ FuseFS.mount_under(*argv)
66
52
  end
67
53
  end
68
54
 
69
- # Start the FuseFS root at mountpoint with opts.
55
+ # Start the FuseFS root at mountpoint with opts.
70
56
  #
71
57
  # If not previously set, Signal traps for "TERM" and "INT" are added
72
58
  # to exit the filesystem
@@ -77,7 +63,6 @@ module FuseFS
77
63
  # @note RFuseFS extension
78
64
  # @return [void]
79
65
  def FuseFS.start(root,mountpoint,*opts)
80
- set_default_traps("TERM","INT") { FuseFS.exit }
81
66
  FuseFS.set_root(root)
82
67
  begin
83
68
  FuseFS.mount_under(mountpoint,*opts)
@@ -88,7 +73,7 @@ module FuseFS
88
73
  end
89
74
 
90
75
  # Forks {FuseFS.start} so you can access your filesystem with ruby File
91
- # operations (eg for testing).
76
+ # operations (eg for testing).
92
77
  # @note This is an *RFuseFS* extension
93
78
  # @return [void]
94
79
  def FuseFS.mount(root,mountpoint,*opts)
@@ -126,43 +111,40 @@ module FuseFS
126
111
  end
127
112
  end
128
113
 
129
- # Set the root virtual directory
114
+ # Set the root virtual directory
130
115
  # @param root [Object] an object implementing a subset of {FuseFS::API}
131
116
  # @return [void]
132
117
  def FuseFS.set_root(root)
133
- @fs=RFuseFS.new(root)
118
+ @fs=Fuse::Root.new(root)
134
119
  end
135
120
 
136
121
  # This will cause FuseFS to virtually mount itself under the given path. {set_root} must have
137
122
  # been called previously.
138
123
  # @param [String] mountpoint an existing directory where the filesystem will be virtually mounted
139
124
  # @param [Array<String>] args
125
+ # @return [Fuse] the mounted fuse filesystem
140
126
  # These are as expected by the "mount" command. Note in particular that the first argument
141
127
  # is expected to be the mount point. For more information, see http://fuse.sourceforge.net
142
128
  # and the manual pages for "mount.fuse"
143
- def FuseFS.mount_under(mountpoint, *args)
144
- @fuse = RFuse::FuseDelegator.new(@fs,mountpoint,*args)
129
+ def FuseFS.mount_under(mountpoint, *args)
130
+ @fuse = Fuse.new(@fs,mountpoint,*args)
145
131
  end
146
132
 
147
- # This is the main loop waiting on then executing filesystem operations from the
148
- # kernel.
149
- #
133
+ # This is the main loop waiting on, then executing, filesystem operations from the
134
+ # kernel.
135
+ #
150
136
  # Note: Running in a separate thread is generally not useful. In particular
151
- # you cannot access your filesystem using ruby File operations.
137
+ # you cannot use Ruby File operations to access your filesystem from
138
+ # within the ruby process that calls run.
152
139
  # @note RFuseFS extension
153
140
  def FuseFS.run
154
- @fs.mounted()
155
- @fuse.loop if @fuse.mounted?
156
- ensure
157
- @fs.unmounted()
141
+ @fuse.run()
158
142
  end
159
143
 
160
- # Exit the run loop and teardown FUSE
161
- # Most useful from Signal.trap() or Kernel.at_exit()
144
+ # Exit the run loop and teardown FUSE
145
+ # Most useful from Signal.trap() or Kernel.at_exit()
162
146
  def FuseFS.exit
163
- if @fuse
164
- @fuse.exit
165
- end
147
+ @fuse.exit if @fuse
166
148
  end
167
149
 
168
150
  # @return [Fixnum] the calling process uid
@@ -188,15 +170,5 @@ module FuseFS
188
170
  #do nothing
189
171
  end
190
172
 
191
- private
192
-
193
- def self.set_default_traps(*signals,&block)
194
- signals.each do |sig|
195
- old_proc = Signal.trap(sig,block)
196
- unless "DEFAULT".eql?(old_proc)
197
- Signal.trap(sig,old_proc)
198
- end
199
- end
200
- end
201
173
  end
202
174
 
@@ -1,3 +1,3 @@
1
1
  module RFuseFS
2
- VERSION="1.0.2"
2
+ VERSION="1.1.3"
3
3
  end
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.2
4
+ version: 1.1.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-04-16 00:00:00.000000000 Z
11
+ date: 2020-11-14 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.0.5
19
+ version: '1.2'
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.0.5
26
+ version: '1.2'
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: '0'
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: '0'
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
@@ -128,15 +128,14 @@ email:
128
128
  - grant@lastweekend.com.au
129
129
  executables: []
130
130
  extensions: []
131
- extra_rdoc_files: []
131
+ extra_rdoc_files:
132
+ - CHANGES.md
132
133
  files:
133
- - .gitignore
134
- - .travis.yml
135
- - Gemfile
136
- - History.rdoc
137
- - README.rdoc
138
- - Rakefile
139
- - TODO.txt
134
+ - ".yardopts"
135
+ - CHANGES.md
136
+ - LICENSE
137
+ - README.md
138
+ - TODO.md
140
139
  - lib/fuse/fusedir.rb
141
140
  - lib/fuse/rfusefs-fuse.rb
142
141
  - lib/fusefs.rb
@@ -146,24 +145,9 @@ files:
146
145
  - lib/fusefs/sqlitemapper.rb
147
146
  - lib/rfusefs.rb
148
147
  - lib/rfusefs/version.rb
149
- - rfusefs.gemspec
150
- - samples/demo.rb
151
- - samples/dictfs.rb
152
- - samples/hello.rb
153
- - samples/openurifs.rb
154
- - samples/railsfs.rb
155
- - samples/sqlfs.rb
156
- - samples/yamlfs.rb
157
- - spec-fusefs/fusefs_spec.rb
158
- - spec/metadir_spec.rb
159
- - spec/mount_unmount_spec.rb
160
- - spec/pathmapper_spec.rb
161
- - spec/rfusefs_spec.rb
162
- - spec/sample_spec.rb
163
- - spec/spec_helper.rb
164
- - spec/sqlitemapper_spec.rb
165
148
  homepage: http://rubygems.org/gems/rfusefs
166
- licenses: []
149
+ licenses:
150
+ - MIT
167
151
  metadata: {}
168
152
  post_install_message:
169
153
  rdoc_options: []
@@ -171,19 +155,17 @@ require_paths:
171
155
  - lib
172
156
  required_ruby_version: !ruby/object:Gem::Requirement
173
157
  requirements:
174
- - - ! '>='
158
+ - - ">="
175
159
  - !ruby/object:Gem::Version
176
- version: '0'
160
+ version: '2.5'
177
161
  required_rubygems_version: !ruby/object:Gem::Requirement
178
162
  requirements:
179
- - - ! '>='
163
+ - - ">="
180
164
  - !ruby/object:Gem::Version
181
165
  version: '0'
182
166
  requirements: []
183
- rubyforge_project:
184
- rubygems_version: 2.1.11
167
+ rubygems_version: 3.0.8
185
168
  signing_key:
186
169
  specification_version: 4
187
170
  summary: Filesystem in Ruby Userspace
188
171
  test_files: []
189
- has_rdoc: yard