cloudant_backup 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -1
- data/LICENSE.txt +1 -1
- data/README.md +2 -1
- data/lib/cloudant_backup/backup.rb +5 -1
- data/lib/cloudant_backup/version.rb +1 -1
- data/spec/lib/cloudant_backup_spec.rb +52 -18
- metadata +3 -3
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/jayniz/cloudant-backup.png)](https://travis-ci.org/jayniz/cloudant-backup)
|
1
2
|
# CloudantBackup
|
2
3
|
|
3
4
|
Easily backup a cloudant db using replication. This gem wraps
|
@@ -68,7 +69,7 @@ Don't use cloudant at all, just copy one couchdb over to another:
|
|
68
69
|
```ruby
|
69
70
|
cb = CloudantBackup.new
|
70
71
|
[...]
|
71
|
-
cb.host = 'my-couchdb-instance.com'
|
72
|
+
cb.host = 'http://my-couchdb-instance.com:5984'
|
72
73
|
|
73
74
|
cb.backup
|
74
75
|
```
|
@@ -64,26 +64,60 @@ describe CloudantBackup do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
context "not using cloudant at all" do
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
67
|
+
|
68
|
+
describe "with authentication" do
|
69
|
+
it "creates the backup db" do
|
70
|
+
cb.host = 'my-couchdb.com'
|
71
|
+
cb.target = 'custom-name'
|
72
|
+
url = "http://backup-user:password@my-couchdb.com/custom-name"
|
73
|
+
RestClient.should_receive(:put).with(url, options)
|
74
|
+
cb.create_target_db
|
75
|
+
end
|
76
|
+
|
77
|
+
it "triggers the replication" do
|
78
|
+
cb.target = 'custom-name'
|
79
|
+
cb.host = 'my-couchdb.com'
|
80
|
+
url = "http://backup-user:password@my-couchdb.com/_replicate"
|
81
|
+
source_db = "http://backup-user:password@my-couchdb.com/production-db"
|
82
|
+
target_db = "http://backup-user:password@my-couchdb.com/custom-name"
|
83
|
+
data = {
|
84
|
+
source: source_db,
|
85
|
+
target: target_db
|
86
|
+
}.to_json
|
87
|
+
RestClient.should_receive(:post).with(url, data, options)
|
88
|
+
cb.replicate
|
89
|
+
end
|
73
90
|
end
|
74
91
|
|
75
|
-
|
76
|
-
cb
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
92
|
+
describe "without authentication" do
|
93
|
+
let(:cb) do
|
94
|
+
cb = CloudantBackup.new
|
95
|
+
cb.source = 'production-db'
|
96
|
+
cb.cloudant_host = 'main-user'
|
97
|
+
cb
|
98
|
+
end
|
99
|
+
|
100
|
+
it "creates the backup db" do
|
101
|
+
cb.host = 'my-couchdb.com'
|
102
|
+
cb.target = 'custom-name'
|
103
|
+
url = "http://my-couchdb.com/custom-name"
|
104
|
+
RestClient.should_receive(:put).with(url, options)
|
105
|
+
cb.create_target_db
|
106
|
+
end
|
107
|
+
|
108
|
+
it "triggers the replication" do
|
109
|
+
cb.target = 'custom-name'
|
110
|
+
cb.host = 'my-couchdb.com'
|
111
|
+
url = "http://my-couchdb.com/_replicate"
|
112
|
+
source_db = "http://my-couchdb.com/production-db"
|
113
|
+
target_db = "http://my-couchdb.com/custom-name"
|
114
|
+
data = {
|
115
|
+
source: source_db,
|
116
|
+
target: target_db
|
117
|
+
}.to_json
|
118
|
+
RestClient.should_receive(:post).with(url, data, options)
|
119
|
+
cb.replicate
|
120
|
+
end
|
87
121
|
end
|
88
122
|
end
|
89
123
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cloudant_backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jannis Hermanns
|
@@ -141,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
segments:
|
143
143
|
- 0
|
144
|
-
hash:
|
144
|
+
hash: -3012344103416834145
|
145
145
|
version: '0'
|
146
146
|
none: false
|
147
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
segments:
|
152
152
|
- 0
|
153
|
-
hash:
|
153
|
+
hash: -3012344103416834145
|
154
154
|
version: '0'
|
155
155
|
none: false
|
156
156
|
requirements: []
|