backup 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 552f524acf300a8918b07f535d29b23506cb1b9d
4
- data.tar.gz: 31a993d965e008dba36bdcb1319e7be4bc4ab0c2
3
+ metadata.gz: 427a033c5c094cc9f82b80cadd8a8fcf9b18223e
4
+ data.tar.gz: 77c8acac1d99cea70a94a95ac4fba311cbb232f2
5
5
  SHA512:
6
- metadata.gz: 76ce5ab435d082d9947211a394ce1985f69f965758595e89a14b0f57f001b852b6bc4d2df89437c9ee5267c3196ae7c57c7075c006a9ba0637323e7c8e986623
7
- data.tar.gz: 4b5c1ad79f13079a3a009a85012c80065c76dd16f62883bfd3ffb28b86822f06759e7a5990d5646c6b71611128d53c0d61a7c008a905e5404f6d99abc6cef09d
6
+ metadata.gz: 11f4d89ab2012246bc79e22a88764b6898f880d5eb713b07d5621292398d186d6926c5234eddb3cc5706093630436e19294e5ec5bcbcb94115fd56b3a9f2d34a
7
+ data.tar.gz: bd727cc3c085768a6978de26fa156f9aee61bc6259386a1ad8cf56a28bd272ed9a24407550f7bd30b0f623f5a08b5c9aaabcc5ec845f2b2492bb9fc73a656d9e
data/README.md CHANGED
@@ -8,12 +8,16 @@ was built with modularity, extensibility and simplicity in mind.
8
8
 
9
9
  ## Installation
10
10
 
11
- To get the latest stable version:
11
+ To install the latest version, run:
12
12
 
13
- gem install backup
13
+ $ [sudo] gem install backup
14
14
 
15
- See [Release Notes](https://github.com/meskyanichi/backup/wiki/Release-Notes) in the wiki for changes in the latest
16
- version.
15
+ _Do not add `gem backup` to an application's `Gemfile`_
16
+
17
+ See [Installation](https://github.com/meskyanichi/backup/wiki/Installation) for more information about installing and
18
+ updating your installation of Backup.
19
+
20
+ See [Release Notes](https://github.com/meskyanichi/backup/wiki/Release-Notes) for changes in the latest version.
17
21
 
18
22
  Backup supports Ruby versions 1.8.7, 1.9.2, 1.9.3 and 2.0.0.
19
23
 
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  # Load Ruby Core Libraries
4
- require 'rubygems'
5
4
  require 'fileutils'
6
5
  require 'tempfile'
7
6
  require 'syslog'
@@ -112,7 +111,6 @@ module Backup
112
111
  config
113
112
  cli
114
113
  configuration
115
- dependency
116
114
  errors
117
115
  logger
118
116
  model
@@ -362,110 +362,13 @@ module Backup
362
362
  end
363
363
  end
364
364
 
365
- ##
366
- # [Dependencies]
367
- # Returns a list of Backup's dependencies
368
- desc 'dependencies', 'Display, Check or Install Dependencies for Backup.'
369
-
370
- long_desc <<-EOS.gsub(/^ +/, '')
371
- To display a list of available dependencies, run:
372
-
373
- $ backup dependencies --list
374
-
375
- To install one of these dependencies, run:
376
-
377
- $ backup dependencies --install <name>
378
-
379
- To check if a dependency is already installed, run:
380
-
381
- $ backup dependencies --installed <name>
382
- EOS
383
-
384
- method_option :install, :type => :string, :banner => 'NAME'
385
- method_option :list, :type => :boolean
386
- method_option :installed, :type => :string, :banner => 'NAME'
387
-
388
- def dependencies
389
- Helpers.exec!("#{ $0 } help dependencies") unless options.any?
390
-
391
- if options[:list]
392
- deps = Dependency.all
393
- width = 15 + deps.map {|dep| dep.used_for }.map(&:length).max
394
- deps.each do |dep|
395
- puts
396
- puts "Gem Name: #{ dep.name }"
397
- puts "Version: #{ dep.requirements.join(', ') }"
398
- puts "Used for: #{ dep.used_for }"
399
- puts '-' * width
400
- end
401
- exit
402
- end
403
-
404
- name = options[:install] || options[:installed]
405
- unless dep = Dependency.find(name)
406
- abort "'#{ name }' is not a Backup dependency."
407
- end
408
-
409
- if options[:install]
410
- if Helpers.bundler_loaded?
411
- abort <<-EOS.gsub(/^ +/, '')
412
- === Bundler Detected ===
413
- This command should not be run within a Bundler managed environment.
414
- While it is possible to install Backup and it's dependencies using
415
- Bundler, the gem version requirements must still be met as shown by:
416
- > backup dependencies --list
417
- EOS
418
- end
419
-
420
- dep.dependencies.each do |_dep|
421
- unless _dep.installed?
422
- abort <<-EOS.gsub(/^ +/, '')
423
- The '#{ dep.name }' gem requires '#{ _dep.name }'
424
- Please install this first using the following command:
425
- > backup dependencies --install #{ _dep.name }
426
- EOS
427
- end
428
- end
429
-
430
- dep.install!
431
- end
432
-
433
- if options[:installed]
434
- name, err_msg = nil, nil
435
-
436
- dep.dependencies.each do |_dep|
437
- unless _dep.installed?
438
- name = _dep.name
439
- err_msg = "'#{ dep.name }' requires the '#{ name }' gem."
440
- break
441
- end
442
- end
443
-
444
- unless err_msg || dep.installed?
445
- name = dep.name
446
- err_msg = "'#{ name }' is not installed."
447
- end
448
-
449
- if err_msg
450
- abort <<-EOS.gsub(/^ +/, '')
451
- #{ err_msg }
452
- To install the gem, issue the following command:
453
- > backup dependencies --install #{ name }
454
- Please try again after installing the missing dependency.
455
- EOS
456
- else
457
- puts "'#{ dep.name }' is installed."
458
- end
459
- end
460
- end
461
-
462
365
  ##
463
366
  # [Version]
464
367
  # Returns the current version of the Backup gem
465
368
  map '-v' => :version
466
369
  desc 'version', 'Display installed Backup version'
467
370
  def version
468
- puts "Backup #{Backup::Version.current}"
371
+ puts "Backup #{ Backup::VERSION }"
469
372
  end
470
373
 
471
374
  # This is to avoid Thor's warnings when stubbing methods on the Thor class.
@@ -485,10 +388,6 @@ module Backup
485
388
  exec(cmd)
486
389
  end
487
390
 
488
- def bundler_loaded?
489
- !ENV['BUNDLE_GEMFILE'].to_s.empty?
490
- end
491
-
492
391
  end
493
392
  end
494
393
 
@@ -5,7 +5,9 @@ module Backup
5
5
  class PostgreSQL < Base
6
6
 
7
7
  ##
8
- # Name of the database that needs to get dumped
8
+ # Name of the database that needs to get dumped.
9
+ # To dump all databases, set this to `:all` or leave blank.
10
+ # +username+ must be a PostgreSQL superuser to run `pg_dumpall`.
9
11
  attr_accessor :name
10
12
 
11
13
  ##
@@ -17,20 +19,24 @@ module Backup
17
19
  attr_accessor :host, :port, :socket
18
20
 
19
21
  ##
20
- # Tables to skip while dumping the database
22
+ # Tables to skip while dumping the database.
23
+ # If `name` is set to :all (or not specified), these are ignored.
21
24
  attr_accessor :skip_tables
22
25
 
23
26
  ##
24
- # Tables to dump, tables that aren't specified won't get dumped
27
+ # Tables to dump. This in only valid if `name` is specified.
28
+ # If none are given, the entire database will be dumped.
25
29
  attr_accessor :only_tables
26
30
 
27
31
  ##
28
- # Additional "pg_dump" options
32
+ # Additional "pg_dump" or "pg_dumpall" options
29
33
  attr_accessor :additional_options
30
34
 
31
35
  def initialize(model, database_id = nil, &block)
32
36
  super
33
37
  instance_eval(&block) if block_given?
38
+
39
+ @name ||= :all
34
40
  end
35
41
 
36
42
  ##
@@ -44,7 +50,7 @@ module Backup
44
50
  pipeline = Pipeline.new
45
51
  dump_ext = 'sql'
46
52
 
47
- pipeline << pgdump
53
+ pipeline << (dump_all? ? pgdumpall : pgdump)
48
54
 
49
55
  model.compressor.compress_with do |command, ext|
50
56
  pipeline << command
@@ -69,6 +75,12 @@ module Backup
69
75
  "#{ user_options } #{ tables_to_dump } #{ tables_to_skip } #{ name }"
70
76
  end
71
77
 
78
+ def pgdumpall
79
+ "#{ password_option }" +
80
+ "#{ utility(:pg_dumpall) } #{ username_option } " +
81
+ "#{ connectivity_options } #{ user_options }"
82
+ end
83
+
72
84
  def password_option
73
85
  "PGPASSWORD='#{ password }' " if password
74
86
  end
@@ -102,6 +114,10 @@ module Backup
102
114
  end.join(' ')
103
115
  end
104
116
 
117
+ def dump_all?
118
+ name == :all
119
+ end
120
+
105
121
  attr_deprecate :utility_path, :version => '3.0.21',
106
122
  :message => 'Use Backup::Utilities.configure instead.',
107
123
  :action => lambda {|klass, val|
@@ -324,7 +324,7 @@ module Backup
324
324
  case action
325
325
  when :started
326
326
  Logger.info "Performing Backup for '#{label} (#{trigger})'!\n" +
327
- "[ backup #{ Version.current } : #{ RUBY_DESCRIPTION } ]"
327
+ "[ backup #{ VERSION } : #{ RUBY_DESCRIPTION } ]"
328
328
 
329
329
  when :finished
330
330
  msg = "Backup for '#{ label } (#{ trigger })' " +
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- ##
4
- # Load the HTTParty library from the gem
5
- Backup::Dependency.load('httparty')
2
+ require 'httparty'
6
3
 
7
4
  module Backup
8
5
  module Notifier
@@ -1,7 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- # Load the HipChat library from the gem
4
- Backup::Dependency.load('hipchat')
2
+ require 'hipchat'
5
3
 
6
4
  module Backup
7
5
  module Notifier
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- ##
4
- # Only load the Mail gem when using Mail notifications
5
- Backup::Dependency.load('mail')
2
+ require 'mail'
6
3
 
7
4
  module Backup
8
5
  module Notifier
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- ##
4
- # Only load the Prowler gem when using Prowler notifications
5
- Backup::Dependency.load('prowler')
2
+ require 'prowler'
6
3
 
7
4
  module Backup
8
5
  module Notifier
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- ##
4
- # Only load the Twitter gem when using Twitter notifications
5
- Backup::Dependency.load('twitter')
2
+ require 'twitter'
6
3
 
7
4
  module Backup
8
5
  module Notifier
@@ -27,7 +27,7 @@ module Backup
27
27
  @trigger = model.trigger
28
28
  @extension = 'tar'
29
29
  @chunk_suffixes = Array.new
30
- @version = Version.current
30
+ @version = VERSION
31
31
  end
32
32
 
33
33
  def filenames
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- Backup::Dependency.load('fog')
2
+ require 'fog'
4
3
 
5
4
  module Backup
6
5
  module Storage
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- Backup::Dependency.load('dropbox-sdk')
2
+ require 'dropbox_sdk'
4
3
 
5
4
  module Backup
6
5
  module Storage
@@ -1,5 +1,4 @@
1
1
  # encoding: utf-8
2
-
3
2
  require 'net/ftp'
4
3
 
5
4
  module Backup
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- Backup::Dependency.load('fog')
2
+ require 'fog'
4
3
 
5
4
  module Backup
6
5
  module Storage
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- Backup::Dependency.load('fog')
2
+ require 'fog'
4
3
  require 'base64'
5
4
  require 'digest/md5'
6
5
 
@@ -56,6 +55,31 @@ module Backup
56
55
  # Default: 30
57
56
  attr_accessor :retry_waitsec
58
57
 
58
+ ##
59
+ # Encryption algorithm to use for Amazon Server-Side Encryption
60
+ #
61
+ # Supported values:
62
+ #
63
+ # - :aes256
64
+ #
65
+ # @see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html
66
+ #
67
+ # Default: nil
68
+ attr_accessor :encryption
69
+
70
+ ##
71
+ # Storage class to use for the S3 objects uploaded
72
+ #
73
+ # Supported values:
74
+ #
75
+ # - :standard (default)
76
+ # - :reduced_redundancy
77
+ #
78
+ # @see http://docs.aws.amazon.com/AmazonS3/latest/dev/SetStoClsOfObjUploaded.html
79
+ #
80
+ # Default: :standard
81
+ attr_accessor :storage_class
82
+
59
83
  def initialize(model, storage_id = nil, &block)
60
84
  super
61
85
  instance_eval(&block) if block_given?
@@ -64,6 +88,7 @@ module Backup
64
88
  @max_retries ||= 10
65
89
  @retry_waitsec ||= 30
66
90
  @path ||= 'backups'
91
+ @storage_class ||= :standard
67
92
  path.sub!(/^\//, '')
68
93
  end
69
94
 
@@ -87,8 +112,7 @@ module Backup
87
112
  src = File.join(Config.tmp_path, filename)
88
113
  dest = File.join(remote_path, filename)
89
114
  Logger.info "Storing '#{ bucket }/#{ dest }'..."
90
- Uploader.new(connection, bucket, src, dest,
91
- chunk_size, max_retries, retry_waitsec).run
115
+ Uploader.new(self, connection, src, dest).run
92
116
  end
93
117
  end
94
118
 
@@ -108,20 +132,21 @@ module Backup
108
132
  end
109
133
 
110
134
  class Uploader
111
- attr_reader :connection, :bucket, :src, :dest
112
- attr_reader :chunk_size, :max_retries, :retry_waitsec
113
- attr_reader :upload_id, :parts
114
-
115
- def initialize(connection, bucket, src, dest,
116
- chunk_size, max_retries, retry_waitsec)
117
- @connection = connection
118
- @bucket = bucket
119
- @src = src
120
- @dest = dest
121
- @chunk_size = 1024**2 * chunk_size
122
- @max_retries = max_retries
123
- @retry_waitsec = retry_waitsec
124
- @parts = []
135
+ attr_reader :connection, :bucket, :chunk_size, :max_retries,
136
+ :retry_waitsec, :storage_class, :encryption,
137
+ :src, :dest, :upload_id, :parts
138
+
139
+ def initialize(storage, connection, src, dest)
140
+ @connection = connection
141
+ @bucket = storage.bucket
142
+ @chunk_size = storage.chunk_size * 1024**2
143
+ @max_retries = storage.max_retries
144
+ @retry_waitsec = storage.retry_waitsec
145
+ @encryption = storage.encryption
146
+ @storage_class = storage.storage_class
147
+ @src = src
148
+ @dest = dest
149
+ @parts = []
125
150
  end
126
151
 
127
152
  def run
@@ -140,16 +165,17 @@ module Backup
140
165
 
141
166
  def upload
142
167
  md5 = Base64.encode64(Digest::MD5.file(src).digest).chomp
168
+ options = headers.merge('Content-MD5' => md5)
143
169
  with_retries do
144
170
  File.open(src, 'r') do |file|
145
- connection.put_object(bucket, dest, file, { 'Content-MD5' => md5 })
171
+ connection.put_object(bucket, dest, file, options)
146
172
  end
147
173
  end
148
174
  end
149
175
 
150
176
  def initiate_multipart
151
177
  with_retries do
152
- resp = connection.initiate_multipart_upload(bucket, dest)
178
+ resp = connection.initiate_multipart_upload(bucket, dest, headers)
153
179
  @upload_id = resp.body['UploadId']
154
180
  end
155
181
  end
@@ -171,6 +197,22 @@ module Backup
171
197
  end
172
198
  end
173
199
 
200
+ def headers
201
+ headers = {}
202
+
203
+ val = encryption.to_s.upcase
204
+ headers.merge!(
205
+ { 'x-amz-server-side-encryption' => val }
206
+ ) unless val.empty?
207
+
208
+ val = storage_class.to_s.upcase
209
+ headers.merge!(
210
+ { 'x-amz-storage-class' => val }
211
+ ) unless val.empty? || val == 'STANDARD'
212
+
213
+ headers
214
+ end
215
+
174
216
  def complete_multipart
175
217
  with_retries do
176
218
  connection.complete_multipart_upload(bucket, dest, upload_id, parts)
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- Backup::Dependency.load('net-scp')
2
+ require 'net/scp'
4
3
 
5
4
  module Backup
6
5
  module Storage
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- Backup::Dependency.load('net-sftp')
2
+ require 'net/sftp'
4
3
 
5
4
  module Backup
6
5
  module Storage
@@ -3,8 +3,10 @@
3
3
  ##
4
4
  # Only load the Fog gem, along with the Parallel gem, when the
5
5
  # Backup::Syncer::Cloud class is loaded
6
- Backup::Dependency.load('fog')
7
- Backup::Dependency.load('parallel')
6
+ # Backup::Dependency.load('fog')
7
+ # Backup::Dependency.load('parallel')
8
+ require 'fog'
9
+ require 'parallel'
8
10
 
9
11
  module Backup
10
12
  module Syncer
@@ -6,7 +6,7 @@ module Backup
6
6
  NAMES = %w{
7
7
  tar cat split find xargs sudo chown
8
8
  gzip bzip2 lzma pbzip2
9
- mongo mongodump mysqldump pg_dump redis-cli riak-admin
9
+ mongo mongodump mysqldump pg_dump pg_dumpall redis-cli riak-admin
10
10
  gpg openssl
11
11
  rsync ssh
12
12
  }
@@ -77,6 +77,7 @@ module Backup
77
77
  # mongodump '/path/to/mongodump'
78
78
  # mysqldump '/path/to/mysqldump'
79
79
  # pg_dump '/path/to/pg_dump'
80
+ # pg_dumpall '/path/to/pg_dumpall'
80
81
  # redis_cli '/path/to/redis-cli'
81
82
  # riak_admin '/path/to/riak-admin'
82
83
  #
@@ -1,43 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Backup
4
- class Version
5
-
6
- ##
7
- # Change the MAJOR, MINOR and PATCH constants below
8
- # to adjust the version of the Backup gem
9
- #
10
- # MAJOR:
11
- # Defines the major version
12
- # MINOR:
13
- # Defines the minor version
14
- # PATCH:
15
- # Defines the patch version
16
- MAJOR, MINOR, PATCH = 3, 4, 0
17
-
18
- ##
19
- # Returns the major version ( big release based off of multiple minor releases )
20
- def self.major
21
- MAJOR
22
- end
23
-
24
- ##
25
- # Returns the minor version ( small release based off of multiple patches )
26
- def self.minor
27
- MINOR
28
- end
29
-
30
- ##
31
- # Returns the patch version ( updates, features and (crucial) bug fixes )
32
- def self.patch
33
- PATCH
34
- end
35
-
36
- ##
37
- # Returns the current version of the Backup gem ( qualified for the gemspec )
38
- def self.current
39
- "#{major}.#{minor}.#{patch}"
40
- end
41
-
42
- end
4
+ VERSION = '3.5.0'
43
5
  end
@@ -2,12 +2,14 @@
2
2
  # PostgreSQL [Database]
3
3
  #
4
4
  database PostgreSQL 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"
8
9
  db.host = "localhost"
9
10
  db.port = 5432
10
11
  db.socket = "/tmp/pg.sock"
12
+ # When dumping all databases, `skip_tables` and `only_tables` are ignored.
11
13
  db.skip_tables = ["skip", "these", "tables"]
12
14
  db.only_tables = ["only", "these", "tables"]
13
15
  db.additional_options = ["-xc", "-E=utf8"]
@@ -1,2 +1,2 @@
1
- Backup version <%= Backup::Version.current %>
2
- Ruby version <%= RUBY_DESCRIPTION %>
1
+ Backup v<%= Backup::VERSION %>
2
+ Ruby: <%= RUBY_DESCRIPTION %>
metadata CHANGED
@@ -1,49 +1,407 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van Rooijen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-29 00:00:00.000000000 Z
11
+ date: 2013-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: thor
14
+ name: builder
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: dropbox-sdk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.5.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.5.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: excon
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.20.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.20.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: faraday
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.7
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.7
69
+ - !ruby/object:Gem::Dependency
70
+ name: fog
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 1.10.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.10.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: formatador
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.2.4
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.2.4
97
+ - !ruby/object:Gem::Dependency
98
+ name: hipchat
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.8.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.8.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: httparty
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 0.11.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 0.11.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: i18n
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.6.4
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.6.4
139
+ - !ruby/object:Gem::Dependency
140
+ name: json
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 1.7.7
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 1.7.7
153
+ - !ruby/object:Gem::Dependency
154
+ name: mail
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '='
158
+ - !ruby/object:Gem::Version
159
+ version: 2.5.3
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '='
165
+ - !ruby/object:Gem::Version
166
+ version: 2.5.3
167
+ - !ruby/object:Gem::Dependency
168
+ name: mime-types
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: '1.23'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '='
179
+ - !ruby/object:Gem::Version
180
+ version: '1.23'
181
+ - !ruby/object:Gem::Dependency
182
+ name: multi_json
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - '='
186
+ - !ruby/object:Gem::Version
187
+ version: 1.7.2
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - '='
193
+ - !ruby/object:Gem::Version
194
+ version: 1.7.2
195
+ - !ruby/object:Gem::Dependency
196
+ name: multi_xml
15
197
  requirement: !ruby/object:Gem::Requirement
16
198
  requirements:
17
- - - '>='
199
+ - - '='
200
+ - !ruby/object:Gem::Version
201
+ version: 0.5.3
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - '='
207
+ - !ruby/object:Gem::Version
208
+ version: 0.5.3
209
+ - !ruby/object:Gem::Dependency
210
+ name: multipart-post
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - '='
214
+ - !ruby/object:Gem::Version
215
+ version: 1.2.0
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '='
18
221
  - !ruby/object:Gem::Version
19
- version: 0.15.4
20
- - - <
222
+ version: 1.2.0
223
+ - !ruby/object:Gem::Dependency
224
+ name: net-scp
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - '='
21
228
  - !ruby/object:Gem::Version
22
- version: '2'
229
+ version: 1.1.0
23
230
  type: :runtime
24
231
  prerelease: false
25
232
  version_requirements: !ruby/object:Gem::Requirement
26
233
  requirements:
27
- - - '>='
234
+ - - '='
28
235
  - !ruby/object:Gem::Version
29
- version: 0.15.4
30
- - - <
236
+ version: 1.1.0
237
+ - !ruby/object:Gem::Dependency
238
+ name: net-sftp
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - '='
31
242
  - !ruby/object:Gem::Version
32
- version: '2'
243
+ version: 2.1.1
244
+ type: :runtime
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - '='
249
+ - !ruby/object:Gem::Version
250
+ version: 2.1.1
251
+ - !ruby/object:Gem::Dependency
252
+ name: net-ssh
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - '='
256
+ - !ruby/object:Gem::Version
257
+ version: 2.6.7
258
+ type: :runtime
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - '='
263
+ - !ruby/object:Gem::Version
264
+ version: 2.6.7
265
+ - !ruby/object:Gem::Dependency
266
+ name: nokogiri
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - '='
270
+ - !ruby/object:Gem::Version
271
+ version: 1.5.9
272
+ type: :runtime
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - '='
277
+ - !ruby/object:Gem::Version
278
+ version: 1.5.9
33
279
  - !ruby/object:Gem::Dependency
34
280
  name: open4
35
281
  requirement: !ruby/object:Gem::Requirement
36
282
  requirements:
37
- - - ~>
283
+ - - '='
38
284
  - !ruby/object:Gem::Version
39
285
  version: 1.3.0
40
286
  type: :runtime
41
287
  prerelease: false
42
288
  version_requirements: !ruby/object:Gem::Requirement
43
289
  requirements:
44
- - - ~>
290
+ - - '='
45
291
  - !ruby/object:Gem::Version
46
292
  version: 1.3.0
293
+ - !ruby/object:Gem::Dependency
294
+ name: parallel
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - '='
298
+ - !ruby/object:Gem::Version
299
+ version: 0.6.4
300
+ type: :runtime
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - '='
305
+ - !ruby/object:Gem::Version
306
+ version: 0.6.4
307
+ - !ruby/object:Gem::Dependency
308
+ name: polyglot
309
+ requirement: !ruby/object:Gem::Requirement
310
+ requirements:
311
+ - - '='
312
+ - !ruby/object:Gem::Version
313
+ version: 0.3.3
314
+ type: :runtime
315
+ prerelease: false
316
+ version_requirements: !ruby/object:Gem::Requirement
317
+ requirements:
318
+ - - '='
319
+ - !ruby/object:Gem::Version
320
+ version: 0.3.3
321
+ - !ruby/object:Gem::Dependency
322
+ name: prowler
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - '='
326
+ - !ruby/object:Gem::Version
327
+ version: 1.3.1
328
+ type: :runtime
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - '='
333
+ - !ruby/object:Gem::Version
334
+ version: 1.3.1
335
+ - !ruby/object:Gem::Dependency
336
+ name: ruby-hmac
337
+ requirement: !ruby/object:Gem::Requirement
338
+ requirements:
339
+ - - '='
340
+ - !ruby/object:Gem::Version
341
+ version: 0.4.0
342
+ type: :runtime
343
+ prerelease: false
344
+ version_requirements: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - '='
347
+ - !ruby/object:Gem::Version
348
+ version: 0.4.0
349
+ - !ruby/object:Gem::Dependency
350
+ name: simple_oauth
351
+ requirement: !ruby/object:Gem::Requirement
352
+ requirements:
353
+ - - '='
354
+ - !ruby/object:Gem::Version
355
+ version: 0.2.0
356
+ type: :runtime
357
+ prerelease: false
358
+ version_requirements: !ruby/object:Gem::Requirement
359
+ requirements:
360
+ - - '='
361
+ - !ruby/object:Gem::Version
362
+ version: 0.2.0
363
+ - !ruby/object:Gem::Dependency
364
+ name: thor
365
+ requirement: !ruby/object:Gem::Requirement
366
+ requirements:
367
+ - - '='
368
+ - !ruby/object:Gem::Version
369
+ version: 0.18.1
370
+ type: :runtime
371
+ prerelease: false
372
+ version_requirements: !ruby/object:Gem::Requirement
373
+ requirements:
374
+ - - '='
375
+ - !ruby/object:Gem::Version
376
+ version: 0.18.1
377
+ - !ruby/object:Gem::Dependency
378
+ name: treetop
379
+ requirement: !ruby/object:Gem::Requirement
380
+ requirements:
381
+ - - '='
382
+ - !ruby/object:Gem::Version
383
+ version: 1.4.12
384
+ type: :runtime
385
+ prerelease: false
386
+ version_requirements: !ruby/object:Gem::Requirement
387
+ requirements:
388
+ - - '='
389
+ - !ruby/object:Gem::Version
390
+ version: 1.4.12
391
+ - !ruby/object:Gem::Dependency
392
+ name: twitter
393
+ requirement: !ruby/object:Gem::Requirement
394
+ requirements:
395
+ - - '='
396
+ - !ruby/object:Gem::Version
397
+ version: 4.6.2
398
+ type: :runtime
399
+ prerelease: false
400
+ version_requirements: !ruby/object:Gem::Requirement
401
+ requirements:
402
+ - - '='
403
+ - !ruby/object:Gem::Version
404
+ version: 4.6.2
47
405
  description: Backup is a RubyGem, written for UNIX-like operating systems, that allows
48
406
  you to easily perform backup operations on both your remote and local environments.
49
407
  It provides you with an elegant DSL in Ruby for modeling your backups. Backup has
@@ -78,7 +436,6 @@ files:
78
436
  - lib/backup/database/postgresql.rb
79
437
  - lib/backup/database/redis.rb
80
438
  - lib/backup/database/riak.rb
81
- - lib/backup/dependency.rb
82
439
  - lib/backup/encryptor/base.rb
83
440
  - lib/backup/encryptor/gpg.rb
84
441
  - lib/backup/encryptor/open_ssl.rb
@@ -1,165 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Backup
4
- ##
5
- # A little self-contained gem manager for Backup.
6
- # Rather than specifying hard dependencies in the gemspec, forcing users to
7
- # install gems they do not want/need, Backup will notify them when a gem has
8
- # not been installed, or version is incorrect, and provide the command to
9
- # install the gem. These dependencies are dynamically loaded in the Gemfile.
10
- class Dependency
11
- DEPENDENCIES = {
12
- 'fog' => {
13
- :require => 'fog',
14
- :version => '~> 1.9.0',
15
- :for => 'Amazon S3, Rackspace Cloud Files (S3, CloudFiles Storages)',
16
- :dependencies => ['net-ssh', 'net-scp', 'excon']
17
- },
18
-
19
- 'excon' => {
20
- :require => 'excon',
21
- :version => '~> 0.17.0',
22
- :for => 'HTTP Connection Support for Storages/Syncers'
23
- },
24
-
25
- 'dropbox-sdk' => {
26
- :require => 'dropbox_sdk',
27
- :version => '= 1.5.1', # patched in lib/backup/storage/dropbox.rb
28
- :for => 'Dropbox Web Service (Dropbox Storage)'
29
- },
30
-
31
- 'net-sftp' => {
32
- :require => 'net/sftp',
33
- :version => ['>= 2.0.0', '<= 2.0.5'],
34
- :for => 'SFTP Protocol (SFTP Storage)',
35
- :dependencies => 'net-ssh'
36
- },
37
-
38
- 'net-scp' => {
39
- :require => 'net/scp',
40
- :version => ['>= 1.0.0', '<= 1.0.4'],
41
- :for => 'SCP Protocol (SCP Storage)',
42
- :dependencies => 'net-ssh'
43
- },
44
-
45
- 'net-ssh' => {
46
- :require => 'net/ssh',
47
- :version => ['>= 2.3.0', '<= 2.5.2'],
48
- :for => 'SSH Protocol (SSH Storage)'
49
- },
50
-
51
- 'mail' => {
52
- :require => 'mail',
53
- :version => '~> 2.5.0',
54
- :for => 'Sending Emails (Mail Notifier)'
55
- },
56
-
57
- 'twitter' => {
58
- :require => 'twitter',
59
- :version => '~> 4.5.0',
60
- :for => 'Sending Twitter Updates (Twitter Notifier)'
61
- },
62
-
63
- 'httparty' => {
64
- :require => 'httparty',
65
- :version => '~> 0.10.2',
66
- :for => 'Sending Http Updates (Campfire Notifier)'
67
- },
68
-
69
- 'prowler' => {
70
- :require => 'prowler',
71
- :version => '~> 1.3.1',
72
- :for => 'Sending iOS push notifications (Prowl Notifier)'
73
- },
74
-
75
- 'hipchat' => {
76
- :require => 'hipchat',
77
- :version => '~> 0.7.0',
78
- :for => 'Sending notifications to Hipchat'
79
- },
80
-
81
- 'parallel' => {
82
- :require => 'parallel',
83
- :version => '~> 0.6.0',
84
- :for => 'Adding concurrency to Cloud-based syncers.'
85
- }
86
- }
87
-
88
- class << self
89
- def all
90
- @all ||= []
91
- end
92
-
93
- def find(name)
94
- all.select {|dep| dep.name == name }.first
95
- end
96
-
97
- def load(name)
98
- find(name).load!
99
- end
100
- end
101
-
102
- attr_reader :name, :require_as, :used_for, :requirements
103
-
104
- def initialize(name, options = {})
105
- @name = name
106
- @require_as = options[:require]
107
- @requirements = Array(options[:version])
108
- @dependencies = Array(options[:dependencies])
109
- @used_for = options[:for]
110
- end
111
-
112
- # dependencies should be defined in the order
113
- # they should be installed or loaded.
114
- def dependencies
115
- @dependencies.map {|name| self.class.find(name) }
116
- end
117
-
118
- def load!
119
- dependencies.each(&:load!)
120
-
121
- gem(name, *requirements)
122
- require require_as
123
- rescue LoadError
124
- raise Errors::Dependency::LoadError, <<-EOS
125
- Dependency Missing
126
- Gem Name: #{ name }
127
- Used for: #{ used_for }
128
-
129
- To install the gem, issue the following command:
130
- > backup dependencies --install #{ name }
131
- Please try again after installing the missing dependency.
132
- EOS
133
- end
134
-
135
- def installed?
136
- Gem::Specification.find_by_name(name, *requirements)
137
- true
138
- rescue LoadError
139
- false
140
- end
141
-
142
- # If multiple version requirements are defined, this tries to find the
143
- # version that matches them all. Otherwise, it will fallback to installing
144
- # based on the last requirement. This should only be called from the CLI
145
- # for `backup dependencies --install <name>`.
146
- def install!
147
- version = nil
148
- if requirements.count > 1
149
- begin
150
- require 'rubygems/dependency_installer'
151
- inst = Gem::DependencyInstaller.new
152
- spec, _ = inst.find_spec_by_name_and_version(name, *requirements).first
153
- version = spec.version
154
- rescue
155
- end
156
- end
157
- version ||= requirements.last
158
- command = "gem install --no-ri --no-rdoc #{ name } -v '#{ version }'"
159
- puts "\nLaunching `#{ command }`"
160
- exec command
161
- end
162
-
163
- DEPENDENCIES.each {|name, options| all << new(name, options) }
164
- end
165
- end