backup 3.0.16 → 3.0.18

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.
Files changed (81) hide show
  1. data/.travis.yml +10 -0
  2. data/Gemfile.lock +50 -47
  3. data/Guardfile +3 -3
  4. data/README.md +136 -81
  5. data/backup.gemspec +3 -2
  6. data/bin/backup +36 -15
  7. data/lib/backup.rb +30 -20
  8. data/lib/backup/cli.rb +30 -2
  9. data/lib/backup/compressor/lzma.rb +63 -0
  10. data/lib/backup/configuration/compressor/lzma.rb +23 -0
  11. data/lib/backup/configuration/helpers.rb +10 -4
  12. data/lib/backup/configuration/notifier/mail.rb +5 -0
  13. data/lib/backup/configuration/storage/dropbox.rb +19 -4
  14. data/lib/backup/configuration/storage/ftp.rb +4 -0
  15. data/lib/backup/configuration/storage/local.rb +17 -0
  16. data/lib/backup/configuration/storage/ninefold.rb +20 -0
  17. data/lib/backup/configuration/storage/rsync.rb +4 -0
  18. data/lib/backup/database/postgresql.rb +12 -3
  19. data/lib/backup/database/redis.rb +5 -1
  20. data/lib/backup/dependency.rb +11 -12
  21. data/lib/backup/encryptor/gpg.rb +2 -0
  22. data/lib/backup/exception/command_failed.rb +8 -0
  23. data/lib/backup/finder.rb +49 -9
  24. data/lib/backup/notifier/mail.rb +7 -1
  25. data/lib/backup/notifier/twitter.rb +1 -1
  26. data/lib/backup/storage/dropbox.rb +93 -16
  27. data/lib/backup/storage/ftp.rb +10 -3
  28. data/lib/backup/storage/local.rb +78 -0
  29. data/lib/backup/storage/ninefold.rb +96 -0
  30. data/lib/backup/storage/rsync.rb +37 -20
  31. data/lib/backup/storage/s3.rb +1 -1
  32. data/lib/backup/storage/scp.rb +1 -1
  33. data/lib/backup/syncer/rsync.rb +1 -1
  34. data/lib/backup/version.rb +1 -1
  35. data/lib/templates/compressor/lzma +7 -0
  36. data/lib/templates/storage/dropbox +2 -2
  37. data/lib/templates/storage/ftp +8 -7
  38. data/lib/templates/storage/local +7 -0
  39. data/lib/templates/storage/ninefold +9 -0
  40. data/lib/templates/storage/rsync +1 -0
  41. data/spec/archive_spec.rb +0 -1
  42. data/spec/compressor/bzip2_spec.rb +0 -1
  43. data/spec/compressor/gzip_spec.rb +0 -1
  44. data/spec/compressor/lzma_spec.rb +58 -0
  45. data/spec/configuration/compressor/bzip2_spec.rb +28 -0
  46. data/spec/configuration/compressor/lzma_spec.rb +28 -0
  47. data/spec/configuration/database/mongodb_spec.rb +16 -0
  48. data/spec/configuration/database/mysql_spec.rb +17 -0
  49. data/spec/configuration/database/postgresql_spec.rb +17 -0
  50. data/spec/configuration/database/redis_spec.rb +16 -0
  51. data/spec/configuration/notifier/campfire_spec.rb +11 -0
  52. data/spec/configuration/notifier/mail_spec.rb +20 -0
  53. data/spec/configuration/notifier/presently_spec.rb +34 -0
  54. data/spec/configuration/notifier/twitter_spec.rb +12 -0
  55. data/spec/configuration/storage/dropbox_spec.rb +0 -6
  56. data/spec/configuration/storage/ftp_spec.rb +15 -12
  57. data/spec/configuration/storage/local_spec.rb +28 -0
  58. data/spec/configuration/storage/ninefold_spec.rb +31 -0
  59. data/spec/configuration/storage/rsync_spec.rb +2 -0
  60. data/spec/database/mongodb_spec.rb +0 -1
  61. data/spec/database/mysql_spec.rb +0 -1
  62. data/spec/database/postgresql_spec.rb +31 -11
  63. data/spec/database/redis_spec.rb +9 -4
  64. data/spec/encryptor/gpg_spec.rb +1 -1
  65. data/spec/encryptor/open_ssl_spec.rb +0 -1
  66. data/spec/logger_spec.rb +32 -24
  67. data/spec/model_spec.rb +15 -15
  68. data/spec/spec_helper.rb +8 -4
  69. data/spec/storage/base_spec.rb +0 -4
  70. data/spec/storage/cloudfiles_spec.rb +0 -1
  71. data/spec/storage/dropbox_spec.rb +44 -14
  72. data/spec/storage/ftp_spec.rb +26 -15
  73. data/spec/storage/local_spec.rb +83 -0
  74. data/spec/storage/ninefold_spec.rb +142 -0
  75. data/spec/storage/object_spec.rb +1 -1
  76. data/spec/storage/rsync_spec.rb +17 -7
  77. data/spec/storage/s3_spec.rb +4 -3
  78. data/spec/storage/scp_spec.rb +0 -1
  79. data/spec/storage/sftp_spec.rb +0 -1
  80. data/spec/syncer/rsync_spec.rb +8 -8
  81. metadata +62 -36
@@ -25,7 +25,8 @@ Gem::Specification.new do |gem|
25
25
  gem.executables = ['backup']
26
26
 
27
27
  ##
28
- # Production gem dependencies
29
- gem.add_dependency 'thor', ['~> 0.14.6']
28
+ # Gem dependencies
29
+ gem.add_dependency 'thor', ['~> 0.14.6']
30
+ gem.add_dependency 'popen4', ['~> 0.1.2']
30
31
 
31
32
  end
data/bin/backup CHANGED
@@ -1,4 +1,4 @@
1
- #! /usr/bin/env ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  ##
4
4
  # Load RubyGems for Ruby <= 1.8.7
@@ -7,12 +7,14 @@ require 'tempfile'
7
7
  require 'fileutils'
8
8
 
9
9
  ##
10
- # Load Thor for the Command Line Interface
10
+ # Load Thor for the CLI and POpen4 for reading unix process status
11
11
  begin
12
12
  require 'thor'
13
+ require 'popen4'
13
14
  rescue LoadError
14
- puts 'Backup uses Thor as CLI (Command Line Interface).'
15
- puts 'Please install Thor first: `gem install thor`'
15
+ puts "\nBackup requires Thor to load the CLI (Command Line Interface) and POpen4 to determine the status of unix processes."
16
+ puts "Please install both Thor and POpen4 first:\n\ngem install thor -v '~> 0.14.6'\ngem install popen4 -v '~> 0.1.2'"
17
+ exit 1
16
18
  end
17
19
 
18
20
  ##
@@ -29,15 +31,16 @@ class BackupCLI < Thor
29
31
  ##
30
32
  # [Perform]
31
33
  # Performs the backup process. The only required option is the --trigger [-t].
32
- # If the other options (--config_file, --data_path, --tmp_path) aren't specified
34
+ # If the other options (--config-file, --data-path, --cache--path, --tmp-path) aren't specified
33
35
  # it'll fallback to the (good) defaults
34
36
  method_option :trigger, :type => :string, :aliases => ['-t', '--triggers'], :required => true
35
37
  method_option :config_file, :type => :string, :aliases => '-c'
36
38
  method_option :data_path, :type => :string, :aliases => '-d'
37
39
  method_option :log_path, :type => :string, :aliases => '-l'
40
+ method_option :cache_path, :type => :string
38
41
  method_option :tmp_path, :type => :string
39
42
  method_option :quiet, :type => :boolean, :aliases => '-q'
40
- desc 'perform', "Performs the backup for the specified trigger.\n" +
43
+ desc 'perform', "Performs the backup for the specified trigger.\n" +
41
44
  "You may perform multiple backups by providing multiple triggers, separated by commas.\n\n" +
42
45
  "Example:\n\s\s$ backup perform --triggers backup1,backup2,backup3,backup4\n\n" +
43
46
  "This will invoke 4 backups, and they will run in the order specified (not asynchronous)."
@@ -64,6 +67,13 @@ class BackupCLI < Thor
64
67
  Backup.send(:const_set, :LOG_PATH, options[:log_path])
65
68
  end
66
69
 
70
+ ##
71
+ # Overwrites the CACHE_PATH location, if --cache-path was specified
72
+ if options[:cache_path]
73
+ Backup.send(:remove_const, :CACHE_PATH)
74
+ Backup.send(:const_set, :CACHE_PATH, options[:cache_path])
75
+ end
76
+
67
77
  ##
68
78
  # Overwrites the TMP_PATH location, if --tmp-path was specified
69
79
  if options[:tmp_path]
@@ -71,21 +81,32 @@ class BackupCLI < Thor
71
81
  Backup.send(:const_set, :TMP_PATH, options[:tmp_path])
72
82
  end
73
83
 
74
- ##
75
- # Ensure the TMP_PATH and LOG_PATH are created if they do not yet exist
76
- Array.new([Backup::TMP_PATH, Backup::LOG_PATH]).each do |path|
77
- FileUtils.mkdir_p(path)
78
- end
79
-
80
84
  ##
81
85
  # Silence Backup::Logger from printing to STDOUT, if --quiet was specified
82
86
  if options[:quiet]
83
87
  Backup::Logger.send(:const_set, :QUIET, options[:quiet])
84
88
  end
85
89
 
90
+ ##
91
+ # Ensure the CACHE_PATH, TMP_PATH and LOG_PATH are created if they do not yet exist
92
+ Array.new([Backup::CACHE_PATH, Backup::TMP_PATH, Backup::LOG_PATH]).each do |path|
93
+ FileUtils.mkdir_p(path)
94
+ end
95
+
96
+ ##
97
+ # Prepare all trigger names by splitting them by ','
98
+ # and finding trigger names matching wildcard
99
+ triggers = options[:trigger].split(",")
100
+ triggers.map!(&:strip).map!{ |t|
101
+ t.include?(Backup::Finder::WILDCARD) ?
102
+ Backup::Finder.new(t).matching : t
103
+ }.flatten!
104
+
105
+ #triggers.unique! # Uncomment if its undesirable to call triggers twice
106
+
86
107
  ##
87
108
  # Process each trigger
88
- options[:trigger].split(",").map(&:strip).each do |trigger|
109
+ triggers.each do |trigger|
89
110
 
90
111
  ##
91
112
  # Defines the TRIGGER constant
@@ -101,7 +122,7 @@ class BackupCLI < Thor
101
122
 
102
123
  ##
103
124
  # Parses the backup configuration file and returns the model instance by trigger
104
- model = Backup::Finder.new(trigger, Backup::CONFIG_FILE).find
125
+ model = Backup::Finder.new(trigger).find
105
126
 
106
127
  ##
107
128
  # Runs the returned model
@@ -177,7 +198,7 @@ class BackupCLI < Thor
177
198
  file.write( File.read(temp_file.path) )
178
199
  puts "Generated configuration file in '#{ config }'"
179
200
  end
180
- end
201
+ end
181
202
  temp_file.unlink
182
203
  end
183
204
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'fileutils'
4
4
  require 'yaml'
5
+ require 'etc'
5
6
 
6
7
  ##
7
8
  # The Backup Ruby Gem
@@ -17,8 +18,8 @@ module Backup
17
18
  # You can do:
18
19
  # database MySQL do |mysql|
19
20
  DATABASES = ['MySQL', 'PostgreSQL', 'MongoDB', 'Redis']
20
- STORAGES = ['S3', 'CloudFiles', 'Dropbox', 'FTP', 'SFTP', 'SCP', 'RSync']
21
- COMPRESSORS = ['Gzip', 'Bzip2']
21
+ STORAGES = ['S3', 'CloudFiles', 'Ninefold', 'Dropbox', 'FTP', 'SFTP', 'SCP', 'RSync', 'Local']
22
+ COMPRESSORS = ['Gzip', 'Bzip2', 'Lzma']
22
23
  ENCRYPTORS = ['OpenSSL', 'GPG']
23
24
  SYNCERS = ['RSync', 'S3']
24
25
  NOTIFIERS = ['Mail', 'Twitter', 'Campfire', 'Presently']
@@ -37,11 +38,13 @@ module Backup
37
38
 
38
39
  ##
39
40
  # Backup's Environment paths
40
- PATH = File.join(ENV['HOME'], 'Backup')
41
- DATA_PATH = File.join(ENV['HOME'], 'Backup', 'data')
42
- CONFIG_FILE = File.join(ENV['HOME'], 'Backup', 'config.rb')
43
- LOG_PATH = File.join(ENV['HOME'], 'Backup', 'log')
44
- TMP_PATH = File.join(ENV['HOME'], 'Backup', '.tmp')
41
+ USER = ENV['USER'] || Etc.getpwuid.name
42
+ PATH = File.join(ENV['HOME'], 'Backup')
43
+ DATA_PATH = File.join(ENV['HOME'], 'Backup', 'data')
44
+ CONFIG_FILE = File.join(ENV['HOME'], 'Backup', 'config.rb')
45
+ LOG_PATH = File.join(ENV['HOME'], 'Backup', 'log')
46
+ CACHE_PATH = File.join(ENV['HOME'], 'Backup', '.cache')
47
+ TMP_PATH = File.join(ENV['HOME'], 'Backup', '.tmp')
45
48
 
46
49
  ##
47
50
  # Autoload Backup base files
@@ -60,10 +63,10 @@ module Backup
60
63
  autoload :Helpers, File.join(CONFIGURATION_PATH, 'helpers')
61
64
 
62
65
  module Notifier
63
- autoload :Base, File.join(CONFIGURATION_PATH, 'notifier', 'base')
64
- autoload :Mail, File.join(CONFIGURATION_PATH, 'notifier', 'mail')
65
- autoload :Twitter, File.join(CONFIGURATION_PATH, 'notifier', 'twitter')
66
- autoload :Campfire, File.join(CONFIGURATION_PATH, 'notifier', 'campfire')
66
+ autoload :Base, File.join(CONFIGURATION_PATH, 'notifier', 'base')
67
+ autoload :Mail, File.join(CONFIGURATION_PATH, 'notifier', 'mail')
68
+ autoload :Twitter, File.join(CONFIGURATION_PATH, 'notifier', 'twitter')
69
+ autoload :Campfire, File.join(CONFIGURATION_PATH, 'notifier', 'campfire')
67
70
  autoload :Presently, File.join(CONFIGURATION_PATH, 'notifier', 'presently')
68
71
  end
69
72
 
@@ -74,20 +77,23 @@ module Backup
74
77
  end
75
78
 
76
79
  module Compressor
77
- autoload :Base, File.join(CONFIGURATION_PATH, 'compressor', 'base')
78
- autoload :Gzip, File.join(CONFIGURATION_PATH, 'compressor', 'gzip')
80
+ autoload :Base, File.join(CONFIGURATION_PATH, 'compressor', 'base')
81
+ autoload :Gzip, File.join(CONFIGURATION_PATH, 'compressor', 'gzip')
79
82
  autoload :Bzip2, File.join(CONFIGURATION_PATH, 'compressor', 'bzip2')
83
+ autoload :Lzma, File.join(CONFIGURATION_PATH, 'compressor', 'lzma')
80
84
  end
81
85
 
82
86
  module Storage
83
87
  autoload :Base, File.join(CONFIGURATION_PATH, 'storage', 'base')
84
88
  autoload :S3, File.join(CONFIGURATION_PATH, 'storage', 's3')
85
89
  autoload :CloudFiles, File.join(CONFIGURATION_PATH, 'storage', 'cloudfiles')
90
+ autoload :Ninefold, File.join(CONFIGURATION_PATH, 'storage', 'ninefold')
86
91
  autoload :Dropbox, File.join(CONFIGURATION_PATH, 'storage', 'dropbox')
87
92
  autoload :FTP, File.join(CONFIGURATION_PATH, 'storage', 'ftp')
88
93
  autoload :SFTP, File.join(CONFIGURATION_PATH, 'storage', 'sftp')
89
94
  autoload :SCP, File.join(CONFIGURATION_PATH, 'storage', 'scp')
90
95
  autoload :RSync, File.join(CONFIGURATION_PATH, 'storage', 'rsync')
96
+ autoload :Local, File.join(CONFIGURATION_PATH, 'storage', 'local')
91
97
  end
92
98
 
93
99
  module Syncer
@@ -111,11 +117,13 @@ module Backup
111
117
  autoload :Object, File.join(STORAGE_PATH, 'object')
112
118
  autoload :S3, File.join(STORAGE_PATH, 's3')
113
119
  autoload :CloudFiles, File.join(STORAGE_PATH, 'cloudfiles')
120
+ autoload :Ninefold, File.join(STORAGE_PATH, 'ninefold')
114
121
  autoload :Dropbox, File.join(STORAGE_PATH, 'dropbox')
115
122
  autoload :FTP, File.join(STORAGE_PATH, 'ftp')
116
123
  autoload :SFTP, File.join(STORAGE_PATH, 'sftp')
117
124
  autoload :SCP, File.join(STORAGE_PATH, 'scp')
118
125
  autoload :RSync, File.join(STORAGE_PATH, 'rsync')
126
+ autoload :Local, File.join(STORAGE_PATH, 'local')
119
127
  end
120
128
 
121
129
  ##
@@ -139,9 +147,10 @@ module Backup
139
147
  ##
140
148
  # Autoload compressor files
141
149
  module Compressor
142
- autoload :Base, File.join(COMPRESSOR_PATH, 'base')
143
- autoload :Gzip, File.join(COMPRESSOR_PATH, 'gzip')
150
+ autoload :Base, File.join(COMPRESSOR_PATH, 'base')
151
+ autoload :Gzip, File.join(COMPRESSOR_PATH, 'gzip')
144
152
  autoload :Bzip2, File.join(COMPRESSOR_PATH, 'bzip2')
153
+ autoload :Lzma, File.join(COMPRESSOR_PATH, 'lzma')
145
154
  end
146
155
 
147
156
  ##
@@ -155,11 +164,11 @@ module Backup
155
164
  ##
156
165
  # Autoload notification files
157
166
  module Notifier
158
- autoload :Base, File.join(NOTIFIER_PATH, 'base')
159
- autoload :Binder, File.join(NOTIFIER_PATH, 'binder')
160
- autoload :Mail, File.join(NOTIFIER_PATH, 'mail')
161
- autoload :Twitter, File.join(NOTIFIER_PATH, 'twitter')
162
- autoload :Campfire, File.join(NOTIFIER_PATH, 'campfire')
167
+ autoload :Base, File.join(NOTIFIER_PATH, 'base')
168
+ autoload :Binder, File.join(NOTIFIER_PATH, 'binder')
169
+ autoload :Mail, File.join(NOTIFIER_PATH, 'mail')
170
+ autoload :Twitter, File.join(NOTIFIER_PATH, 'twitter')
171
+ autoload :Campfire, File.join(NOTIFIER_PATH, 'campfire')
163
172
  autoload :Presently, File.join(NOTIFIER_PATH, 'presently')
164
173
  end
165
174
 
@@ -167,6 +176,7 @@ module Backup
167
176
  # Autoload exception classes
168
177
  module Exception
169
178
  autoload :CommandNotFound, File.join(EXCEPTION_PATH, 'command_not_found')
179
+ autoload :CommandFailed, File.join(EXCEPTION_PATH, 'command_failed')
170
180
  end
171
181
 
172
182
  ##
@@ -23,9 +23,15 @@ module Backup
23
23
  def run(command)
24
24
  command.gsub!(/^\s+/, '')
25
25
  raise_if_command_not_found!(
26
- command.slice(0, command.index(/\s/)).split('/')[-1]
26
+ command_name(command)
27
27
  )
28
- %x[#{command}]
28
+
29
+ pid, stdin, stdout, stderr = Open4::popen4(command)
30
+ ignored, @status = Process::waitpid2(pid)
31
+ @stdout = stdout.read
32
+ @stderr = stderr.read
33
+
34
+ raise_if_command_failed!(command_name(command), @status)
29
35
  end
30
36
 
31
37
  ##
@@ -63,6 +69,10 @@ module Backup
63
69
  name
64
70
  end
65
71
 
72
+ def command_name(command)
73
+ command.slice(0, command.index(/\s/)).split('/')[-1]
74
+ end
75
+
66
76
  ##
67
77
  # If the command that was previously run via this Ruby process returned
68
78
  # error code "32512", the invoked utility (e.g. mysqldump, pgdump, etc) could not be found.
@@ -78,5 +88,23 @@ module Backup
78
88
  end
79
89
  end
80
90
 
91
+ ##
92
+ # If the command that was previously run via this Ruby process returned
93
+ # a non-zero error code, the invoked utility (e.g. mysqldump, pgdump, etc) failed to run.
94
+ # If this is the case then this method will throw an exception, informing the user of this problem.
95
+ #
96
+ # Since this raises an exception, it'll stop the entire backup process, clean up the temp files
97
+ # and notify the user via the built-in notifiers if these are set.
98
+ def raise_if_command_failed!(utility, status)
99
+ unless status.to_i.eql?(0)
100
+ raise Exception::CommandFailed , "Failed to run \"#{utility}\" on \"#{RUBY_PLATFORM}\".\n" +
101
+ "The status code returned was #{status}\n" +
102
+ "STDOUT was:\n" +
103
+ @stdout +
104
+ "STDERR was:\n" +
105
+ @stderr
106
+ end
107
+ end
108
+
81
109
  end
82
110
  end
@@ -0,0 +1,63 @@
1
+ # encoding: utf-8
2
+
3
+ module Backup
4
+ module Compressor
5
+ class Lzma < Base
6
+
7
+ ##
8
+ # Tells Backup::Compressor::Lzma to compress
9
+ # better (-9) rather than faster when set to true
10
+ attr_writer :best
11
+
12
+ ##
13
+ # Tells Backup::Compressor::Lzma to compress
14
+ # faster (-1) rather than better when set to true
15
+ attr_writer :fast
16
+
17
+ ##
18
+ # Creates a new instance of Backup::Compressor::Lzma and
19
+ # configures it to either compress faster or better
20
+ # Lzma compresses by default with -9 (best compression)
21
+ # and lower block sizes don't make things significantly faster
22
+ # (according to official bzip2 docs)
23
+ def initialize(&block)
24
+ load_defaults!
25
+
26
+ @best ||= false
27
+ @fast ||= false
28
+
29
+ instance_eval(&block) if block_given?
30
+ end
31
+
32
+ ##
33
+ # Performs the compression of the packages backup file
34
+ def perform!
35
+ log!
36
+ run("#{ utility(:lzma) } #{ options } '#{ Backup::Model.file }'")
37
+ Backup::Model.extension += '.lzma'
38
+ end
39
+
40
+ private
41
+
42
+ ##
43
+ # Combines the provided options and returns a bzip2 options string
44
+ def options
45
+ (best + fast).join("\s")
46
+ end
47
+
48
+ ##
49
+ # Returns the lzma option syntax for compressing
50
+ # setting @best to true is redundant, as lzma compresses best by default
51
+ def best
52
+ return ['--best'] if @best; []
53
+ end
54
+
55
+ ##
56
+ # Returns the lzma option syntax for compressing
57
+ # (not significantly) faster when @fast is set to true
58
+ def fast
59
+ return ['--fast'] if @fast; []
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ module Backup
4
+ module Configuration
5
+ module Compressor
6
+ class Lzma < Base
7
+ class << self
8
+
9
+ ##
10
+ # Tells Backup::Compressor::Lzma to compress
11
+ # better (--best) which is lzma default anyway
12
+ attr_accessor :best
13
+
14
+ ##
15
+ # Tells Backup::Compressor::Lzma to compress
16
+ # faster (--fast) (but not significantly faster)
17
+ attr_accessor :fast
18
+
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -8,13 +8,19 @@ module Backup
8
8
  # Finds all the object's getter methods and checks the global
9
9
  # configuration for these methods, if they respond then they will
10
10
  # assign the object's attribute(s) to that particular global configuration's attribute
11
- def load_defaults!
12
- c = self.class.name.split('::')
13
- configuration = Backup::Configuration.const_get(c[1]).const_get(c[2])
11
+ def load_defaults!(options = {})
12
+ c = self.class.name.split('::')
13
+ configuration = Backup::Configuration.const_get(c[1]).const_get(c[2])
14
+ options[:except] ||= []
15
+ options[:only] ||= []
14
16
 
15
17
  getter_methods.each do |attribute|
16
18
  if configuration.respond_to?(attribute)
17
- unless configuration.send(attribute).nil?
19
+ if options[:only].any? and options[:only].include?(attribute)
20
+ self.send("#{attribute}=", configuration.send(attribute))
21
+ elsif options[:except].any? and !options[:except].include?(attribute)
22
+ self.send("#{attribute}=", configuration.send(attribute))
23
+ elsif options[:only].empty? and options[:except].empty?
18
24
  self.send("#{attribute}=", configuration.send(attribute))
19
25
  end
20
26
  end
@@ -45,6 +45,11 @@ module Backup
45
45
  # Example: true
46
46
  attr_accessor :enable_starttls_auto
47
47
 
48
+ ##
49
+ # OpenSSL Verify Mode
50
+ # Example: none - Only use this option for a self-signed and/or wildcard certificate
51
+ attr_accessor :openssl_verify_mode
52
+
48
53
  end
49
54
  end
50
55
  end
@@ -6,10 +6,6 @@ module Backup
6
6
  class Dropbox < Base
7
7
  class << self
8
8
 
9
- ##
10
- # Dropbox user credentials
11
- attr_accessor :email, :password
12
-
13
9
  ##
14
10
  # Dropbox API credentials
15
11
  attr_accessor :api_key, :api_secret
@@ -22,6 +18,25 @@ module Backup
22
18
  # Dropbox connection timeout
23
19
  attr_accessor :timeout
24
20
 
21
+
22
+ # DEPRECATED METHODS #############################################
23
+
24
+ def email
25
+ Logger.warn "[DEPRECATED] Backup::Configuration::Storage::Dropbox.email is deprecated and will be removed at some point."
26
+ end
27
+
28
+ def email=(value)
29
+ Logger.warn "[DEPRECATED] Backup::Configuration::Storage::Dropbox.email= is deprecated and will be removed at some point."
30
+ end
31
+
32
+ def password
33
+ Logger.warn "[DEPRECATED] Backup::Configuration::Storage::Dropbox.password is deprecated and will be removed at some point."
34
+ end
35
+
36
+ def password=(value)
37
+ Logger.warn "[DEPRECATED] Backup::Configuration::Storage::Dropbox.password= is deprecated and will be removed at some point."
38
+ end
39
+
25
40
  end
26
41
  end
27
42
  end