backup 3.0.22 → 3.0.23

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- backup (3.0.22)
4
+ backup (3.0.23)
5
5
  POpen4 (~> 0.1.4)
6
6
  thor (~> 0.14.6)
7
7
 
@@ -54,7 +54,7 @@ GEM
54
54
  i18n (0.6.0)
55
55
  json (1.5.4)
56
56
  libnotify (0.7.1)
57
- mail (2.3.0)
57
+ mail (2.4.1)
58
58
  i18n (>= 0.4.0)
59
59
  mime-types (~> 1.16)
60
60
  treetop (~> 1.4.8)
@@ -116,7 +116,7 @@ DEPENDENCIES
116
116
  httparty (~> 0.7.4)
117
117
  json (~> 1.5.1)
118
118
  libnotify
119
- mail (>= 2.2.15)
119
+ mail (>= 2.4.0)
120
120
  mocha
121
121
  net-scp (~> 1.0.4)
122
122
  net-sftp (~> 2.0.5)
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- Backup 3
2
- ========
1
+ Backup
2
+ ======
3
3
 
4
4
  Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily perform backup operations on both your remote and local environments. It provides you with an elegant DSL in Ruby for modeling your backups. Backup has built-in support for various databases, storage protocols/services, syncers, compressors, encryptors and notifiers which you can mix and match. It was built with modularity, extensibility and simplicity in mind.
5
5
 
@@ -7,16 +7,14 @@ Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily pe
7
7
  [![Still Maintained](http://stillmaintained.com/meskyanichi/backup.png)](http://stillmaintained.com/meskyanichi/backup)
8
8
 
9
9
 
10
- Author
11
- ------
10
+ ### Author
12
11
 
13
12
  **[Michael van Rooijen](http://michaelvanrooijen.com/) ( [@meskyanichi](http://twitter.com/#!/meskyanichi) )**
14
13
 
15
14
  Drop me a message for any questions, suggestions, requests, bugs or submit them to the [issue log](https://github.com/meskyanichi/backup/issues).
16
15
 
17
16
 
18
- Installation
19
- ------------
17
+ ### Installation
20
18
 
21
19
  To get the latest stable version
22
20
 
@@ -25,18 +23,16 @@ To get the latest stable version
25
23
  You can view the list of released versions over at [RubyGems.org (Backup)](https://rubygems.org/gems/backup/versions)
26
24
 
27
25
 
28
- Getting Started
29
- ---------------
26
+ ### Getting Started
30
27
 
31
28
  I recommend you read this README first, and refer to the [wiki pages](https://github.com/meskyanichi/backup/wiki) afterwards. There's also a [Getting Started wiki page](https://github.com/meskyanichi/backup/wiki/Getting-Started).
32
29
 
33
30
  What Backup 3 currently supports
34
- ================================
31
+ --------------------------------
35
32
 
36
33
  Below you find a list of components that Backup currently supports. If you'd like support for components other than the ones listed here, feel free to request them or to fork Backup and add them yourself. Backup is modular and easy to extend.
37
34
 
38
- Database Support
39
- ----------------
35
+ ### Database Support
40
36
 
41
37
  - MySQL
42
38
  - PostgreSQL
@@ -46,16 +42,14 @@ Database Support
46
42
 
47
43
  [Database Wiki Page](https://github.com/meskyanichi/backup/wiki/Databases)
48
44
 
49
- Filesystem Support
50
- ------------------
45
+ ### Filesystem Support
51
46
 
52
47
  - Files
53
48
  - Directories
54
49
 
55
50
  [Archive Wiki Page](https://github.com/meskyanichi/backup/wiki/Archives)
56
51
 
57
- Storage Locations and Services
58
- ------------------------------
52
+ ### Storage Locations and Services
59
53
 
60
54
  - Amazon Simple Storage Service (S3)
61
55
  - Rackspace Cloud Files (Mosso)
@@ -66,8 +60,7 @@ Storage Locations and Services
66
60
 
67
61
  [Storage Wiki Page](https://github.com/meskyanichi/backup/wiki/Storages)
68
62
 
69
- Storage Features
70
- ----------------
63
+ ### Storage Features
71
64
 
72
65
  - **Backup Cycling, applies to:**
73
66
  - Amazon Simple Storage Service (S3)
@@ -90,8 +83,7 @@ Storage Features
90
83
 
91
84
  [Splitter Wiki Page](https://github.com/meskyanichi/backup/wiki/Splitter)
92
85
 
93
- Syncers
94
- -------
86
+ ### Syncers
95
87
 
96
88
  - RSync (Push, Pull and Local)
97
89
  - Amazon S3
@@ -99,8 +91,7 @@ Syncers
99
91
 
100
92
  [Syncer Wiki Page](https://github.com/meskyanichi/backup/wiki/Syncers)
101
93
 
102
- Compressors
103
- -----------
94
+ ### Compressors
104
95
 
105
96
  - Gzip
106
97
  - Bzip2
@@ -109,16 +100,14 @@ Compressors
109
100
 
110
101
  [Compressors Wiki Page](https://github.com/meskyanichi/backup/wiki/Compressors)
111
102
 
112
- Encryptors
113
- ----------
103
+ ### Encryptors
114
104
 
115
105
  - OpenSSL
116
106
  - GPG
117
107
 
118
108
  [Encryptors Wiki Page](https://github.com/meskyanichi/backup/wiki/Encryptors)
119
109
 
120
- Notifiers
121
- ---------
110
+ ### Notifiers
122
111
 
123
112
  - Mail
124
113
  - Twitter
@@ -129,8 +118,7 @@ Notifiers
129
118
 
130
119
  [Notifiers Wiki Page](https://github.com/meskyanichi/backup/wiki/Notifiers)
131
120
 
132
- Supported Ruby versions (Tested with RSpec)
133
- -------------------------------------------
121
+ ### Supported Ruby versions (Tested with RSpec)
134
122
 
135
123
  - Ruby 1.9.3
136
124
  - Ruby 1.9.2
@@ -138,7 +126,7 @@ Supported Ruby versions (Tested with RSpec)
138
126
 
139
127
 
140
128
  A sample Backup configuration file
141
- ==================================
129
+ ----------------------------------
142
130
 
143
131
  This is a Backup configuration file. Check it out and read the explanation below. Backup has a [great wiki](https://github.com/meskyanichi/backup/wiki) which explains each component of Backup in detail.
144
132
 
@@ -302,19 +290,16 @@ With this in place, run `whenever --update-crontab backup` to write the equivale
302
290
  crontab in cron-syntax. Cron will now invoke `backup perform --trigger sample_backup` every 6 hours. Check out the
303
291
  Whenever project page for more information.
304
292
 
305
- Documentation
306
- -------------
293
+ ### Documentation
307
294
 
308
295
  See the [Wiki Pages](https://github.com/meskyanichi/backup/wiki).
309
296
 
310
297
 
311
- Suggestions, Bugs, Requests, Questions
312
- --------------------------------------
298
+ ### Suggestions, Bugs, Requests, Questions
313
299
 
314
300
  View the [issue log](https://github.com/meskyanichi/backup/issues) and post them there.
315
301
 
316
- Contributors
317
- ------------
302
+ ### Contributors
318
303
 
319
304
  <table>
320
305
  <tr>
@@ -444,8 +429,7 @@ Contributors
444
429
  </table>
445
430
 
446
431
 
447
- Want to contribute?
448
- -------------------
432
+ ### Want to contribute?
449
433
 
450
434
  - Fork/Clone the **develop** branch
451
435
  - Write RSpec tests, and test against:
@@ -456,8 +440,8 @@ Want to contribute?
456
440
 
457
441
  I can't guarantee I'll pull every pull request. Also, I may accept your pull request and drastically change parts to improve readability/maintainability. Feel free to discuss about improvements, new functionality/features in the [issue log](https://github.com/meskyanichi/backup/issues) before contributing if you need/want more information.
458
442
 
459
- Easily run tests against all three Ruby versions
460
- ------------------------------------------------
443
+
444
+ ### Easily run tests against all three Ruby versions
461
445
 
462
446
  Install [RVM](https://rvm.beginrescueend.com/) and use it to install Ruby 1.9.3, 1.9.2 and 1.8.7.
463
447
 
@@ -478,9 +462,9 @@ The Backup gem uses [Guard](https://github.com/guard/guard) along with [Guard::R
478
462
  from Backup's root and that's it. It'll now test against all Ruby versions each time you adjust a file in the `lib` or `spec` directories.
479
463
 
480
464
 
481
- Or contribute by writing blogs/tutorials/use cases
482
- --------------------------------------------------
465
+ ### Or contribute by writing blogs/tutorials/use cases
483
466
 
467
+ - http://freelancing-gods.com/posts/backing_up_with_backup
484
468
  - http://erik.debill.org/2011/03/26/csing-backup-with-rails
485
469
  - http://blog.noizeramp.com/2011/03/31/backing-up-backup-ruby-gem/
486
470
  - http://www.sebaugereau.com/using-ruby-to-backup-with-beauty
@@ -7,7 +7,8 @@ module Backup
7
7
  class << self
8
8
 
9
9
  ##
10
- # Name of the database that needs to get dumped
10
+ # Name of the database that needs to get dumped.
11
+ # To dump all databases, set this to `:all` or leave blank.
11
12
  attr_accessor :name
12
13
 
13
14
  ##
@@ -19,6 +19,10 @@ module Backup
19
19
  # : Settings used only by this method:
20
20
  # : `sendmail`, `sendmail_args`
21
21
  #
22
+ # `:exim` [::Mail::Exim]
23
+ # : Settings used only by this method:
24
+ # : `exim`, `exim_args`
25
+ #
22
26
  # `:file` [::Mail::FileDelivery]
23
27
  # : Settings used only by this method:
24
28
  # : `mail_folder`
@@ -82,6 +86,19 @@ module Backup
82
86
  # Example: '-i -t -X/tmp/traffic.log'
83
87
  attr_accessor :sendmail_args
84
88
 
89
+ ##
90
+ # When using the `:exim` `delivery_method` option,
91
+ # this may be used to specify the absolute path to `exim` (if needed)
92
+ # Example: '/usr/sbin/exim'
93
+ attr_accessor :exim
94
+
95
+ ##
96
+ # Optional arguments to pass to `exim`
97
+ # Note that this will override the defaults set by the Mail gem (currently: '-i -t')
98
+ # So, if set here, be sure to set all the arguments you require.
99
+ # Example: '-i -t -X/tmp/traffic.log'
100
+ attr_accessor :exim_args
101
+
85
102
  ##
86
103
  # Folder where mail will be kept when using the `:file` `delivery_method` option.
87
104
  # Default location is '$HOME/backup-mails'
@@ -6,6 +6,7 @@ module Backup
6
6
 
7
7
  ##
8
8
  # Name of the database that needs to get dumped
9
+ # To dump all databases, set this to `:all` or leave blank.
9
10
  attr_accessor :name
10
11
 
11
12
  ##
@@ -43,6 +44,8 @@ module Backup
43
44
 
44
45
  instance_eval(&block) if block_given?
45
46
 
47
+ @name ||= :all
48
+
46
49
  if @utility_path
47
50
  Logger.warn "[DEPRECATED] " +
48
51
  "Database::MySQL#utility_path has been deprecated.\n" +
@@ -68,7 +71,7 @@ module Backup
68
71
  end
69
72
  end
70
73
 
71
- dump_cmd << " > '#{ File.join(@dump_path, name) }.#{ dump_ext }'"
74
+ dump_cmd << " > '#{ File.join(@dump_path, dump_filename) }.#{ dump_ext }'"
72
75
  run(dump_cmd)
73
76
  end
74
77
 
@@ -78,7 +81,13 @@ module Backup
78
81
  # Builds the full mysqldump string based on all attributes
79
82
  def mysqldump
80
83
  "#{ mysqldump_utility } #{ credential_options } #{ connectivity_options } " +
81
- "#{ user_options } #{ name } #{ tables_to_dump } #{ tables_to_skip }"
84
+ "#{ user_options } #{ db_name } #{ tables_to_dump } #{ tables_to_skip }"
85
+ end
86
+
87
+ ##
88
+ # Returns the filename to use for dumping the database(s)
89
+ def dump_filename
90
+ dump_all? ? 'all-databases' : name
82
91
  end
83
92
 
84
93
  ##
@@ -108,11 +117,19 @@ module Backup
108
117
  additional_options.join(' ')
109
118
  end
110
119
 
120
+ ##
121
+ # Returns the database name to use in the mysqldump command.
122
+ # When dumping all databases, the database name is replaced
123
+ # with the command option to dump all databases.
124
+ def db_name
125
+ dump_all? ? '--all-databases' : name
126
+ end
127
+
111
128
  ##
112
129
  # Builds the MySQL syntax for specifying which tables to dump
113
130
  # during the dumping of the database
114
131
  def tables_to_dump
115
- only_tables.join(' ')
132
+ only_tables.join(' ') unless dump_all?
116
133
  end
117
134
 
118
135
  ##
@@ -121,7 +138,15 @@ module Backup
121
138
  def tables_to_skip
122
139
  skip_tables.map do |table|
123
140
  "--ignore-table='#{name}.#{table}'"
124
- end.join(' ')
141
+ end.join(' ') unless dump_all?
142
+ end
143
+
144
+ ##
145
+ # Return true if we're dumping all databases.
146
+ # `name` will be set to :all if it is not set,
147
+ # so this will be true by default
148
+ def dump_all?
149
+ name == :all
125
150
  end
126
151
 
127
152
  end
@@ -47,7 +47,7 @@ module Backup
47
47
 
48
48
  'mail' => {
49
49
  :require => 'mail',
50
- :version => '>= 2.2.15',
50
+ :version => '>= 2.4.0',
51
51
  :for => 'Sending Emails (Mail Notifier)'
52
52
  },
53
53
 
data/lib/backup/logger.rb CHANGED
@@ -62,6 +62,8 @@ module Backup
62
62
 
63
63
  def truncate!(max_bytes = 500_000)
64
64
  log_file = File.join(Config.log_path, 'backup.log')
65
+ return unless File.exist?(log_file)
66
+
65
67
  if File.stat(log_file).size > max_bytes
66
68
  FileUtils.mv(log_file, log_file + '~')
67
69
  File.open(log_file + '~', 'r') do |io_in|
@@ -21,6 +21,10 @@ module Backup
21
21
  # : Settings used only by this method:
22
22
  # : `sendmail`, `sendmail_args`
23
23
  #
24
+ # `:exim` [::Mail::Exim]
25
+ # : Settings used only by this method:
26
+ # : `exim`, `exim_args`
27
+ #
24
28
  # `:file` [::Mail::FileDelivery]
25
29
  # : Settings used only by this method:
26
30
  # : `mail_folder`
@@ -84,6 +88,19 @@ module Backup
84
88
  # Example: '-i -t -X/tmp/traffic.log'
85
89
  attr_accessor :sendmail_args
86
90
 
91
+ ##
92
+ # When using the `:exim` `delivery_method` option,
93
+ # this may be used to specify the absolute path to `exim` (if needed)
94
+ # Example: '/usr/sbin/exim'
95
+ attr_accessor :exim
96
+
97
+ ##
98
+ # Optional arguments to pass to `exim`
99
+ # Note that this will override the defaults set by the Mail gem (currently: '-i -t')
100
+ # So, if set here, be sure to set all the arguments you require.
101
+ # Example: '-i -t -X/tmp/traffic.log'
102
+ attr_accessor :exim_args
103
+
87
104
  ##
88
105
  # Folder where mail will be kept when using the `:file` `delivery_method` option.
89
106
  # Default location is '$HOME/Backup/emails'
@@ -144,7 +161,7 @@ module Backup
144
161
  # Configures the Mail gem by setting the defaults.
145
162
  # Creates and returns a new email, based on the @delivery_method used.
146
163
  def new_email
147
- method = %w{ smtp sendmail file test }.
164
+ method = %w{ smtp sendmail exim file test }.
148
165
  index(@delivery_method.to_s) ? @delivery_method.to_s : 'smtp'
149
166
 
150
167
  options =
@@ -163,6 +180,11 @@ module Backup
163
180
  opts.merge!(:location => File.expand_path(@sendmail)) if @sendmail
164
181
  opts.merge!(:arguments => @sendmail_args) if @sendmail_args
165
182
  opts
183
+ when 'exim'
184
+ opts = {}
185
+ opts.merge!(:location => File.expand_path(@exim)) if @exim
186
+ opts.merge!(:arguments => @exim_args) if @exim_args
187
+ opts
166
188
  when 'file'
167
189
  @mail_folder ||= File.join(Config.root_path, 'emails')
168
190
  { :location => File.expand_path(@mail_folder) }
@@ -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, 22
16
+ MAJOR, MINOR, PATCH = 3, 0, 23
17
17
 
18
18
  ##
19
19
  # Returns the major version ( big release based off of multiple minor releases )
@@ -18,6 +18,8 @@ describe Backup::Configuration::Notifier::Mail do
18
18
  mail.openssl_verify_mode = 'none'
19
19
  mail.sendmail = '/path/to/sendmail'
20
20
  mail.sendmail_args = '-i -t -X/tmp/traffic.log'
21
+ mail.exim = '/path/to/exim'
22
+ mail.exim_args = '-i -t -X/tmp/traffic.log'
21
23
  mail.mail_folder = '/path/to/backup/mails'
22
24
  end
23
25
  end
@@ -38,6 +40,8 @@ describe Backup::Configuration::Notifier::Mail do
38
40
  mail.openssl_verify_mode.should == 'none'
39
41
  mail.sendmail.should == '/path/to/sendmail'
40
42
  mail.sendmail_args.should == '-i -t -X/tmp/traffic.log'
43
+ mail.exim.should == '/path/to/exim'
44
+ mail.exim_args.should == '-i -t -X/tmp/traffic.log'
41
45
  mail.mail_folder.should == '/path/to/backup/mails'
42
46
  end
43
47
 
@@ -59,6 +63,8 @@ describe Backup::Configuration::Notifier::Mail do
59
63
  mail.openssl_verify_mode.should == nil
60
64
  mail.sendmail.should == nil
61
65
  mail.sendmail_args.should == nil
66
+ mail.exim.should == nil
67
+ mail.exim_args.should == nil
62
68
  mail.mail_folder.should == nil
63
69
  end
64
70
  end
@@ -44,7 +44,7 @@ describe Backup::Database::MySQL do
44
44
  it 'should use default values' do
45
45
  db = Backup::Database::MySQL.new(model)
46
46
 
47
- db.name.should be_nil
47
+ db.name.should == :all
48
48
  db.username.should be_nil
49
49
  db.password.should be_nil
50
50
  db.host.should be_nil
@@ -101,6 +101,7 @@ describe Backup::Database::MySQL do
101
101
  db.instance_variable_set(:@dump_path, '/dump/path')
102
102
 
103
103
  db.stubs(:mysqldump).returns('mysqldump_command')
104
+ db.stubs(:dump_filename).returns('dump_filename')
104
105
  end
105
106
 
106
107
  context 'when no compressor is configured' do
@@ -110,7 +111,7 @@ describe Backup::Database::MySQL do
110
111
 
111
112
  it 'should run mysqldump without compression' do
112
113
  db.expects(:run).in_sequence(s).with(
113
- "mysqldump_command > '/dump/path/mydatabase.sql'"
114
+ "mysqldump_command > '/dump/path/dump_filename.sql'"
114
115
  )
115
116
  db.perform!
116
117
  end
@@ -125,7 +126,7 @@ describe Backup::Database::MySQL do
125
126
 
126
127
  it 'should run mysqldump with compression' do
127
128
  db.expects(:run).in_sequence(s).with(
128
- "mysqldump_command | gzip > '/dump/path/mydatabase.sql.gz'"
129
+ "mysqldump_command | gzip > '/dump/path/dump_filename.sql.gz'"
129
130
  )
130
131
  db.perform!
131
132
  end
@@ -134,12 +135,35 @@ describe Backup::Database::MySQL do
134
135
  end # describe '#perform!'
135
136
 
136
137
  describe '#mysqldump' do
138
+ before do
139
+ db.stubs(:mysqldump_utility).returns(:mysqldump_utility)
140
+ db.stubs(:credential_options).returns(:credential_options)
141
+ db.stubs(:connectivity_options).returns(:connectivity_options)
142
+ db.stubs(:user_options).returns(:user_options)
143
+ db.stubs(:db_name).returns(:db_name)
144
+ db.stubs(:tables_to_dump).returns(:tables_to_dump)
145
+ db.stubs(:tables_to_skip).returns(:tables_to_skip)
146
+ end
147
+
137
148
  it 'should return the mysqldump command string' do
138
149
  db.send(:mysqldump).should ==
139
- "/path/to/mysqldump --user='someuser' --password='secret' " +
140
- "--host='localhost' --port='123' --socket='/mysql.sock' " +
141
- "--single-transaction --quick mydatabase users pirates " +
142
- "--ignore-table='mydatabase.logs' --ignore-table='mydatabase.profiles'"
150
+ "mysqldump_utility credential_options connectivity_options " +
151
+ "user_options db_name tables_to_dump tables_to_skip"
152
+ end
153
+ end
154
+
155
+ describe '#dump_filename' do
156
+ context 'when @name is set to :all' do
157
+ before { db.name = :all }
158
+ it 'should set the filename to "all-databases"' do
159
+ db.send(:dump_filename).should == 'all-databases'
160
+ end
161
+ end
162
+
163
+ context 'when @name is not set to :all' do
164
+ it 'should return @name' do
165
+ db.send(:dump_filename).should == 'mydatabase'
166
+ end
143
167
  end
144
168
  end
145
169
 
@@ -196,6 +220,21 @@ describe Backup::Database::MySQL do
196
220
  end
197
221
  end
198
222
 
223
+ describe '#db_name' do
224
+ context 'when @name is set to :all' do
225
+ before { db.name = :all }
226
+ it 'should return the mysqldump flag to dump all databases' do
227
+ db.send(:db_name).should == '--all-databases'
228
+ end
229
+ end
230
+
231
+ context 'when @name is not set to :all' do
232
+ it 'should return @name' do
233
+ db.send(:db_name).should == 'mydatabase'
234
+ end
235
+ end
236
+ end
237
+
199
238
  describe '#tables_to_dump' do
200
239
  it 'should return a string for the mysqldump selected table to dump option' do
201
240
  db.send(:tables_to_dump).should == 'users pirates'
@@ -207,6 +246,13 @@ describe Backup::Database::MySQL do
207
246
  db.send(:tables_to_dump).should == ''
208
247
  end
209
248
  end
249
+
250
+ context 'when dump_all? is true' do
251
+ before { db.stubs(:dump_all?).returns(true) }
252
+ it 'should return nil' do
253
+ db.send(:tables_to_dump).should be_nil
254
+ end
255
+ end
210
256
  end
211
257
 
212
258
  describe '#tables_to_skip' do
@@ -221,5 +267,27 @@ describe Backup::Database::MySQL do
221
267
  db.send(:tables_to_skip).should == ''
222
268
  end
223
269
  end
270
+
271
+ context 'when dump_all? is true' do
272
+ before { db.stubs(:dump_all?).returns(true) }
273
+ it 'should return nil' do
274
+ db.send(:tables_to_skip).should be_nil
275
+ end
276
+ end
277
+ end
278
+
279
+ describe '#dump_all?' do
280
+ context 'when @name is set to :all' do
281
+ before { db.name = :all }
282
+ it 'should return true' do
283
+ db.send(:dump_all?).should be_true
284
+ end
285
+ end
286
+
287
+ context 'when @name is not set to :all' do
288
+ it 'should return false' do
289
+ db.send(:dump_all?).should be_false
290
+ end
291
+ end
224
292
  end
225
293
  end
data/spec/logger_spec.rb CHANGED
@@ -145,13 +145,23 @@ describe Backup::Logger do
145
145
  end # describe '#clear!'
146
146
 
147
147
  describe '#truncate!' do
148
+ context 'when log file does not exist' do
149
+ before { File.stubs(:exist?).returns(false) }
150
+ it 'should do nothing' do
151
+ File.expects(:stat).never
152
+ subject.truncate!
153
+ end
154
+ end
155
+
148
156
  context 'when log file is <= max_bytes' do
157
+ before { File.stubs(:exist?).returns(true) }
149
158
  it 'should do nothing' do
150
159
  stat = mock
160
+ File.expects(:stat).twice.with(
161
+ File.join(Backup::Config.log_path, 'backup.log')
162
+ ).returns(stat)
163
+
151
164
  [1, 2].each do |size|
152
- File.expects(:stat).with(
153
- File.join(Backup::Config.log_path, 'backup.log')
154
- ).returns(stat)
155
165
  stat.expects(:size).returns(size)
156
166
 
157
167
  FileUtils.expects(:mv).never
@@ -19,6 +19,8 @@ describe Backup::Notifier::Mail do
19
19
 
20
20
  mail.sendmail = '/path/to/sendmail'
21
21
  mail.sendmail_args = '-i -t -X/tmp/traffic.log'
22
+ mail.exim = '/path/to/exim'
23
+ mail.exim_args = '-i -t -X/tmp/traffic.log'
22
24
 
23
25
  mail.mail_folder = '/path/to/backup/mails'
24
26
  end
@@ -40,6 +42,8 @@ describe Backup::Notifier::Mail do
40
42
 
41
43
  notifier.sendmail.should == '/path/to/sendmail'
42
44
  notifier.sendmail_args.should == '-i -t -X/tmp/traffic.log'
45
+ notifier.exim.should == '/path/to/exim'
46
+ notifier.exim_args.should == '-i -t -X/tmp/traffic.log'
43
47
 
44
48
  notifier.mail_folder.should == '/path/to/backup/mails'
45
49
 
@@ -73,6 +77,8 @@ describe Backup::Notifier::Mail do
73
77
 
74
78
  notifier.sendmail.should be_nil
75
79
  notifier.sendmail_args.should be_nil
80
+ notifier.exim.should be_nil
81
+ notifier.exim_args.should be_nil
76
82
 
77
83
  notifier.mail_folder.should be_nil
78
84
 
@@ -233,6 +239,25 @@ describe Backup::Notifier::Mail do
233
239
  end
234
240
  end
235
241
 
242
+ context 'when delivery_method is :exim' do
243
+ before { notifier.delivery_method = :exim }
244
+ it 'should return an email using Exim' do
245
+ email = notifier.send(:new_email)
246
+ email.delivery_method.should be_an_instance_of ::Mail::Exim
247
+ end
248
+
249
+ it 'should set the proper options' do
250
+ email = notifier.send(:new_email)
251
+
252
+ email.to.should == ['my.receiver.email@gmail.com']
253
+ email.from.should == ['my.sender.email@gmail.com']
254
+
255
+ settings = email.delivery_method.settings
256
+ settings[:location].should == '/path/to/exim'
257
+ settings[:arguments].should == '-i -t -X/tmp/traffic.log'
258
+ end
259
+ end
260
+
236
261
  context 'when delivery_method is :file' do
237
262
  before { notifier.delivery_method = :file }
238
263
  it 'should return an email using FileDelievery' do
@@ -2,6 +2,7 @@
2
2
  # MySQL [Database]
3
3
  #
4
4
  database MySQL do |db|
5
+ # To dump all databases, set db.name = :all (or leave blank)
5
6
  db.name = "my_database_name"
6
7
  db.username = "my_username"
7
8
  db.password = "my_password"
metadata CHANGED
@@ -1,63 +1,45 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: backup
3
- version: !ruby/object:Gem::Version
4
- hash: 43
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.23
5
5
  prerelease:
6
- segments:
7
- - 3
8
- - 0
9
- - 22
10
- version: 3.0.22
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Michael van Rooijen
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-31 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: thor
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70242387506700 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 43
29
- segments:
30
- - 0
31
- - 14
32
- - 6
20
+ - !ruby/object:Gem::Version
33
21
  version: 0.14.6
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: POpen4
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70242387506700
25
+ - !ruby/object:Gem::Dependency
26
+ name: POpen4
27
+ requirement: &70242387506180 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 19
45
- segments:
46
- - 0
47
- - 1
48
- - 4
31
+ - !ruby/object:Gem::Version
49
32
  version: 0.1.4
50
33
  type: :runtime
51
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *70242387506180
52
36
  description:
53
37
  email: meskyanichi@gmail.com
54
- executables:
38
+ executables:
55
39
  - backup
56
40
  extensions: []
57
-
58
41
  extra_rdoc_files: []
59
-
60
- files:
42
+ files:
61
43
  - .gitignore
62
44
  - .travis.yml
63
45
  - Gemfile
@@ -297,36 +279,31 @@ files:
297
279
  - templates/storage/dropbox/cache_file_written.erb
298
280
  homepage: http://rubygems.org/gems/backup
299
281
  licenses: []
300
-
301
282
  post_install_message:
302
283
  rdoc_options: []
303
-
304
- require_paths:
284
+ require_paths:
305
285
  - lib
306
- required_ruby_version: !ruby/object:Gem::Requirement
286
+ required_ruby_version: !ruby/object:Gem::Requirement
307
287
  none: false
308
- requirements:
309
- - - ">="
310
- - !ruby/object:Gem::Version
311
- hash: 3
312
- segments:
313
- - 0
314
- version: "0"
315
- required_rubygems_version: !ruby/object:Gem::Requirement
288
+ requirements:
289
+ - - ! '>='
290
+ - !ruby/object:Gem::Version
291
+ version: '0'
292
+ required_rubygems_version: !ruby/object:Gem::Requirement
316
293
  none: false
317
- requirements:
318
- - - ">="
319
- - !ruby/object:Gem::Version
320
- hash: 3
321
- segments:
322
- - 0
323
- version: "0"
294
+ requirements:
295
+ - - ! '>='
296
+ - !ruby/object:Gem::Version
297
+ version: '0'
324
298
  requirements: []
325
-
326
299
  rubyforge_project:
327
- rubygems_version: 1.8.10
300
+ rubygems_version: 1.8.15
328
301
  signing_key:
329
302
  specification_version: 3
330
- summary: Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily perform backup operations on both your remote and local environments. It provides you with an elegant DSL in Ruby for modeling your backups. Backup has built-in support for various databases, storage protocols/services, syncers, compressors, encryptors and notifiers which you can mix and match. It was built with modularity, extensibility and simplicity in mind.
303
+ summary: Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily
304
+ perform backup operations on both your remote and local environments. It provides
305
+ you with an elegant DSL in Ruby for modeling your backups. Backup has built-in support
306
+ for various databases, storage protocols/services, syncers, compressors, encryptors
307
+ and notifiers which you can mix and match. It was built with modularity, extensibility
308
+ and simplicity in mind.
331
309
  test_files: []
332
-