backup 3.0.7 → 3.0.8

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.
data/Gemfile CHANGED
@@ -3,8 +3,16 @@
3
3
  source 'http://rubygems.org'
4
4
 
5
5
  ##
6
- # Bundle gems defined inside the gemspec file
7
- gemspec
6
+ # Load Backup::Dependency
7
+ %w[cli dependency].each do |path|
8
+ require File.expand_path("../lib/backup/#{path}", __FILE__)
9
+ end
10
+
11
+ ##
12
+ # Dynamically define the dependencies specified in Backup::Dependency.all
13
+ Backup::Dependency.all.each do |name, gemspec|
14
+ gem(name, gemspec[:version])
15
+ end
8
16
 
9
17
  ##
10
18
  # Define gems to be used in the 'test' environment
@@ -1,15 +1,3 @@
1
- PATH
2
- remote: .
3
- specs:
4
- backup (3.0.7)
5
- dropbox (~> 1.2.3)
6
- fog (~> 0.5.3)
7
- mail (~> 2.2.15)
8
- net-scp (~> 1.0.4)
9
- net-sftp (~> 2.0.5)
10
- thor (~> 0.14.6)
11
- twitter (~> 1.1.2)
12
-
13
1
  GEM
14
2
  remote: http://rubygems.org/
15
3
  specs:
@@ -29,9 +17,9 @@ GEM
29
17
  rack (< 2, >= 1.1.0)
30
18
  faraday_middleware (0.3.2)
31
19
  faraday (~> 0.5.4)
32
- fog (0.5.3)
20
+ fog (0.6.0)
33
21
  builder
34
- excon (>= 0.5.2)
22
+ excon (>= 0.5.5)
35
23
  formatador (>= 0.0.16)
36
24
  json
37
25
  mime-types
@@ -70,7 +58,7 @@ GEM
70
58
  notifiers (1.1.0)
71
59
  oauth (0.4.4)
72
60
  polyglot (0.3.1)
73
- rack (1.2.1)
61
+ rack (1.2.2)
74
62
  rspec (2.5.0)
75
63
  rspec-core (~> 2.5.0)
76
64
  rspec-expectations (~> 2.5.0)
@@ -83,7 +71,6 @@ GEM
83
71
  ruby-hmac (0.4.0)
84
72
  ruby-progressbar (0.0.9)
85
73
  simple_oauth (0.1.4)
86
- thor (0.14.6)
87
74
  timecop (0.3.5)
88
75
  treetop (1.4.9)
89
76
  polyglot (>= 0.3.1)
@@ -100,9 +87,15 @@ PLATFORMS
100
87
  ruby
101
88
 
102
89
  DEPENDENCIES
103
- backup!
90
+ dropbox (~> 1.2.3)
91
+ fog (~> 0.6.0)
104
92
  fuubar
105
93
  infinity_test
94
+ mail (~> 2.2.15)
106
95
  mocha
96
+ net-scp (~> 1.0.4)
97
+ net-sftp (~> 2.0.5)
98
+ net-ssh (~> 2.1.3)
107
99
  rspec
108
100
  timecop
101
+ twitter (~> 1.1.2)
data/README.md CHANGED
@@ -74,6 +74,7 @@ Syncers
74
74
  -------
75
75
 
76
76
  - RSync
77
+ - Amazon Simple Storage Service (S3)
77
78
 
78
79
  [Syncer Wiki Page](https://github.com/meskyanichi/backup/wiki/Syncers)
79
80
 
@@ -34,12 +34,6 @@ Gem::Specification.new do |gem|
34
34
 
35
35
  ##
36
36
  # Production gem dependencies
37
- gem.add_dependency 'thor', ['~> 0.14.6'] # CLI
38
- gem.add_dependency 'fog', ['~> 0.5.3' ] # Amazon S3, Rackspace Cloud Files
39
- gem.add_dependency 'dropbox', ['~> 1.2.3' ] # Dropbox
40
- gem.add_dependency 'mail', ['~> 2.2.15'] # Mail
41
- gem.add_dependency 'net-sftp', ['~> 2.0.5' ] # SFTP Protocol
42
- gem.add_dependency 'net-scp', ['~> 1.0.4' ] # SCP Protocol
43
- gem.add_dependency 'twitter', ['~> 1.1.2' ] # Twitter
37
+ gem.add_dependency 'thor', ['~> 0.14.6']
44
38
 
45
39
  end
data/bin/backup CHANGED
@@ -199,6 +199,44 @@ class BackupCLI < Thor
199
199
  end
200
200
  end
201
201
 
202
+ ##
203
+ # [Dependencies]
204
+ # Returns a list of Backup's dependencies
205
+ desc 'dependencies', 'Display the list of dependencies for Backup, or install them through Backup.'
206
+ method_option :install, :type => :string
207
+ method_option :list, :type => :boolean
208
+ def dependencies
209
+ unless options.any?
210
+ puts
211
+ puts "To display a list of available dependencies, run:\n\n"
212
+ puts " backup dependencies --list"
213
+ puts
214
+ puts "To install one of these dependencies (with the correct version), run:\n\n"
215
+ puts " backup dependencies --install <name>"
216
+ exit
217
+ end
218
+
219
+ if options[:list]
220
+ Backup::Dependency.all.each do |name, gemspec|
221
+ puts
222
+ puts name
223
+ puts "--------------------------------------------------"
224
+ puts "version: #{gemspec[:version]}"
225
+ puts "lib required: #{gemspec[:require]}"
226
+ puts "used for: #{gemspec[:for]}"
227
+ end
228
+ end
229
+
230
+ if options[:install]
231
+ puts
232
+ puts "Installing \"#{options[:install]}\" version \"#{Backup::Dependency.all[options[:install]][:version]}\".."
233
+ puts "If this doesn't work, please issue the following command yourself:\n\n"
234
+ puts " gem install #{options[:install]} -v '#{Backup::Dependency.all[options[:install]][:version]}'\n\n"
235
+ puts "Please wait..\n\n"
236
+ puts %x[gem install #{options[:install]} -v '#{Backup::Dependency.all[options[:install]][:version]}']
237
+ end
238
+ end
239
+
202
240
  ##
203
241
  # [Version]
204
242
  # Returns the current version of the Backup gem
@@ -44,12 +44,13 @@ module Backup
44
44
 
45
45
  ##
46
46
  # Autoload Backup base files
47
- autoload :Model, File.join(LIBRARY_PATH, 'model')
48
- autoload :Archive, File.join(LIBRARY_PATH, 'archive')
49
- autoload :CLI, File.join(LIBRARY_PATH, 'cli')
50
- autoload :Finder, File.join(LIBRARY_PATH, 'finder')
51
- autoload :Logger, File.join(LIBRARY_PATH, 'logger')
52
- autoload :Version, File.join(LIBRARY_PATH, 'version')
47
+ autoload :Model, File.join(LIBRARY_PATH, 'model')
48
+ autoload :Archive, File.join(LIBRARY_PATH, 'archive')
49
+ autoload :CLI, File.join(LIBRARY_PATH, 'cli')
50
+ autoload :Finder, File.join(LIBRARY_PATH, 'finder')
51
+ autoload :Dependency, File.join(LIBRARY_PATH, 'dependency')
52
+ autoload :Logger, File.join(LIBRARY_PATH, 'logger')
53
+ autoload :Version, File.join(LIBRARY_PATH, 'version')
53
54
 
54
55
  ##
55
56
  # Autoload Backup configuration files
@@ -0,0 +1,84 @@
1
+ # encoding: utf-8
2
+
3
+ module Backup
4
+
5
+ ##
6
+ # A little self-contained gem manager for Backup.
7
+ # Rather than specifying hard dependencies in the gemspec, forcing users
8
+ # to install gems they do not want/need, Backup will notify them when a gem
9
+ # has not been installed, or when the gem's version is incorrect, and provide the
10
+ # command to install the gem. These dependencies are dynamically loaded in the Gemfile
11
+ class Dependency
12
+ extend Backup::CLI
13
+
14
+ ##
15
+ # Returns a hash of dependencies that Backup requires
16
+ # in order to run every available feature
17
+ def self.all
18
+ {
19
+ 'fog' => {
20
+ :require => 'fog',
21
+ :version => '~> 0.6.0',
22
+ :for => 'Amazon S3, Rackspace Cloud Files (S3, CloudFiles Storages)'
23
+ },
24
+
25
+ 'dropbox' => {
26
+ :require => 'dropbox',
27
+ :version => '~> 1.2.3',
28
+ :for => 'Dropbox Web Service (Dropbox Storage)'
29
+ },
30
+
31
+ 'net-sftp' => {
32
+ :require => 'net/sftp',
33
+ :version => '~> 2.0.5',
34
+ :for => 'SFTP Protocol (SFTP Storage)'
35
+ },
36
+
37
+ 'net-scp' => {
38
+ :require => 'net/scp',
39
+ :version => '~> 1.0.4',
40
+ :for => 'SCP Protocol (SCP Storage)'
41
+ },
42
+
43
+ 'net-ssh' => {
44
+ :require => 'net/ssh',
45
+ :version => '~> 2.1.3',
46
+ :for => 'SSH Protocol (SSH Storage)'
47
+ },
48
+
49
+ 'mail' => {
50
+ :require => 'mail',
51
+ :version => '~> 2.2.15',
52
+ :for => 'Sending Emails (Mail Notifier)'
53
+ },
54
+
55
+ 'twitter' => {
56
+ :require => 'twitter',
57
+ :version => '~> 1.1.2',
58
+ :for => 'Send Twitter Updates (Twitter Notifier)'
59
+ }
60
+ }
61
+ end
62
+
63
+ ##
64
+ # Attempts to load the specified gem (by name and version).
65
+ # If the gem with the correct version cannot be found, it'll display a message
66
+ # to the user with instructions on how to install the required gem
67
+ def self.load(name)
68
+ begin
69
+ gem(name, all[name][:version])
70
+ require(all[name][:require])
71
+ rescue LoadError
72
+ Backup::Logger.error("Dependency missing. Please install #{name} version #{all[name][:version]} and try again.")
73
+ puts "\n\s\sgem install #{name} -v '#{all[name][:version]}'\n\n"
74
+ puts "Dependency required for:"
75
+ puts "\n\s\s#{all[name][:for]}"
76
+ puts "\nTrying to install the #{name} gem for you.. please wait."
77
+ puts "Once installed, retry the backup procedure.\n\n"
78
+ puts run("#{ utility(:gem) } install #{name} -v '#{all[name][:version]}'")
79
+ exit
80
+ end
81
+ end
82
+
83
+ end
84
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  ##
4
4
  # Only load the Mail gem and Erb library when using Mail notifications
5
- require 'mail'
5
+ Backup::Dependency.load('mail')
6
6
  require 'erb'
7
7
 
8
8
  module Backup
@@ -2,7 +2,7 @@
2
2
 
3
3
  ##
4
4
  # Only load the Twitter gem when using Twitter notifications
5
- require 'twitter'
5
+ Backup::Dependency.load('twitter')
6
6
 
7
7
  module Backup
8
8
  module Notifier
@@ -2,7 +2,7 @@
2
2
 
3
3
  ##
4
4
  # Only load the Fog gem when the Backup::Storage::CloudFiles class is loaded
5
- require 'fog'
5
+ Backup::Dependency.load('fog')
6
6
 
7
7
  module Backup
8
8
  module Storage
@@ -2,7 +2,7 @@
2
2
 
3
3
  ##
4
4
  # Only load the Dropbox gem when the Backup::Storage::Dropbox class is loaded
5
- require 'dropbox'
5
+ Backup::Dependency.load('dropbox')
6
6
 
7
7
  module Backup
8
8
  module Storage
@@ -2,7 +2,7 @@
2
2
 
3
3
  ##
4
4
  # Only load the Net::SSH library when the Backup::Storage::RSync class is loaded
5
- require 'net/ssh'
5
+ Backup::Dependency.load('net-ssh')
6
6
 
7
7
  module Backup
8
8
  module Storage
@@ -2,7 +2,7 @@
2
2
 
3
3
  ##
4
4
  # Only load the Fog gem when the Backup::Storage::S3 class is loaded
5
- require 'fog'
5
+ Backup::Dependency.load('fog')
6
6
 
7
7
  module Backup
8
8
  module Storage
@@ -3,8 +3,9 @@
3
3
  ##
4
4
  # Only load the Net::SSH and Net::SCP library/gems
5
5
  # when the Backup::Storage::SCP class is loaded
6
- require 'net/ssh'
7
- require 'net/scp'
6
+ Backup::Dependency.load('net-ssh')
7
+ Backup::Dependency.load('net-scp')
8
+
8
9
 
9
10
  module Backup
10
11
  module Storage
@@ -2,7 +2,7 @@
2
2
 
3
3
  ##
4
4
  # Only load the Net::SFTP library/gem when the Backup::Storage::SFTP class is loaded
5
- require 'net/sftp'
5
+ Backup::Dependency.load('net-sftp')
6
6
 
7
7
  module Backup
8
8
  module Storage
@@ -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, 7
16
+ MAJOR, MINOR, PATCH = 3, 0, 8
17
17
 
18
18
  ##
19
19
  # Returns the major version ( big release based off of multiple minor releases )
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 7
10
- version: 3.0.7
9
+ - 8
10
+ version: 3.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael van Rooijen
@@ -34,102 +34,6 @@ dependencies:
34
34
  version: 0.14.6
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: fog
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 13
46
- segments:
47
- - 0
48
- - 5
49
- - 3
50
- version: 0.5.3
51
- type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: dropbox
55
- prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 25
62
- segments:
63
- - 1
64
- - 2
65
- - 3
66
- version: 1.2.3
67
- type: :runtime
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: mail
71
- prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 25
78
- segments:
79
- - 2
80
- - 2
81
- - 15
82
- version: 2.2.15
83
- type: :runtime
84
- version_requirements: *id004
85
- - !ruby/object:Gem::Dependency
86
- name: net-sftp
87
- prerelease: false
88
- requirement: &id005 !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- hash: 5
94
- segments:
95
- - 2
96
- - 0
97
- - 5
98
- version: 2.0.5
99
- type: :runtime
100
- version_requirements: *id005
101
- - !ruby/object:Gem::Dependency
102
- name: net-scp
103
- prerelease: false
104
- requirement: &id006 !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ~>
108
- - !ruby/object:Gem::Version
109
- hash: 31
110
- segments:
111
- - 1
112
- - 0
113
- - 4
114
- version: 1.0.4
115
- type: :runtime
116
- version_requirements: *id006
117
- - !ruby/object:Gem::Dependency
118
- name: twitter
119
- prerelease: false
120
- requirement: &id007 !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ~>
124
- - !ruby/object:Gem::Version
125
- hash: 23
126
- segments:
127
- - 1
128
- - 1
129
- - 2
130
- version: 1.1.2
131
- type: :runtime
132
- version_requirements: *id007
133
37
  description:
134
38
  email: meskyanichi@gmail.com
135
39
  executables:
@@ -183,6 +87,7 @@ files:
183
87
  - lib/backup/database/mysql.rb
184
88
  - lib/backup/database/postgresql.rb
185
89
  - lib/backup/database/redis.rb
90
+ - lib/backup/dependency.rb
186
91
  - lib/backup/encryptor/base.rb
187
92
  - lib/backup/encryptor/gpg.rb
188
93
  - lib/backup/encryptor/open_ssl.rb