backup 2.3.2 → 2.3.3
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/VERSION +1 -1
- data/lib/backup/adapters/base.rb +1 -1
- data/lib/backup/adapters/mysql.rb +34 -1
- data/lib/backup/configuration/global_settings.rb +8 -0
- data/lib/backup/configuration/helpers.rb +6 -1
- data/lib/backup/esboco.txt +43 -0
- metadata +38 -36
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.3
|
data/lib/backup/adapters/base.rb
CHANGED
@@ -100,7 +100,7 @@ module Backup
|
|
100
100
|
self.encrypted_file = "#{self.final_file}.enc"
|
101
101
|
run "openssl enc -des-cbc -in #{File.join(tmp_path, compressed_file)} -out #{File.join(tmp_path, encrypted_file)} -k #{encrypt_with_password}"
|
102
102
|
end
|
103
|
-
self.final_file = encrypted_file
|
103
|
+
self.final_file = encrypted_file if encrypted_file
|
104
104
|
end
|
105
105
|
|
106
106
|
# Initializes the storing process
|
@@ -3,7 +3,40 @@ module Backup
|
|
3
3
|
class MySQL < Backup::Adapters::Base
|
4
4
|
|
5
5
|
attr_accessor :user, :password, :database, :skip_tables, :host, :port, :socket, :additional_options, :tables
|
6
|
-
|
6
|
+
|
7
|
+
# the adapter declares his own configuration
|
8
|
+
adapter_configuration do
|
9
|
+
# :required => true # by default, optional
|
10
|
+
string :user, :password, :database, :additional_options
|
11
|
+
# array allows to call the same configuration multiple times:
|
12
|
+
# skip_tables 't1', 't2'
|
13
|
+
# skip_tables 't3'
|
14
|
+
# the result will always combined
|
15
|
+
array :skip_tables
|
16
|
+
configuration_group :options do
|
17
|
+
string :host, :port, :socket
|
18
|
+
end
|
19
|
+
# settings to be applied globally
|
20
|
+
global do
|
21
|
+
string :mysqldump_full_path
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# adapter :mysql do
|
26
|
+
# user 'user'
|
27
|
+
# password 'password'
|
28
|
+
# database 'database'
|
29
|
+
#
|
30
|
+
# # skip_tables ['table1', 'table2', 'table3']
|
31
|
+
# #
|
32
|
+
# # options do
|
33
|
+
# # host '123.45.678.90'
|
34
|
+
# # port '80'
|
35
|
+
# # socket '/tmp/socket.sock'
|
36
|
+
# # end
|
37
|
+
# # additional_options '--single-transaction --quick'
|
38
|
+
# end
|
39
|
+
|
7
40
|
private
|
8
41
|
|
9
42
|
# Dumps and Compresses the MySQL file
|
@@ -2,6 +2,11 @@ module Backup
|
|
2
2
|
module Configuration
|
3
3
|
module Helpers
|
4
4
|
|
5
|
+
def global_settings(&block)
|
6
|
+
@global_settings = Backup::Configuration::GlobalSettings.new
|
7
|
+
@global_settings.instance_eval &block
|
8
|
+
end
|
9
|
+
|
5
10
|
# A helper method for the config/backup.rb configuration file
|
6
11
|
# Expects a trigger in argument one (STRING)
|
7
12
|
# Expects a block of settings
|
@@ -21,4 +26,4 @@ module Backup
|
|
21
26
|
|
22
27
|
end
|
23
28
|
end
|
24
|
-
end
|
29
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# TODO como usar pipes para melhorar performance?
|
2
|
+
|
3
|
+
BackupManager(params)
|
4
|
+
Adapter.new(params).perform_backup # stores in tmp_path/filename
|
5
|
+
Compressor.execute # stores in tmp_path/filename.gz or bz2
|
6
|
+
Encryptor.execute # stores in tmp_path/filename.enc
|
7
|
+
Splitter.execute # stores in tmp_path/filename.enc*
|
8
|
+
# TODO store the "results" of the backup
|
9
|
+
Storage.store # tmp_path/filename
|
10
|
+
Notifier.notify
|
11
|
+
|
12
|
+
|
13
|
+
RestoreManager
|
14
|
+
# TODO store the "results" of the backup
|
15
|
+
RETRIEVE em vez de get!
|
16
|
+
Storage.get # gets the file and stores in tmp_path/filename*
|
17
|
+
Splitter.undo # stores in tmp_path/filename.enc*
|
18
|
+
Encryptor.undo # stores in tmp_path/filename.enc
|
19
|
+
Compressor.undo # stores in tmp_path/filename.gz or bz2
|
20
|
+
Adapter.perform_restore # stores in tmp_path/filename
|
21
|
+
|
22
|
+
class Base
|
23
|
+
global_configuration do
|
24
|
+
string :bin_full_path
|
25
|
+
end
|
26
|
+
|
27
|
+
configuration do
|
28
|
+
string :username, :required => true
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
# handle your options
|
33
|
+
end
|
34
|
+
|
35
|
+
def perform_backup # or backup_command?? if we use a command, the manager can decide to add the filename or pipe to the next command
|
36
|
+
# do your backup here, and store it in tmp_path/filename
|
37
|
+
end
|
38
|
+
|
39
|
+
def perform_restore # or restore_command?? so we can pipe the commands
|
40
|
+
# do your restore here from tmp_path/filename
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
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:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 3
|
10
|
+
version: 2.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael van Rooijen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-20 00:00:00 -03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -179,50 +179,52 @@ files:
|
|
179
179
|
- CHANGELOG
|
180
180
|
- LICENSE
|
181
181
|
- VERSION
|
182
|
-
- lib/backup/
|
183
|
-
- lib/backup/
|
184
|
-
- lib/backup/
|
185
|
-
- lib/backup/
|
186
|
-
- lib/backup/adapters/postgresql.rb
|
187
|
-
- lib/backup/adapters/sqlite.rb
|
182
|
+
- lib/backup/esboco.txt
|
183
|
+
- lib/backup/environment/base.rb
|
184
|
+
- lib/backup/environment/unix.rb
|
185
|
+
- lib/backup/environment/rails.rb
|
188
186
|
- lib/backup/command_helper.rb
|
189
|
-
- lib/backup/configuration/adapter.rb
|
190
|
-
- lib/backup/configuration/adapter_options.rb
|
191
|
-
- lib/backup/configuration/attributes.rb
|
192
|
-
- lib/backup/configuration/base.rb
|
193
|
-
- lib/backup/configuration/helpers.rb
|
194
|
-
- lib/backup/configuration/mail.rb
|
195
|
-
- lib/backup/configuration/smtp.rb
|
196
|
-
- lib/backup/configuration/storage.rb
|
197
187
|
- lib/backup/connection/cloudfiles.rb
|
198
188
|
- lib/backup/connection/s3.rb
|
199
|
-
- lib/backup/
|
200
|
-
- lib/backup/
|
201
|
-
- lib/backup/
|
189
|
+
- lib/backup/adapters/custom.rb
|
190
|
+
- lib/backup/adapters/postgresql.rb
|
191
|
+
- lib/backup/adapters/mysql.rb
|
192
|
+
- lib/backup/adapters/sqlite.rb
|
193
|
+
- lib/backup/adapters/base.rb
|
194
|
+
- lib/backup/adapters/archive.rb
|
195
|
+
- lib/backup/storage/cloudfiles.rb
|
196
|
+
- lib/backup/storage/sftp.rb
|
197
|
+
- lib/backup/storage/s3.rb
|
198
|
+
- lib/backup/storage/local.rb
|
199
|
+
- lib/backup/storage/base.rb
|
200
|
+
- lib/backup/storage/scp.rb
|
201
|
+
- lib/backup/storage/ftp.rb
|
202
202
|
- lib/backup/mail/base.rb
|
203
203
|
- lib/backup/mail/mail.txt
|
204
|
-
- lib/backup/record/base.rb
|
205
204
|
- lib/backup/record/cloudfiles.rb
|
206
|
-
- lib/backup/record/
|
207
|
-
- lib/backup/record/local.rb
|
205
|
+
- lib/backup/record/sftp.rb
|
208
206
|
- lib/backup/record/s3.rb
|
207
|
+
- lib/backup/record/local.rb
|
208
|
+
- lib/backup/record/base.rb
|
209
209
|
- lib/backup/record/scp.rb
|
210
|
-
- lib/backup/record/
|
211
|
-
- lib/backup/
|
212
|
-
- lib/backup/
|
213
|
-
- lib/backup/
|
214
|
-
- lib/backup/
|
215
|
-
- lib/backup/
|
216
|
-
- lib/backup/storage
|
217
|
-
- lib/backup/
|
210
|
+
- lib/backup/record/ftp.rb
|
211
|
+
- lib/backup/configuration/attributes.rb
|
212
|
+
- lib/backup/configuration/mail.rb
|
213
|
+
- lib/backup/configuration/smtp.rb
|
214
|
+
- lib/backup/configuration/helpers.rb
|
215
|
+
- lib/backup/configuration/base.rb
|
216
|
+
- lib/backup/configuration/storage.rb
|
217
|
+
- lib/backup/configuration/adapter.rb
|
218
|
+
- lib/backup/configuration/global_settings.rb
|
219
|
+
- lib/backup/configuration/adapter_options.rb
|
218
220
|
- lib/backup.rb
|
219
221
|
- bin/backup
|
220
|
-
- generators/
|
221
|
-
- generators/
|
222
|
+
- generators/backup_update/templates/migrations/update_backup_tables.rb
|
223
|
+
- generators/backup_update/backup_update_generator.rb
|
222
224
|
- generators/backup/templates/migrations/create_backup_tables.rb
|
225
|
+
- generators/backup/templates/config/backup.rb
|
223
226
|
- generators/backup/templates/tasks/backup.rake
|
224
|
-
- generators/
|
225
|
-
- generators/backup_update/templates/migrations/update_backup_tables.rb
|
227
|
+
- generators/backup/backup_generator.rb
|
226
228
|
- setup/backup.rb
|
227
229
|
- setup/backup.sqlite3
|
228
230
|
has_rdoc: true
|