monsoon 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/monsoon/backup.rb +12 -0
- data/lib/monsoon/compress.rb +2 -2
- data/lib/monsoon/version.rb +1 -1
- data/spec/monsoon/backup_spec.rb +8 -0
- data/spec/monsoon/compress_spec.rb +5 -5
- metadata +9 -9
data/README.md
CHANGED
@@ -17,7 +17,7 @@ To Configure:
|
|
17
17
|
config.bucket = "mongo_backups"
|
18
18
|
config.key = "my_super_secret_aws_key"
|
19
19
|
config.secret = "my_super_secret_aws_secret"
|
20
|
-
config.mongo_uri = "mongodb://user:password@test.mongohq.com:10036/
|
20
|
+
config.mongo_uri = "mongodb://user:password@test.mongohq.com:10036/app_development"
|
21
21
|
end
|
22
22
|
|
23
23
|
To use:
|
data/lib/monsoon/backup.rb
CHANGED
@@ -58,6 +58,18 @@ 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
|
+
|
61
73
|
# Helper to form the mongodump command.
|
62
74
|
#
|
63
75
|
# Examples
|
data/lib/monsoon/compress.rb
CHANGED
@@ -25,11 +25,11 @@ module Monsoon
|
|
25
25
|
# Examples
|
26
26
|
#
|
27
27
|
# Monsoon::Compress(#<Monsoon::Backup>).compress_command
|
28
|
-
# # => "tar -czf app_development_1234.tar.gz app_development"
|
28
|
+
# # => "tar -czf app_development_1234.tar.gz dump/app_development"
|
29
29
|
#
|
30
30
|
# Returns the command as a String.
|
31
31
|
def compress_command
|
32
|
-
"tar -czf
|
32
|
+
"tar -czf #{filename} #{@backup.backup_location}"
|
33
33
|
end
|
34
34
|
|
35
35
|
# Helper to form the tar compress command.
|
data/lib/monsoon/version.rb
CHANGED
data/spec/monsoon/backup_spec.rb
CHANGED
@@ -79,6 +79,14 @@ 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
|
+
|
82
90
|
describe "#mongo_dump_command" do
|
83
91
|
subject{ Backup.new(uri).mongo_dump_command }
|
84
92
|
|
@@ -34,13 +34,13 @@ module Monsoon
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "#compress_command" do
|
37
|
-
|
38
|
-
compress.
|
37
|
+
before(:each) do
|
38
|
+
compress.stub(:filename).and_return("app_development.1234.tar.gz")
|
39
|
+
backup.stub(:backup_location).and_return("dump/app_development")
|
39
40
|
end
|
40
41
|
|
41
|
-
it "should
|
42
|
-
compress.
|
43
|
-
compress.compress_command.should include("app_development.1234.tar.gz")
|
42
|
+
it "should return correct tar command" do
|
43
|
+
compress.compress_command.should == "tar -czf app_development.1234.tar.gz dump/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.3'
|
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: &70268861224460 !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: *70268861224460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: guard-rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70268861224040 !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: *70268861224040
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70268861223580 !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: *70268861223580
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: aws-s3
|
49
|
-
requirement: &
|
49
|
+
requirement: &70268861223160 !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: *70268861223160
|
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:
|