couch-replicate 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/couch_replicate.rb +2 -2
- data/spec/couch_replicate_spec.rb +17 -8
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/couch_replicate.rb
CHANGED
@@ -8,8 +8,8 @@ module CouchReplicate
|
|
8
8
|
def self.replicate(source_host, target_host, db)
|
9
9
|
source = hostify(source_host)
|
10
10
|
target = hostify(target_host)
|
11
|
-
RestClient.post("#{
|
12
|
-
%Q|{"source":"#{db}", "target":"#{
|
11
|
+
RestClient.post("#{target}/_replicate",
|
12
|
+
%Q|{"source":"#{source}/#{db}", "target":"#{db}", "continuous":true}|)
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.link(db, hosts)
|
@@ -7,11 +7,20 @@ describe "CouchReplicate" do
|
|
7
7
|
@db = 'test'
|
8
8
|
end
|
9
9
|
|
10
|
+
it "should default to local target (pull) replicate" do
|
11
|
+
RestClient.
|
12
|
+
should_receive(:post).
|
13
|
+
with("#{@target_host}/_replicate",
|
14
|
+
%Q|{"source":"#{@src_host}/#{@db}", "target":"#{@db}", "continuous":true}|)
|
15
|
+
|
16
|
+
CouchReplicate.replicate(@src_host, @target_host, @db)
|
17
|
+
end
|
18
|
+
|
10
19
|
it "should be able to tell a node to replicate itself" do
|
11
20
|
RestClient.
|
12
21
|
should_receive(:post).
|
13
|
-
with("#{@
|
14
|
-
%Q|{"source":"#{@db}", "target":"#{@
|
22
|
+
with("#{@target_host}/_replicate",
|
23
|
+
%Q|{"source":"#{@src_host}/#{@db}", "target":"#{@db}", "continuous":true}|)
|
15
24
|
|
16
25
|
CouchReplicate.replicate(@src_host, @target_host, @db)
|
17
26
|
end
|
@@ -19,8 +28,8 @@ describe "CouchReplicate" do
|
|
19
28
|
it "should default replication to port 5984" do
|
20
29
|
RestClient.
|
21
30
|
should_receive(:post).
|
22
|
-
with("#{@
|
23
|
-
%Q|{"source":"#{@db}", "target":"#{@
|
31
|
+
with("#{@target_host}/_replicate",
|
32
|
+
%Q|{"source":"#{@src_host}/#{@db}", "target":"#{@db}", "continuous":true}|)
|
24
33
|
|
25
34
|
CouchReplicate.replicate(@src_host.sub(/:5984/, ''), @target_host, @db)
|
26
35
|
end
|
@@ -28,8 +37,8 @@ describe "CouchReplicate" do
|
|
28
37
|
it "should default replication to HTTP" do
|
29
38
|
RestClient.
|
30
39
|
should_receive(:post).
|
31
|
-
with("#{@
|
32
|
-
%Q|{"source":"#{@db}", "target":"#{@
|
40
|
+
with("#{@target_host}/_replicate",
|
41
|
+
%Q|{"source":"#{@src_host}/#{@db}", "target":"#{@db}", "continuous":true}|)
|
33
42
|
|
34
43
|
CouchReplicate.replicate(@src_host.sub(/http:\/\//, ''), @target_host, @db)
|
35
44
|
end
|
@@ -37,8 +46,8 @@ describe "CouchReplicate" do
|
|
37
46
|
it "should not care if URL ends with a slash" do
|
38
47
|
RestClient.
|
39
48
|
should_receive(:post).
|
40
|
-
with("#{@
|
41
|
-
%Q|{"source":"#{@db}", "target":"#{@
|
49
|
+
with("#{@target_host}/_replicate",
|
50
|
+
%Q|{"source":"#{@src_host}/#{@db}", "target":"#{@db}", "continuous":true}|)
|
42
51
|
|
43
52
|
CouchReplicate.replicate(@src_host + '/', @target_host, @db)
|
44
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couch-replicate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Strom
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-27 00:00:00 -04:00
|
13
13
|
default_executable: couch-replicate
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|