couch-quilt 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/couchquilt +36 -26
- data/couch-quilt.gemspec +2 -2
- data/lib/couchquilt/version.rb +1 -1
- metadata +3 -3
data/bin/couchquilt
CHANGED
@@ -14,43 +14,53 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
# usage:
|
17
|
-
# couchquilt
|
18
|
-
|
19
|
-
QUILT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
20
|
-
require File.join(QUILT_ROOT, "lib/couchquilt")
|
17
|
+
# couchquilt http://localhost:5984 ~/quilt
|
21
18
|
|
22
19
|
DEBUG = ARGV.delete("--debug")
|
23
|
-
require File.join(File.dirname(__FILE__), '../lib/couchquilt/debugged_fs') if DEBUG
|
24
20
|
|
25
|
-
|
21
|
+
require File.expand_path("../../lib/couchquilt", __FILE__)
|
22
|
+
require File.expand_path("../../lib/couchquilt/debugged_fs", __FILE__) if DEBUG
|
23
|
+
|
24
|
+
# database server url defaults to http://127.0.0.1:5984
|
25
|
+
ARGV.unshift "http://127.0.0.1:5984" if !ARGV[1] && ARGV[0] !~ /^-/
|
26
|
+
|
27
|
+
server, mountpoint = ARGV
|
28
|
+
|
29
|
+
unless server && mountpoint
|
26
30
|
puts "usage:"
|
27
31
|
puts "couchquilt [server] mountpoint [--debug]"
|
28
32
|
exit
|
29
33
|
end
|
30
34
|
|
31
|
-
# database server url defaults to http://127.0.0.1:5984
|
32
|
-
ARGV.unshift "http://127.0.0.1:5984" if ARGV.size < 2
|
33
|
-
|
34
|
-
server = ARGV[0]
|
35
|
-
mountpoint = ARGV[1]
|
36
35
|
|
37
36
|
# create mount point if needed
|
38
37
|
Dir.mkdir(mountpoint) unless File.directory?(mountpoint)
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
39
|
+
def maybe_fork
|
40
|
+
if DEBUG
|
41
|
+
yield
|
42
|
+
else
|
43
|
+
p = fork { yield }
|
44
|
+
Process.detach p
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# on debug mode we do not run in background
|
49
|
+
maybe_fork do
|
50
|
+
# listen for exit signals and unmount fuse
|
51
|
+
trap("EXIT") do
|
52
|
+
FuseFS.unmount
|
53
|
+
FuseFS.exit
|
54
|
+
end
|
55
|
+
|
56
|
+
# init quilt fs
|
57
|
+
quilt_fs_class = DEBUG ? Couchquilt::DebuggedFS : Couchquilt::FS
|
58
|
+
FuseFS.set_root quilt_fs_class.new(server)
|
59
|
+
FuseFS.mount_under mountpoint
|
60
|
+
|
61
|
+
# actually do the Fuse mount
|
62
|
+
puts "Quilt maps #{server} to #{mountpoint}" if DEBUG
|
63
|
+
|
64
|
+
FuseFS.run
|
51
65
|
end
|
52
66
|
|
53
|
-
# actually do the Fuse mount
|
54
|
-
puts "Quilt maps #{server} to #{mountpoint}"
|
55
|
-
puts "Debug mode" if DEBUG
|
56
|
-
FuseFS.run
|
data/couch-quilt.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{couch-quilt}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Johannes J\303\266rg Schmidt"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-23}
|
13
13
|
s.default_executable = %q{couchquilt}
|
14
14
|
s.description = %q{Access CouchDB JSON documents from filesystem.}
|
15
15
|
s.email = %q{schmidt@netzmerk.com}
|
data/lib/couchquilt/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 1
|
9
|
+
version: 0.4.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Johannes J\xC3\xB6rg Schmidt"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-23 00:00:00 +01:00
|
18
18
|
default_executable: couchquilt
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|