monsoon 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,14 +17,12 @@ 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.backup_directory = "tmp"
21
20
  config.mongo_uri = "mongodb://user:password@test.mongohq.com:10036/add_development"
22
21
  end
23
22
 
24
23
  To use:
25
24
 
26
- client = Monsoon::Client.new
27
- client.run
25
+ Monsoon.perform
28
26
 
29
27
 
30
28
  Requirements
@@ -3,11 +3,8 @@ require 'uri'
3
3
  module Monsoon
4
4
  class Backup
5
5
 
6
- attr_reader :backup_directory
7
-
8
- def initialize(uri, backup_directory = "tmp")
6
+ def initialize(uri)
9
7
  @uri = uri
10
- @backup_directory = backup_directory
11
8
  end
12
9
 
13
10
  # Run the Monsoon Backup process.
@@ -66,12 +63,12 @@ module Monsoon
66
63
  # Examples
67
64
  #
68
65
  # Monsoon::Backup("mongodb://test.mongohq.com:10036/app_development").mongo_dump_command
69
- # # => "mongodump -h test.mongohq.com:10036 -d app_development -o tmp"
66
+ # # => "mongodump -h test.mongohq.com:10036 -d app_development"
70
67
  #
71
68
  # Returns the command as a String.
72
69
  def mongo_dump_command
73
70
  cmd = ""
74
- cmd = "mongodump -h #{config['host']}:#{config['port']} -d #{config['database']} -o #{@backup_directory} "
71
+ cmd = "mongodump -h #{config['host']}:#{config['port']} -d #{config['database']} "
75
72
  cmd += "--username #{config['username']} --password #{config['password']}" unless config["username"].nil? and config["password"].nil?
76
73
  cmd
77
74
  end
@@ -1,11 +1,10 @@
1
1
  module Monsoon
2
2
  class Client
3
3
 
4
- def initialize(bucket = Monsoon.bucket, key = Monsoon.key, secret = Monsoon.secret, backup_directory = Monsoon.backup_directory, mongo_uri = Monsoon.mongo_uri)
4
+ def initialize(bucket = Monsoon.bucket, key = Monsoon.key, secret = Monsoon.secret, mongo_uri = Monsoon.mongo_uri)
5
5
  @bucket = bucket
6
6
  @key = key
7
7
  @secret = secret
8
- @backup_directory = backup_directory
9
8
  @mongo_uri = mongo_uri
10
9
  end
11
10
 
@@ -42,7 +41,7 @@ module Monsoon
42
41
  #
43
42
  # Returns an instance of the Monsoon::Client object
44
43
  def backup
45
- Backup.new(@mongo_uri, @backup_directory)
44
+ Backup.new(@mongo_uri)
46
45
  end
47
46
 
48
47
  # Creates an instnace of the Monsoon::Compress class
@@ -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 tmp"
28
+ # # => "tar -czf app_development_1234.tar.gz app_development"
29
29
  #
30
30
  # Returns the command as a String.
31
31
  def compress_command
32
- "tar -czf #{filename} #{@backup.backup_directory}"
32
+ "tar -czf #{filename} #{@backup.database}"
33
33
  end
34
34
 
35
35
  # Helper to form the tar compress command.
@@ -1,3 +1,3 @@
1
1
  module Monsoon
2
- VERSION = "0.1"
2
+ VERSION = "0.2"
3
3
  end
data/lib/monsoon.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Monsoon
2
2
 
3
3
  class << self
4
- attr_accessor :bucket, :key, :secret, :backup_directory, :mongo_uri
4
+ attr_accessor :bucket, :key, :secret, :mongo_uri
5
5
 
6
6
  # config/initializers/monsoon.rb (for instance)
7
7
  #
@@ -9,7 +9,6 @@ module Monsoon
9
9
  # config.bucket = 'backups'
10
10
  # config.key = 'consumer_key'
11
11
  # config.secret = 'consumer_secret'
12
- # config.backup_directory = 'data'
13
12
  # config.mongo_uri = 'mongodb://testuser:pass1@test.mongohq.com:10036/app_development'
14
13
  # end
15
14
  #
@@ -13,18 +13,6 @@ module Monsoon
13
13
  backup.instance_variable_get(:@uri).should == uri
14
14
  end
15
15
 
16
- it "should set the @directory instance variable to default directory if none is provided" do
17
- backup.instance_variable_get(:@backup_directory).should == "tmp"
18
- end
19
-
20
- it "should set the @directory instance variable to specified directory" do
21
- backup = Backup.new(uri, "tmp/data")
22
- backup.instance_variable_get(:@backup_directory).should == "tmp/data"
23
- end
24
-
25
- it "should be able to read backup_directory instance variable" do
26
- backup.backup_directory.should == "tmp"
27
- end
28
16
  end
29
17
 
30
18
  describe "#run" do
@@ -114,15 +102,6 @@ module Monsoon
114
102
  subject.should include("--password pass1")
115
103
  end
116
104
 
117
- it "should include switch for output directory" do
118
- subject.should include("-o tmp")
119
- end
120
-
121
- it "should change output directory if intialized with it" do
122
- Backup.new(uri, "tmp/data").mongo_dump_command.should include("-o tmp/data")
123
-
124
- end
125
-
126
105
  describe "when user and password is not included" do
127
106
  let(:backup) { Backup.new("mongodb://test.mongohq.com:10036/app_development").mongo_dump_command }
128
107
 
@@ -6,9 +6,8 @@ module Monsoon
6
6
  let(:bucket) { "bucket" }
7
7
  let(:key) { "key" }
8
8
  let(:secret) { "secret" }
9
- let(:backup_directory) { "tmp" }
10
9
  let(:mongo_uri) { "mongodb://testuser:pass1@test.mongohq.com:10036/app_development" }
11
- let(:client) { Monsoon::Client.new(bucket, key, secret, backup_directory, mongo_uri) }
10
+ let(:client) { Monsoon::Client.new(bucket, key, secret, mongo_uri) }
12
11
 
13
12
  describe "initalization" do
14
13
  it "should set the @bucket instance variable" do
@@ -23,10 +22,6 @@ module Monsoon
23
22
  client.instance_variable_get(:@secret).should == secret
24
23
  end
25
24
 
26
- it "should set the @backup_directory instance variable" do
27
- client.instance_variable_get(:@backup_directory).should == backup_directory
28
- end
29
-
30
25
  it "should set the @mongo_uri instance variable" do
31
26
  client.instance_variable_get(:@mongo_uri).should == mongo_uri
32
27
  end
@@ -50,12 +45,6 @@ module Monsoon
50
45
  c.instance_variable_get(:@secret).should == "secret"
51
46
  end
52
47
 
53
- it "should set instance variable backup_directory" do
54
- Monsoon.backup_directory = "tmp/data"
55
- c = Monsoon::Client.new
56
- c.instance_variable_get(:@backup_directory).should == "tmp/data"
57
- end
58
-
59
48
  it "should set instance variable mongo_uri" do
60
49
  Monsoon.mongo_uri = "mongo://localhost"
61
50
  c = Monsoon::Client.new
@@ -66,7 +55,7 @@ module Monsoon
66
55
  end
67
56
 
68
57
  describe "#run" do
69
- let(:backup) { Backup.new(mongo_uri, backup_directory) }
58
+ let(:backup) { Backup.new(mongo_uri) }
70
59
  let(:compress) { Compress.new(backup) }
71
60
  let(:store) { Store.new(compress, bucket, key, secret) }
72
61
 
@@ -99,13 +88,13 @@ module Monsoon
99
88
 
100
89
  describe "#backup" do
101
90
  it "should initalize a new Backup object" do
102
- Backup.should_receive(:new).with(mongo_uri, backup_directory)
91
+ Backup.should_receive(:new).with(mongo_uri)
103
92
  client.backup
104
93
  end
105
94
  end
106
95
 
107
96
  describe "#compress" do
108
- let(:backup) { Backup.new(mongo_uri, backup_directory) }
97
+ let(:backup) { Backup.new(mongo_uri) }
109
98
 
110
99
  it "should initalize a new Compress object" do
111
100
  Compress.should_receive(:new).with(backup)
@@ -114,7 +103,7 @@ module Monsoon
114
103
  end
115
104
 
116
105
  describe "#store" do
117
- let(:backup) { Backup.new(mongo_uri, backup_directory) }
106
+ let(:backup) { Backup.new(mongo_uri) }
118
107
  let(:compress) { Compress.new(backup) }
119
108
 
120
109
  it "should initalize a new Compress object" do
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  module Monsoon
4
4
 
5
5
  describe Compress do
6
- let(:backup) { double("backup", backup_directory: "tmp", database: "app_development") }
6
+ let(:backup) { double("backup", database: "app_development") }
7
7
  let(:compress) { Compress.new(backup) }
8
8
 
9
9
  describe "initalization" do
data/spec/monsoon_spec.rb CHANGED
@@ -5,7 +5,6 @@ describe Monsoon do
5
5
  Monsoon.bucket = nil
6
6
  Monsoon.key = nil
7
7
  Monsoon.secret = nil
8
- Monsoon.backup_directory = nil
9
8
  Monsoon.mongo_uri = nil
10
9
  end
11
10
 
@@ -24,14 +23,12 @@ describe Monsoon do
24
23
  config.bucket = "backups"
25
24
  config.key = "key"
26
25
  config.secret = "secret"
27
- config.backup_directory = "tmp/data"
28
26
  config.mongo_uri = "mongodb://testuser:pass1@test.mongohq.com:10036/app_development"
29
27
  end
30
28
 
31
29
  Monsoon.bucket.should == "backups"
32
30
  Monsoon.key.should == "key"
33
31
  Monsoon.secret.should == "secret"
34
- Monsoon.backup_directory.should == "tmp/data"
35
32
  Monsoon.mongo_uri.should == "mongodb://testuser:pass1@test.mongohq.com:10036/app_development"
36
33
  end
37
34
 
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.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-17 00:00:00.000000000Z
12
+ date: 2012-01-19 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70222012651180 !ruby/object:Gem::Requirement
16
+ requirement: &70306214033220 !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: *70222012651180
24
+ version_requirements: *70306214033220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: guard-rspec
27
- requirement: &70222012650760 !ruby/object:Gem::Requirement
27
+ requirement: &70306214032760 !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: *70222012650760
35
+ version_requirements: *70306214032760
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70222012650300 !ruby/object:Gem::Requirement
38
+ requirement: &70306214032300 !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: *70222012650300
46
+ version_requirements: *70306214032300
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aws-s3
49
- requirement: &70222024478080 !ruby/object:Gem::Requirement
49
+ requirement: &70306214031700 !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: *70222024478080
57
+ version_requirements: *70306214031700
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: