backup 4.3.0 → 5.0.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +19 -0
  3. data/README.md +13 -9
  4. data/bin/docker_test +24 -0
  5. data/lib/backup.rb +74 -78
  6. data/lib/backup/archive.rb +31 -32
  7. data/lib/backup/binder.rb +2 -6
  8. data/lib/backup/cleaner.rb +14 -18
  9. data/lib/backup/cli.rb +104 -108
  10. data/lib/backup/cloud_io/base.rb +4 -7
  11. data/lib/backup/cloud_io/cloud_files.rb +60 -62
  12. data/lib/backup/cloud_io/s3.rb +69 -76
  13. data/lib/backup/compressor/base.rb +4 -7
  14. data/lib/backup/compressor/bzip2.rb +3 -7
  15. data/lib/backup/compressor/custom.rb +2 -6
  16. data/lib/backup/compressor/gzip.rb +16 -17
  17. data/lib/backup/config.rb +17 -18
  18. data/lib/backup/config/dsl.rb +16 -17
  19. data/lib/backup/config/helpers.rb +10 -16
  20. data/lib/backup/database/base.rb +22 -21
  21. data/lib/backup/database/mongodb.rb +36 -37
  22. data/lib/backup/database/mysql.rb +40 -41
  23. data/lib/backup/database/openldap.rb +8 -10
  24. data/lib/backup/database/postgresql.rb +29 -30
  25. data/lib/backup/database/redis.rb +27 -30
  26. data/lib/backup/database/riak.rb +15 -18
  27. data/lib/backup/database/sqlite.rb +4 -6
  28. data/lib/backup/encryptor/base.rb +2 -4
  29. data/lib/backup/encryptor/gpg.rb +49 -59
  30. data/lib/backup/encryptor/open_ssl.rb +11 -14
  31. data/lib/backup/errors.rb +7 -12
  32. data/lib/backup/logger.rb +16 -18
  33. data/lib/backup/logger/console.rb +5 -8
  34. data/lib/backup/logger/fog_adapter.rb +2 -6
  35. data/lib/backup/logger/logfile.rb +10 -12
  36. data/lib/backup/logger/syslog.rb +2 -4
  37. data/lib/backup/model.rb +33 -40
  38. data/lib/backup/notifier/base.rb +24 -26
  39. data/lib/backup/notifier/campfire.rb +9 -11
  40. data/lib/backup/notifier/command.rb +3 -3
  41. data/lib/backup/notifier/datadog.rb +9 -12
  42. data/lib/backup/notifier/flowdock.rb +13 -17
  43. data/lib/backup/notifier/hipchat.rb +18 -14
  44. data/lib/backup/notifier/http_post.rb +11 -14
  45. data/lib/backup/notifier/mail.rb +42 -54
  46. data/lib/backup/notifier/nagios.rb +5 -9
  47. data/lib/backup/notifier/pagerduty.rb +10 -12
  48. data/lib/backup/notifier/prowl.rb +15 -15
  49. data/lib/backup/notifier/pushover.rb +7 -10
  50. data/lib/backup/notifier/ses.rb +52 -17
  51. data/lib/backup/notifier/slack.rb +39 -40
  52. data/lib/backup/notifier/twitter.rb +2 -5
  53. data/lib/backup/notifier/zabbix.rb +11 -14
  54. data/lib/backup/package.rb +5 -9
  55. data/lib/backup/packager.rb +16 -17
  56. data/lib/backup/pipeline.rb +17 -21
  57. data/lib/backup/splitter.rb +8 -11
  58. data/lib/backup/storage/base.rb +5 -8
  59. data/lib/backup/storage/cloud_files.rb +21 -23
  60. data/lib/backup/storage/cycler.rb +10 -15
  61. data/lib/backup/storage/dropbox.rb +15 -21
  62. data/lib/backup/storage/ftp.rb +14 -10
  63. data/lib/backup/storage/local.rb +5 -8
  64. data/lib/backup/storage/qiniu.rb +8 -8
  65. data/lib/backup/storage/rsync.rb +24 -26
  66. data/lib/backup/storage/s3.rb +27 -28
  67. data/lib/backup/storage/scp.rb +10 -12
  68. data/lib/backup/storage/sftp.rb +10 -12
  69. data/lib/backup/syncer/base.rb +5 -8
  70. data/lib/backup/syncer/cloud/base.rb +27 -30
  71. data/lib/backup/syncer/cloud/cloud_files.rb +16 -18
  72. data/lib/backup/syncer/cloud/local_file.rb +5 -8
  73. data/lib/backup/syncer/cloud/s3.rb +23 -24
  74. data/lib/backup/syncer/rsync/base.rb +6 -10
  75. data/lib/backup/syncer/rsync/local.rb +1 -5
  76. data/lib/backup/syncer/rsync/pull.rb +6 -10
  77. data/lib/backup/syncer/rsync/push.rb +18 -22
  78. data/lib/backup/template.rb +9 -14
  79. data/lib/backup/utilities.rb +78 -69
  80. data/lib/backup/version.rb +1 -3
  81. metadata +107 -677
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c7e4e7ea9006f973c8df272ad4520265fb5a25e1
4
- data.tar.gz: ce45e91cc9d2b80f721cbcda2f4012fce936fb7f
2
+ SHA256:
3
+ metadata.gz: be84fcf585977ffff359b7f8b1052b87d6fd505fdf7b2324a7f309ec41bf8007
4
+ data.tar.gz: f46f2e94686a50cab3ee91ef64320aab6a5a7f249069906f52c9f37bc9fa371c
5
5
  SHA512:
6
- metadata.gz: 866350af1103a7eeb171bd80d01c73d4a728f31eda444823b4250d3788d09402f6cbca600a6dfc0d48e05c0c74a2746fd68dee230b847acff3ba7d92a2a8bb07
7
- data.tar.gz: b0585f85c576423c12291990521ad7d33a82fc6d1cadf97b009e332bbc8e0a42840b3debb9cd382291115e2282bbaa1f5b18088fa0dd6fde98e8edacc7f90e2b
6
+ metadata.gz: 1fcf15d44034f42fdbc319e1754c2df3a8b9b61f3658a753d0bc576fc000b185ebfb897cb77543dae86a785a0ae192b996eba05e6ca6043cdd4028db9ec77a6d
7
+ data.tar.gz: 103d3d83c801d70ac6f249e4a9bb1720aa0decb4475d37f722f6628ee16c5b38d9940048c30880c5c8f9555eb3c9e9c575e5a464c4d7e0509987aa027ac63c56
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2009-2017 Michael van Rooijen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,29 +1,33 @@
1
- Backup v4.x
2
- ===========
1
+ Backup
2
+ ======
3
3
 
4
- [![Code Climate](https://codeclimate.com/github/backup/backup.png)](https://codeclimate.com/github/backup/backup)
4
+ [![Code Climate](https://codeclimate.com/github/backup/backup.svg)](https://codeclimate.com/github/backup/backup)
5
5
  [![Build Status](https://travis-ci.org/backup/backup.svg?branch=master)](https://travis-ci.org/backup/backup)
6
6
  [![Join the chat at https://gitter.im/backup/backup](https://badges.gitter.im/Join%20Chat.svg)][Gitter]
7
7
 
8
+ > This project is now in maintenance. No new features are planned.
9
+
8
10
  Backup is a system utility for Linux and Mac OS X, distributed as a RubyGem, that allows you to easily perform backup
9
11
  operations. It provides an elegant DSL in Ruby for _modeling_ your backups. Backup has built-in support for various
10
12
  databases, storage protocols/services, syncers, compressors, encryptors and notifiers which you can mix and match. It
11
13
  was built with modularity, extensibility and simplicity in mind.
12
14
 
13
- [Installation][] · [Release Notes][] · [Documentation][] · [Issues][] · [Features][] · [Chat][Gitter]
15
+ [Installation][] · [Release Notes][] · [Documentation][] · [Issues][] · [Chat][Gitter]
16
+
17
+ ## Project Status: Maintenance-Only ##
18
+
19
+ This project is not under active development, although we will continue to provide support for current users, and at least one more maintenance release: version 5.0. The version 5.0 release will include support for Ruby 2.4, and various other fixes. Future releases of Backup will only include bug fixes.
14
20
 
15
- Please use the Backup features [issue tracker][Features] to suggest new features.
16
- Only use the Backup gem [issue tracker][Issues] for bugs and other issues.
17
- We're also available on [Gitter] for questions and problems.
21
+ If you use this project and would like to develop it further, please introduce yourself on the [maintainers wanted][Maintainers wanted] ticket.
18
22
 
19
- **Copyright (c) 2009-2016 [Michael van Rooijen][] ( [@mrrooijen] )**
23
+ **Copyright (c) 2009-2017 [Michael van Rooijen][] ( [@mrrooijen] )**
20
24
  Released under the **MIT** [LICENSE](LICENSE).
21
25
 
22
26
  [Installation]: http://backup.github.io/backup/v4/installation
23
27
  [Release Notes]: http://backup.github.io/backup/v4/release-notes
24
28
  [Documentation]: http://backup.github.io/backup/v4
25
29
  [Issues]: https://github.com/backup/backup/issues
26
- [Features]: https://github.com/backup/backup-features/issues
27
30
  [Gitter]: https://gitter.im/backup/backup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
31
+ [Maintainers wanted]: https://github.com/backup/backup/issues/803
28
32
  [Michael van Rooijen]: http://github.com/mrrooijen
29
33
  [@mrrooijen]: http://twitter.com/mrrooijen
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+ set -eu
3
+
4
+ export BUNDLE_PATH=/tmp/docker/bundle
5
+ export BUNDLE_JOBS=4
6
+
7
+ case "${1-}" in
8
+ prepare)
9
+ bundle check || bundle install
10
+ ;;
11
+ rspec)
12
+ bundle exec rspec spec
13
+ ;;
14
+ integration)
15
+ bundle exec rspec integration/acceptance/
16
+ ;;
17
+ console)
18
+ bash
19
+ ;;
20
+ *)
21
+ echo "Task not found"
22
+ exit 1
23
+ ;;
24
+ esac
@@ -1,20 +1,18 @@
1
- # encoding: utf-8
2
-
3
1
  # Load Ruby Core Libraries
4
- require 'time'
5
- require 'fileutils'
6
- require 'tempfile'
7
- require 'syslog'
8
- require 'yaml'
9
- require 'etc'
10
- require 'forwardable'
11
- require 'thread'
2
+ require "time"
3
+ require "fileutils"
4
+ require "tempfile"
5
+ require "syslog"
6
+ require "yaml"
7
+ require "etc"
8
+ require "forwardable"
9
+ require "thread"
12
10
 
13
- require 'open4'
14
- require 'thor'
15
- require 'shellwords'
11
+ require "open4"
12
+ require "thor"
13
+ require "shellwords"
16
14
 
17
- require 'excon'
15
+ require "excon"
18
16
  # Include response.inspect in error messages.
19
17
  Excon.defaults[:debug_response] = true
20
18
  # Excon should not retry failed requests. We handle that.
@@ -23,107 +21,106 @@ Excon.defaults[:middlewares].delete(Excon::Middleware::Idempotent)
23
21
  ##
24
22
  # The Backup Ruby Gem
25
23
  module Backup
26
-
27
24
  ##
28
25
  # Backup's internal paths
29
- LIBRARY_PATH = File.join(File.dirname(__FILE__), 'backup')
30
- STORAGE_PATH = File.join(LIBRARY_PATH, 'storage')
31
- SYNCER_PATH = File.join(LIBRARY_PATH, 'syncer')
32
- DATABASE_PATH = File.join(LIBRARY_PATH, 'database')
33
- COMPRESSOR_PATH = File.join(LIBRARY_PATH, 'compressor')
34
- ENCRYPTOR_PATH = File.join(LIBRARY_PATH, 'encryptor')
35
- NOTIFIER_PATH = File.join(LIBRARY_PATH, 'notifier')
36
- TEMPLATE_PATH = File.expand_path('../../templates', __FILE__)
26
+ LIBRARY_PATH = File.join(File.dirname(__FILE__), "backup")
27
+ STORAGE_PATH = File.join(LIBRARY_PATH, "storage")
28
+ SYNCER_PATH = File.join(LIBRARY_PATH, "syncer")
29
+ DATABASE_PATH = File.join(LIBRARY_PATH, "database")
30
+ COMPRESSOR_PATH = File.join(LIBRARY_PATH, "compressor")
31
+ ENCRYPTOR_PATH = File.join(LIBRARY_PATH, "encryptor")
32
+ NOTIFIER_PATH = File.join(LIBRARY_PATH, "notifier")
33
+ TEMPLATE_PATH = File.expand_path("../../templates", __FILE__)
37
34
 
38
35
  ##
39
36
  # Autoload Backup storage files
40
37
  module Storage
41
- autoload :Base, File.join(STORAGE_PATH, 'base')
42
- autoload :Cycler, File.join(STORAGE_PATH, 'cycler')
43
- autoload :S3, File.join(STORAGE_PATH, 's3')
44
- autoload :CloudFiles, File.join(STORAGE_PATH, 'cloud_files')
45
- autoload :Ninefold, File.join(STORAGE_PATH, 'ninefold')
46
- autoload :Dropbox, File.join(STORAGE_PATH, 'dropbox')
47
- autoload :FTP, File.join(STORAGE_PATH, 'ftp')
48
- autoload :SFTP, File.join(STORAGE_PATH, 'sftp')
49
- autoload :SCP, File.join(STORAGE_PATH, 'scp')
50
- autoload :RSync, File.join(STORAGE_PATH, 'rsync')
51
- autoload :Local, File.join(STORAGE_PATH, 'local')
52
- autoload :Qiniu, File.join(STORAGE_PATH, 'qiniu')
38
+ autoload :Base, File.join(STORAGE_PATH, "base")
39
+ autoload :Cycler, File.join(STORAGE_PATH, "cycler")
40
+ autoload :S3, File.join(STORAGE_PATH, "s3")
41
+ autoload :CloudFiles, File.join(STORAGE_PATH, "cloud_files")
42
+ autoload :Ninefold, File.join(STORAGE_PATH, "ninefold")
43
+ autoload :Dropbox, File.join(STORAGE_PATH, "dropbox")
44
+ autoload :FTP, File.join(STORAGE_PATH, "ftp")
45
+ autoload :SFTP, File.join(STORAGE_PATH, "sftp")
46
+ autoload :SCP, File.join(STORAGE_PATH, "scp")
47
+ autoload :RSync, File.join(STORAGE_PATH, "rsync")
48
+ autoload :Local, File.join(STORAGE_PATH, "local")
49
+ autoload :Qiniu, File.join(STORAGE_PATH, "qiniu")
53
50
  end
54
51
 
55
52
  ##
56
53
  # Autoload Backup syncer files
57
54
  module Syncer
58
- autoload :Base, File.join(SYNCER_PATH, 'base')
55
+ autoload :Base, File.join(SYNCER_PATH, "base")
59
56
  module Cloud
60
- autoload :Base, File.join(SYNCER_PATH, 'cloud', 'base')
61
- autoload :LocalFile, File.join(SYNCER_PATH, 'cloud', 'local_file')
62
- autoload :CloudFiles, File.join(SYNCER_PATH, 'cloud', 'cloud_files')
63
- autoload :S3, File.join(SYNCER_PATH, 'cloud', 's3')
57
+ autoload :Base, File.join(SYNCER_PATH, "cloud", "base")
58
+ autoload :LocalFile, File.join(SYNCER_PATH, "cloud", "local_file")
59
+ autoload :CloudFiles, File.join(SYNCER_PATH, "cloud", "cloud_files")
60
+ autoload :S3, File.join(SYNCER_PATH, "cloud", "s3")
64
61
  end
65
62
  module RSync
66
- autoload :Base, File.join(SYNCER_PATH, 'rsync', 'base')
67
- autoload :Local, File.join(SYNCER_PATH, 'rsync', 'local')
68
- autoload :Push, File.join(SYNCER_PATH, 'rsync', 'push')
69
- autoload :Pull, File.join(SYNCER_PATH, 'rsync', 'pull')
63
+ autoload :Base, File.join(SYNCER_PATH, "rsync", "base")
64
+ autoload :Local, File.join(SYNCER_PATH, "rsync", "local")
65
+ autoload :Push, File.join(SYNCER_PATH, "rsync", "push")
66
+ autoload :Pull, File.join(SYNCER_PATH, "rsync", "pull")
70
67
  end
71
68
  end
72
69
 
73
70
  ##
74
71
  # Autoload Backup database files
75
72
  module Database
76
- autoload :Base, File.join(DATABASE_PATH, 'base')
77
- autoload :MySQL, File.join(DATABASE_PATH, 'mysql')
78
- autoload :PostgreSQL, File.join(DATABASE_PATH, 'postgresql')
79
- autoload :MongoDB, File.join(DATABASE_PATH, 'mongodb')
80
- autoload :Redis, File.join(DATABASE_PATH, 'redis')
81
- autoload :Riak, File.join(DATABASE_PATH, 'riak')
82
- autoload :OpenLDAP, File.join(DATABASE_PATH, 'openldap')
83
- autoload :SQLite, File.join(DATABASE_PATH, 'sqlite')
73
+ autoload :Base, File.join(DATABASE_PATH, "base")
74
+ autoload :MySQL, File.join(DATABASE_PATH, "mysql")
75
+ autoload :PostgreSQL, File.join(DATABASE_PATH, "postgresql")
76
+ autoload :MongoDB, File.join(DATABASE_PATH, "mongodb")
77
+ autoload :Redis, File.join(DATABASE_PATH, "redis")
78
+ autoload :Riak, File.join(DATABASE_PATH, "riak")
79
+ autoload :OpenLDAP, File.join(DATABASE_PATH, "openldap")
80
+ autoload :SQLite, File.join(DATABASE_PATH, "sqlite")
84
81
  end
85
82
 
86
83
  ##
87
84
  # Autoload compressor files
88
85
  module Compressor
89
- autoload :Base, File.join(COMPRESSOR_PATH, 'base')
90
- autoload :Gzip, File.join(COMPRESSOR_PATH, 'gzip')
91
- autoload :Bzip2, File.join(COMPRESSOR_PATH, 'bzip2')
92
- autoload :Custom, File.join(COMPRESSOR_PATH, 'custom')
86
+ autoload :Base, File.join(COMPRESSOR_PATH, "base")
87
+ autoload :Gzip, File.join(COMPRESSOR_PATH, "gzip")
88
+ autoload :Bzip2, File.join(COMPRESSOR_PATH, "bzip2")
89
+ autoload :Custom, File.join(COMPRESSOR_PATH, "custom")
93
90
  end
94
91
 
95
92
  ##
96
93
  # Autoload encryptor files
97
94
  module Encryptor
98
- autoload :Base, File.join(ENCRYPTOR_PATH, 'base')
99
- autoload :OpenSSL, File.join(ENCRYPTOR_PATH, 'open_ssl')
100
- autoload :GPG, File.join(ENCRYPTOR_PATH, 'gpg')
95
+ autoload :Base, File.join(ENCRYPTOR_PATH, "base")
96
+ autoload :OpenSSL, File.join(ENCRYPTOR_PATH, "open_ssl")
97
+ autoload :GPG, File.join(ENCRYPTOR_PATH, "gpg")
101
98
  end
102
99
 
103
100
  ##
104
101
  # Autoload notification files
105
102
  module Notifier
106
- autoload :Base, File.join(NOTIFIER_PATH, 'base')
107
- autoload :Mail, File.join(NOTIFIER_PATH, 'mail')
108
- autoload :Twitter, File.join(NOTIFIER_PATH, 'twitter')
109
- autoload :Campfire, File.join(NOTIFIER_PATH, 'campfire')
110
- autoload :Prowl, File.join(NOTIFIER_PATH, 'prowl')
111
- autoload :Hipchat, File.join(NOTIFIER_PATH, 'hipchat')
112
- autoload :PagerDuty, File.join(NOTIFIER_PATH, 'pagerduty')
113
- autoload :Pushover, File.join(NOTIFIER_PATH, 'pushover')
114
- autoload :Slack, File.join(NOTIFIER_PATH, 'slack')
115
- autoload :HttpPost, File.join(NOTIFIER_PATH, 'http_post')
116
- autoload :Nagios, File.join(NOTIFIER_PATH, 'nagios')
117
- autoload :FlowDock, File.join(NOTIFIER_PATH, 'flowdock')
118
- autoload :Zabbix, File.join(NOTIFIER_PATH, 'zabbix')
119
- autoload :DataDog, File.join(NOTIFIER_PATH, 'datadog')
120
- autoload :Ses, File.join(NOTIFIER_PATH, 'ses')
121
- autoload :Command, File.join(NOTIFIER_PATH, 'command')
103
+ autoload :Base, File.join(NOTIFIER_PATH, "base")
104
+ autoload :Mail, File.join(NOTIFIER_PATH, "mail")
105
+ autoload :Twitter, File.join(NOTIFIER_PATH, "twitter")
106
+ autoload :Campfire, File.join(NOTIFIER_PATH, "campfire")
107
+ autoload :Prowl, File.join(NOTIFIER_PATH, "prowl")
108
+ autoload :Hipchat, File.join(NOTIFIER_PATH, "hipchat")
109
+ autoload :PagerDuty, File.join(NOTIFIER_PATH, "pagerduty")
110
+ autoload :Pushover, File.join(NOTIFIER_PATH, "pushover")
111
+ autoload :Slack, File.join(NOTIFIER_PATH, "slack")
112
+ autoload :HttpPost, File.join(NOTIFIER_PATH, "http_post")
113
+ autoload :Nagios, File.join(NOTIFIER_PATH, "nagios")
114
+ autoload :FlowDock, File.join(NOTIFIER_PATH, "flowdock")
115
+ autoload :Zabbix, File.join(NOTIFIER_PATH, "zabbix")
116
+ autoload :DataDog, File.join(NOTIFIER_PATH, "datadog")
117
+ autoload :Ses, File.join(NOTIFIER_PATH, "ses")
118
+ autoload :Command, File.join(NOTIFIER_PATH, "command")
122
119
  end
123
120
 
124
121
  ##
125
122
  # Require Backup base files
126
- %w{
123
+ %w[
127
124
  errors
128
125
  logger
129
126
  utilities
@@ -139,6 +136,5 @@ module Backup
139
136
  splitter
140
137
  template
141
138
  version
142
- }.each {|lib| require File.join(LIBRARY_PATH, lib) }
143
-
139
+ ].each { |lib| require File.join(LIBRARY_PATH, lib) }
144
140
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Backup
4
2
  class Archive
5
3
  class Error < Backup::Error; end
@@ -55,45 +53,47 @@ module Backup
55
53
  @model = model
56
54
  @name = name.to_s
57
55
  @options = {
58
- :sudo => false,
59
- :root => false,
60
- :paths => [],
61
- :excludes => [],
62
- :tar_options => ''
56
+ sudo: false,
57
+ root: false,
58
+ paths: [],
59
+ excludes: [],
60
+ tar_options: ""
63
61
  }
64
62
  DSL.new(@options).instance_eval(&block)
65
63
  end
66
64
 
67
65
  def perform!
68
- Logger.info "Creating Archive '#{ name }'..."
66
+ Logger.info "Creating Archive '#{name}'..."
69
67
 
70
- path = File.join(Config.tmp_path, @model.trigger, 'archives')
68
+ path = File.join(Config.tmp_path, @model.trigger, "archives")
71
69
  FileUtils.mkdir_p(path)
72
70
 
73
71
  pipeline = Pipeline.new
74
72
  with_files_from(paths_to_package) do |files_from|
75
73
  pipeline.add(
76
- "#{ tar_command } #{ tar_options } -cPf -#{ tar_root } " +
77
- "#{ paths_to_exclude } #{ files_from }",
74
+ "#{tar_command} #{tar_options} -cPf -#{tar_root} " \
75
+ "#{paths_to_exclude} #{files_from}",
78
76
  tar_success_codes
79
77
  )
80
78
 
81
- extension = 'tar'
82
- @model.compressor.compress_with do |command, ext|
83
- pipeline << command
84
- extension << ext
85
- end if @model.compressor
79
+ extension = "tar"
80
+ if @model.compressor
81
+ @model.compressor.compress_with do |command, ext|
82
+ pipeline << command
83
+ extension << ext
84
+ end
85
+ end
86
86
 
87
- pipeline << "#{ utility(:cat) } > " +
88
- "'#{ File.join(path, "#{ name }.#{ extension }") }'"
87
+ pipeline << "#{utility(:cat)} > " \
88
+ "'#{File.join(path, "#{name}.#{extension}")}'"
89
89
  pipeline.run
90
90
  end
91
91
 
92
92
  if pipeline.success?
93
- Logger.info "Archive '#{ name }' Complete!"
93
+ Logger.info "Archive '#{name}' Complete!"
94
94
  else
95
- raise Error, "Failed to Create Archive '#{ name }'\n" +
96
- pipeline.error_messages
95
+ raise Error, "Failed to Create Archive '#{name}'\n" +
96
+ pipeline.error_messages
97
97
  end
98
98
  end
99
99
 
@@ -101,30 +101,30 @@ module Backup
101
101
 
102
102
  def tar_command
103
103
  tar = utility(:tar)
104
- options[:sudo] ? "#{ utility(:sudo) } -n #{ tar }" : tar
104
+ options[:sudo] ? "#{utility(:sudo)} -n #{tar}" : tar
105
105
  end
106
106
 
107
107
  def tar_root
108
- options[:root] ? " -C '#{ File.expand_path(options[:root]) }'" : ''
108
+ options[:root] ? " -C '#{File.expand_path(options[:root])}'" : ""
109
109
  end
110
110
 
111
111
  def paths_to_package
112
- options[:paths].map {|path| prepare_path(path) }
112
+ options[:paths].map { |path| prepare_path(path) }
113
113
  end
114
114
 
115
115
  def with_files_from(paths)
116
- tmpfile = Tempfile.new('backup-archive-paths')
117
- paths.each {|path| tmpfile.puts path }
116
+ tmpfile = Tempfile.new("backup-archive-paths")
117
+ paths.each { |path| tmpfile.puts path }
118
118
  tmpfile.close
119
- yield "-T '#{ tmpfile.path }'"
119
+ yield "-T '#{tmpfile.path}'"
120
120
  ensure
121
121
  tmpfile.delete
122
122
  end
123
123
 
124
124
  def paths_to_exclude
125
- options[:excludes].map {|path|
126
- "--exclude='#{ prepare_path(path) }'"
127
- }.join(' ')
125
+ options[:excludes].map do |path|
126
+ "--exclude='#{prepare_path(path)}'"
127
+ end.join(" ")
128
128
  end
129
129
 
130
130
  def prepare_path(path)
@@ -133,7 +133,7 @@ module Backup
133
133
 
134
134
  def tar_options
135
135
  args = options[:tar_options]
136
- gnu_tar? ? "--ignore-failed-read #{ args }".strip : args
136
+ gnu_tar? ? "--ignore-failed-read #{args}".strip : args
137
137
  end
138
138
 
139
139
  def tar_success_codes
@@ -165,6 +165,5 @@ module Backup
165
165
  @options[:tar_options] = opts
166
166
  end
167
167
  end
168
-
169
168
  end
170
169
  end
@@ -1,14 +1,11 @@
1
- # encoding: utf-8
2
-
3
1
  module Backup
4
2
  class Binder
5
-
6
3
  ##
7
4
  # Creates a new Backup::Notifier::Binder instance. Loops through the provided
8
5
  # Hash to set instance variables
9
6
  def initialize(key_and_values)
10
7
  key_and_values.each do |key, value|
11
- instance_variable_set("@#{ key }", value)
8
+ instance_variable_set("@#{key}", value)
12
9
  end
13
10
  end
14
11
 
@@ -17,6 +14,5 @@ module Backup
17
14
  def get_binding
18
15
  binding
19
16
  end
20
-
21
17
  end
22
- end
18
+ end