backup 3.11.0 → 4.0.0rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/lib/backup.rb +1 -4
  4. data/lib/backup/archive.rb +1 -1
  5. data/lib/backup/cli.rb +51 -107
  6. data/lib/backup/compressor/base.rb +2 -2
  7. data/lib/backup/compressor/bzip2.rb +0 -11
  8. data/lib/backup/compressor/gzip.rb +0 -11
  9. data/lib/backup/config.rb +45 -123
  10. data/lib/backup/config/dsl.rb +102 -0
  11. data/lib/backup/{configuration → config}/helpers.rb +23 -14
  12. data/lib/backup/database/base.rb +2 -2
  13. data/lib/backup/database/mongodb.rb +0 -18
  14. data/lib/backup/database/mysql.rb +6 -75
  15. data/lib/backup/database/postgresql.rb +0 -12
  16. data/lib/backup/database/redis.rb +85 -47
  17. data/lib/backup/database/riak.rb +0 -19
  18. data/lib/backup/encryptor/base.rb +2 -2
  19. data/lib/backup/encryptor/gpg.rb +1 -12
  20. data/lib/backup/logger/fog_adapter.rb +1 -2
  21. data/lib/backup/model.rb +3 -24
  22. data/lib/backup/notifier/base.rb +2 -17
  23. data/lib/backup/notifier/http_post.rb +1 -1
  24. data/lib/backup/notifier/mail.rb +5 -47
  25. data/lib/backup/notifier/prowl.rb +1 -1
  26. data/lib/backup/notifier/pushover.rb +1 -1
  27. data/lib/backup/packager.rb +1 -1
  28. data/lib/backup/pipeline.rb +1 -1
  29. data/lib/backup/splitter.rb +1 -1
  30. data/lib/backup/storage/base.rb +2 -14
  31. data/lib/backup/storage/cloud_files.rb +1 -0
  32. data/lib/backup/storage/cycler.rb +33 -88
  33. data/lib/backup/storage/dropbox.rb +19 -12
  34. data/lib/backup/storage/ftp.rb +1 -0
  35. data/lib/backup/storage/local.rb +1 -0
  36. data/lib/backup/storage/ninefold.rb +1 -0
  37. data/lib/backup/storage/rsync.rb +7 -41
  38. data/lib/backup/storage/s3.rb +1 -0
  39. data/lib/backup/storage/scp.rb +1 -0
  40. data/lib/backup/storage/sftp.rb +1 -0
  41. data/lib/backup/syncer/base.rb +2 -2
  42. data/lib/backup/syncer/cloud/cloud_files.rb +0 -16
  43. data/lib/backup/syncer/cloud/s3.rb +0 -16
  44. data/lib/backup/syncer/rsync/local.rb +0 -5
  45. data/lib/backup/syncer/rsync/pull.rb +0 -21
  46. data/lib/backup/syncer/rsync/push.rb +0 -21
  47. data/lib/backup/utilities.rb +2 -22
  48. data/lib/backup/version.rb +1 -1
  49. data/templates/cli/archive +0 -3
  50. data/templates/cli/compressor/custom +0 -4
  51. data/templates/cli/config +39 -17
  52. data/templates/cli/{database → databases}/mongodb +0 -0
  53. data/templates/cli/{database → databases}/mysql +0 -0
  54. data/templates/cli/{database → databases}/postgresql +0 -0
  55. data/templates/cli/databases/redis +16 -0
  56. data/templates/cli/{database → databases}/riak +0 -0
  57. data/templates/cli/{model.erb → model} +8 -5
  58. data/templates/cli/{notifier → notifiers}/campfire +0 -0
  59. data/templates/cli/{notifier → notifiers}/hipchat +0 -0
  60. data/templates/cli/{notifier → notifiers}/http_post +0 -3
  61. data/templates/cli/{notifier → notifiers}/mail +1 -2
  62. data/templates/cli/notifiers/nagios +13 -0
  63. data/templates/cli/{notifier → notifiers}/prowl +0 -0
  64. data/templates/cli/{notifier → notifiers}/pushover +0 -0
  65. data/templates/cli/{notifier → notifiers}/twitter +0 -0
  66. data/templates/cli/{storage → storages}/cloud_files +0 -2
  67. data/templates/cli/storages/dropbox +19 -0
  68. data/templates/cli/{storage → storages}/ftp +0 -0
  69. data/templates/cli/{storage → storages}/local +0 -0
  70. data/templates/cli/{storage → storages}/ninefold +0 -0
  71. data/templates/cli/{storage → storages}/rsync +0 -2
  72. data/templates/cli/{storage → storages}/s3 +0 -2
  73. data/templates/cli/{storage → storages}/scp +0 -0
  74. data/templates/cli/{storage → storages}/sftp +0 -0
  75. data/templates/cli/{syncer → syncers}/cloud_files +0 -2
  76. data/templates/cli/{syncer → syncers}/rsync_local +0 -0
  77. data/templates/cli/{syncer → syncers}/rsync_pull +0 -2
  78. data/templates/cli/{syncer → syncers}/rsync_push +0 -2
  79. data/templates/cli/{syncer → syncers}/s3 +0 -2
  80. data/templates/general/links +1 -1
  81. metadata +241 -69
  82. data/lib/backup/compressor/lzma.rb +0 -52
  83. data/lib/backup/compressor/pbzip2.rb +0 -59
  84. data/lib/backup/configuration.rb +0 -33
  85. data/lib/backup/configuration/store.rb +0 -24
  86. data/templates/cli/compressor/lzma +0 -10
  87. data/templates/cli/compressor/pbzip2 +0 -10
  88. data/templates/cli/database/redis +0 -18
  89. data/templates/cli/notifier/nagios +0 -13
  90. data/templates/cli/storage/dropbox +0 -20
@@ -1,52 +0,0 @@
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_accessor :best
11
-
12
- ##
13
- # Tells Backup::Compressor::Lzma to compress
14
- # faster (-1) rather than better when set to true
15
- attr_accessor :fast
16
-
17
- ##
18
- # Creates a new instance of Backup::Compressor::Lzma
19
- def initialize(&block)
20
- load_defaults!
21
-
22
- @best ||= false
23
- @fast ||= false
24
-
25
- instance_eval(&block) if block_given?
26
-
27
- @cmd = "#{ utility(:lzma) }#{ options }"
28
- @ext = '.lzma'
29
- end
30
-
31
-
32
- ##
33
- # Yields to the block the compressor command and filename extension.
34
- def compress_with
35
- Backup::Logger.warn(
36
- "[DEPRECATION WARNING]\n" +
37
- " Compressor::Lzma is being deprecated as of backup v.3.0.24\n" +
38
- " and will soon be removed. Please see the Compressors wiki page at\n" +
39
- " https://github.com/meskyanichi/backup/wiki/Compressors"
40
- )
41
- super
42
- end
43
-
44
- private
45
-
46
- def options
47
- (' --best' if @best) || (' --fast' if @fast)
48
- end
49
-
50
- end
51
- end
52
- end
@@ -1,59 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Backup
4
- module Compressor
5
- class Pbzip2 < Base
6
-
7
- ##
8
- # Tells Backup::Compressor::Lzma to compress
9
- # better (-9) rather than faster when set to true
10
- attr_accessor :best
11
-
12
- ##
13
- # Tells Backup::Compressor::Lzma to compress
14
- # faster (-1) rather than better when set to true
15
- attr_accessor :fast
16
-
17
- ##
18
- # Tells Backup::Compressor::Pbzip2 how many processors to use.
19
- # Autodetects the number of active CPUs by default.
20
- attr_accessor :processors
21
-
22
- ##
23
- # Creates a new instance of Backup::Compressor::Pbzip2
24
- def initialize(&block)
25
- load_defaults!
26
-
27
- @best ||= false
28
- @fast ||= false
29
- @processors ||= false
30
-
31
- instance_eval(&block) if block_given?
32
-
33
- @cmd = "#{ utility(:pbzip2) }#{ options }"
34
- @ext = '.bz2'
35
- end
36
-
37
- ##
38
- # Yields to the block the compressor command and filename extension.
39
- def compress_with
40
- Backup::Logger.warn(
41
- "[DEPRECATION WARNING]\n" +
42
- " Compressor::Pbzip2 is being deprecated as of backup v.3.0.24\n" +
43
- " and will soon be removed. Please see the Compressors wiki page at\n" +
44
- " https://github.com/meskyanichi/backup/wiki/Compressors"
45
- )
46
- super
47
- end
48
-
49
- private
50
-
51
- def options
52
- level = (' --best' if @best) || (' --fast' if @fast)
53
- cpus = " -p#{ @processors }" if @processors
54
- "#{ level }#{ cpus }"
55
- end
56
-
57
- end
58
- end
59
- end
@@ -1,33 +0,0 @@
1
- # encoding: utf-8
2
-
3
- %w[helpers store].each do |file|
4
- require File.expand_path("../configuration/#{file}", __FILE__)
5
- end
6
-
7
- # Temporary measure for deprecating the use of Configuration
8
- # namespaced classes for setting pre-configured defaults.
9
- module Backup
10
- module Configuration
11
- extend self
12
-
13
- ##
14
- # Pass calls on to the proper class and log a warning
15
- def defaults(&block)
16
- klass = eval(self.to_s.sub('Configuration::', ''))
17
- Logger.warn Error.new(<<-EOS)
18
- [DEPRECATION WARNING]
19
- #{ self }.defaults is being deprecated.
20
- To set pre-configured defaults for #{ klass }, use:
21
- #{ klass }.defaults
22
- EOS
23
- klass.defaults(&block)
24
- end
25
-
26
- private
27
-
28
- def const_missing(const)
29
- const_set(const, Module.new { extend Configuration })
30
- end
31
-
32
- end
33
- end
@@ -1,24 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'ostruct'
4
-
5
- module Backup
6
- module Configuration
7
- class Store < OpenStruct
8
-
9
- ##
10
- # Returns an Array of all attribute method names
11
- # that default values were set for.
12
- def _attributes
13
- @table.keys
14
- end
15
-
16
- ##
17
- # Used only within the specs
18
- def reset!
19
- @table.clear
20
- end
21
-
22
- end
23
- end
24
- end
@@ -1,10 +0,0 @@
1
- ##
2
- # Lzma [Compressor]
3
- #
4
- # [DEPRECATED]
5
- # See the Wiki for more info.
6
- # https://github.com/meskyanichi/backup/wiki/Compressors
7
- compress_with Lzma do |compression|
8
- compression.best = true
9
- compression.fast = false
10
- end
@@ -1,10 +0,0 @@
1
- ##
2
- # Pbzip2 [Compressor]
3
- #
4
- # [DEPRECATED]
5
- # See the Wiki for more info.
6
- # https://github.com/meskyanichi/backup/wiki/Compressors
7
- compress_with Pbzip2 do |compression|
8
- compression.best = true
9
- compression.fast = false
10
- end
@@ -1,18 +0,0 @@
1
- ##
2
- # Redis [Database]
3
- #
4
- database Redis do |db|
5
- ##
6
- # From `dbfilename` in your `redis.conf` under SNAPSHOTTING.
7
- # Do not include the '.rdb' extension. Defaults to 'dump'
8
- db.name = 'dump'
9
- ##
10
- # From `dir` in your `redis.conf` under SNAPSHOTTING.
11
- db.path = '/var/lib/redis'
12
- db.password = 'my_password'
13
- db.host = 'localhost'
14
- db.port = 6379
15
- db.socket = '/tmp/redis.sock'
16
- db.additional_options = []
17
- db.invoke_save = true
18
- end
@@ -1,13 +0,0 @@
1
- ##
2
- # Nagios [Notifier]
3
- #
4
- notify_by Nagios do |nagios|
5
- nagios.on_success = true
6
- nagios.on_warning = true
7
- nagios.on_failure = true
8
-
9
- nagios.nagios_host = 'nagioshost'
10
- nagios.nagios_port = 5667
11
- nagios.service_name = 'My Backup'
12
- nagios.service_host = 'backuphost'
13
- end
@@ -1,20 +0,0 @@
1
- ##
2
- # Dropbox File Hosting Service [Storage]
3
- #
4
- # Access Type:
5
- #
6
- # - :app_folder (Default)
7
- # - :dropbox
8
- #
9
- # Note:
10
- #
11
- # Initial backup must be performed manually to authorize
12
- # this machine with your Dropbox account.
13
- #
14
- store_with Dropbox do |db|
15
- db.api_key = "my_api_key"
16
- db.api_secret = "my_api_secret"
17
- db.access_type = :app_folder
18
- db.path = "/path/to/my/backups"
19
- db.keep = 25
20
- end