monsoon 0.3 → 0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/monsoon/backup.rb +1 -13
- data/lib/monsoon/compress.rb +1 -1
- data/lib/monsoon/version.rb +1 -1
- data/spec/monsoon/backup_spec.rb +6 -32
- data/spec/monsoon/compress_spec.rb +2 -2
- metadata +9 -9
data/lib/monsoon/backup.rb
CHANGED
@@ -58,18 +58,6 @@ module Monsoon
|
|
58
58
|
config["database"]
|
59
59
|
end
|
60
60
|
|
61
|
-
# Helper method for database backup location.
|
62
|
-
#
|
63
|
-
# Examples
|
64
|
-
#
|
65
|
-
# Monsoon::Backup("mongodb://test.mongohq.com:10036/app_development").backup_location
|
66
|
-
# # => "dump/app_development"
|
67
|
-
#
|
68
|
-
# Returns a String of the database name.
|
69
|
-
def backup_location
|
70
|
-
"dump/#{config['database']}"
|
71
|
-
end
|
72
|
-
|
73
61
|
# Helper to form the mongodump command.
|
74
62
|
#
|
75
63
|
# Examples
|
@@ -80,7 +68,7 @@ module Monsoon
|
|
80
68
|
# Returns the command as a String.
|
81
69
|
def mongo_dump_command
|
82
70
|
cmd = ""
|
83
|
-
cmd = "mongodump -h #{config['host']}:#{config['port']} -d #{config['database']} "
|
71
|
+
cmd = "mongodump -h #{config['host']}:#{config['port']} -d #{config['database']} -o . "
|
84
72
|
cmd += "--username #{config['username']} --password #{config['password']}" unless config["username"].nil? and config["password"].nil?
|
85
73
|
cmd
|
86
74
|
end
|
data/lib/monsoon/compress.rb
CHANGED
data/lib/monsoon/version.rb
CHANGED
data/spec/monsoon/backup_spec.rb
CHANGED
@@ -79,46 +79,20 @@ module Monsoon
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
describe "#backup_location" do
|
83
|
-
subject{ Backup.new(uri).backup_location }
|
84
|
-
|
85
|
-
it "should return correct backup location for mongodump output" do
|
86
|
-
subject.should == "dump/app_development"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
82
|
describe "#mongo_dump_command" do
|
91
83
|
subject{ Backup.new(uri).mongo_dump_command }
|
92
84
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
it "should include switch for host including port" do
|
98
|
-
subject.should include("-h test.mongohq.com:10036")
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should include switch for database" do
|
102
|
-
subject.should include("-d app_development")
|
103
|
-
end
|
104
|
-
|
105
|
-
it "should include switch for username" do
|
106
|
-
subject.should include("--username testuser")
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should include switch for password" do
|
110
|
-
subject.should include("--password pass1")
|
85
|
+
describe "when username/password is provided" do
|
86
|
+
it "should return correct command" do
|
87
|
+
subject.should == "mongodump -h test.mongohq.com:10036 -d app_development -o . --username testuser --password pass1"
|
88
|
+
end
|
111
89
|
end
|
112
90
|
|
113
91
|
describe "when user and password is not included" do
|
114
92
|
let(:backup) { Backup.new("mongodb://test.mongohq.com:10036/app_development").mongo_dump_command }
|
115
93
|
|
116
|
-
it "should
|
117
|
-
backup.
|
118
|
-
end
|
119
|
-
|
120
|
-
it "should not include password switch" do
|
121
|
-
backup.should_not include("--password")
|
94
|
+
it "should return correct command" do
|
95
|
+
backup.should == "mongodump -h test.mongohq.com:10036 -d app_development -o . "
|
122
96
|
end
|
123
97
|
end
|
124
98
|
|
@@ -36,11 +36,11 @@ module Monsoon
|
|
36
36
|
describe "#compress_command" do
|
37
37
|
before(:each) do
|
38
38
|
compress.stub(:filename).and_return("app_development.1234.tar.gz")
|
39
|
-
backup.stub(:
|
39
|
+
backup.stub(:database).and_return("app_development")
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should return correct tar command" do
|
43
|
-
compress.compress_command.should == "tar -czf app_development.1234.tar.gz
|
43
|
+
compress.compress_command.should == "tar -czf app_development.1234.tar.gz app_development"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monsoon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-19 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70101338915580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.8'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70101338915580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: guard-rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70101338915020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70101338915020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70101338914560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70101338914560
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: aws-s3
|
49
|
-
requirement: &
|
49
|
+
requirement: &70101338914120 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70101338914120
|
58
58
|
description: Monsoon is a MongoDB backup tool that allows you to take backups and
|
59
59
|
store them in Amazon S3.
|
60
60
|
email:
|