backup 3.0.9 → 3.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,10 @@ module Backup
22
22
  # Flag to enable mirroring
23
23
  attr_accessor :mirror
24
24
 
25
+ ##
26
+ # Additional options for the s3sync cli
27
+ attr_accessor :additional_options
28
+
25
29
  end
26
30
  end
27
31
  end
@@ -20,6 +20,10 @@ module Backup
20
20
  # Flag to enable mirroring
21
21
  attr_accessor :mirror
22
22
 
23
+ ##
24
+ # Additional options for the s3sync cli
25
+ attr_accessor :additional_options
26
+
23
27
  ##
24
28
  # Instantiates a new S3 Syncer object and sets the default configuration
25
29
  # specified in the Backup::Configuration::Syncer::S3. Then it sets the object
@@ -28,9 +32,10 @@ module Backup
28
32
  def initialize(&block)
29
33
  load_defaults!
30
34
 
31
- @path ||= 'backups'
32
- @directories ||= Array.new
33
- @mirror ||= false
35
+ @path ||= 'backups'
36
+ @directories ||= Array.new
37
+ @mirror ||= false
38
+ @additional_options ||= []
34
39
 
35
40
  instance_eval(&block) if block_given?
36
41
 
@@ -56,7 +61,7 @@ module Backup
56
61
  ##
57
62
  # Returns all the specified S3Sync options, concatenated, ready for the CLI
58
63
  def options
59
- [verbose, recursive, mirror].compact.join("\s")
64
+ ([verbose, recursive, mirror] + additional_options).compact.join("\s")
60
65
  end
61
66
 
62
67
  ##
@@ -13,7 +13,7 @@ module Backup
13
13
  # Defines the minor version
14
14
  # PATCH:
15
15
  # Defines the patch version
16
- MAJOR, MINOR, PATCH = 3, 0, 9
16
+ MAJOR, MINOR, PATCH = 3, 0, 10
17
17
 
18
18
  ##
19
19
  # Returns the major version ( big release based off of multiple minor releases )
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Syncer::S3 do
6
+ before do
7
+ Backup::Configuration::Syncer::S3.defaults do |s3|
8
+ s3.access_key_id = 'my_access_key_id'
9
+ s3.secret_access_key = 'my_secret_access_key'
10
+ s3.bucket = 'my-bucket'
11
+ s3.path = '/backups/'
12
+ s3.directories = '/directories/to/backup/'
13
+ s3.mirror = true
14
+ s3.additional_options = ['--exclude="*.rb"']
15
+ end
16
+ end
17
+
18
+ it 'should set the default s3 configuration' do
19
+ s3 = Backup::Configuration::Syncer::S3
20
+ s3.access_key_id.should == 'my_access_key_id'
21
+ s3.secret_access_key.should == 'my_secret_access_key'
22
+ s3.bucket.should == 'my-bucket'
23
+ s3.path.should == '/backups/'
24
+ s3.directories.should == '/directories/to/backup/'
25
+ s3.mirror.should == true
26
+ s3.additional_options.should == ['--exclude="*.rb"']
27
+ end
28
+
29
+ describe '#clear_defaults!' do
30
+ it 'should clear all the defaults, resetting them to nil' do
31
+ Backup::Configuration::Syncer::S3.clear_defaults!
32
+
33
+ s3 = Backup::Configuration::Syncer::S3
34
+ s3.access_key_id.should == nil
35
+ s3.secret_access_key.should == nil
36
+ s3.bucket.should == nil
37
+ s3.path.should == nil
38
+ s3.directories.should == nil
39
+ s3.mirror.should == nil
40
+ s3.additional_options.should == nil
41
+ end
42
+ end
43
+ end
@@ -57,6 +57,7 @@ describe Backup::Syncer::S3 do
57
57
  s3.path.should == 'backups'
58
58
  s3.directories.should == Array.new
59
59
  s3.mirror.should == nil
60
+ s3.additional_options.should == []
60
61
  end
61
62
 
62
63
  describe '#mirror' do
@@ -86,6 +87,13 @@ describe Backup::Syncer::S3 do
86
87
  end
87
88
  end
88
89
 
90
+ describe '#additional_options' do
91
+ it do
92
+ s3.additional_options = ['--exclude="*.rb"']
93
+ s3.options.should == '--verbose --recursive --delete --exclude="*.rb"'
94
+ end
95
+ end
96
+
89
97
  describe '#verbose' do
90
98
  it do
91
99
  s3.verbose.should == '--verbose'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: backup
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.0.9
5
+ version: 3.0.10
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael van Rooijen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-18 00:00:00 +01:00
13
+ date: 2011-03-20 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -144,6 +144,7 @@ files:
144
144
  - spec/configuration/storage/scp_spec.rb
145
145
  - spec/configuration/storage/sftp_spec.rb
146
146
  - spec/configuration/syncer/rsync_spec.rb
147
+ - spec/configuration/syncer/s3_spec.rb
147
148
  - spec/database/base_spec.rb
148
149
  - spec/database/mongodb_spec.rb
149
150
  - spec/database/mysql_spec.rb