backup 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +7 -7
- data/VERSION +1 -1
- data/backup.gemspec +1 -1
- data/generators/backup/templates/migrations/create_backup_tables.rb +4 -11
- data/generators/backup/templates/tasks/backup.rake +2 -2
- data/lib/backup/record/s3.rb +13 -14
- data/lib/backup/record/scp.rb +13 -14
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -6,7 +6,7 @@ Backup is a Ruby Gem, written specifically for Ruby on Rails applications. This
|
|
6
6
|
MySQL database (soon PostgreSQL and possibly more) and Archives (any files or folders) to "Amazon S3" or "any remotely accessible server using SCP".
|
7
7
|
Backup handles: Compression, Archiving, Encryption and Backup Cleaning.
|
8
8
|
|
9
|
-
== Backup just updated to version 2.
|
9
|
+
== Backup just updated to version 2.1.0!
|
10
10
|
|
11
11
|
This was a major update (read below) and a lot of stuff has changed since version 1.x.x!
|
12
12
|
Notable changes:
|
@@ -19,18 +19,18 @@ Notable changes:
|
|
19
19
|
* Can now configure an unlimited amount of customizable backup settings and run them each "individually"!
|
20
20
|
* HIGHLY IMPROVED USABILITY!
|
21
21
|
|
22
|
-
==
|
22
|
+
== TO ANYONE RUNNING BACKUP VERSION 2.0.0! PLEASE READ!
|
23
23
|
|
24
|
-
I
|
24
|
+
I would like to ask you to install the latest version of Backup, as 2.0.0 has some issues.
|
25
|
+
A few things that were left unchanged in 2.0.0 have been changed in 2.1.0 and I have updated the Wiki page "Getting Started"
|
26
|
+
based on the 2.1.0 release to get everyone up and running!
|
25
27
|
|
26
|
-
==== If you
|
28
|
+
==== If you have Backup version 2.0.0 installed, please do the following:
|
27
29
|
|
28
30
|
sudo gem uninstall backup -v 2.0.0
|
29
31
|
sudo gem install backup
|
30
32
|
|
31
|
-
|
32
|
-
Do this and you're set! My apologies for the initial hassle! ;)
|
33
|
-
|
33
|
+
And have a quick read through the "Getting Started" Wiki page to see how simple the Backup setup is since 2.1.0!
|
34
34
|
|
35
35
|
=== Refer to the Getting Started page to get up and running incredibly fast with "Backup 2"!
|
36
36
|
http://wiki.github.com/meskyanichi/backup/getting-started
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.1
|
data/backup.gemspec
CHANGED
@@ -1,24 +1,17 @@
|
|
1
1
|
class CreateBackupTables < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
create_table :
|
4
|
-
t.string :
|
5
|
-
t.string :adapter
|
6
|
-
t.string :filename
|
7
|
-
t.string :bucket
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
|
11
|
-
create_table :backup_scp do |t|
|
3
|
+
create_table :backup do |t|
|
4
|
+
t.string :storage
|
12
5
|
t.string :trigger
|
13
6
|
t.string :adapter
|
14
7
|
t.string :filename
|
15
8
|
t.string :path
|
9
|
+
t.string :bucket
|
16
10
|
t.timestamps
|
17
11
|
end
|
18
12
|
end
|
19
13
|
|
20
14
|
def self.down
|
21
|
-
drop_table :
|
22
|
-
drop_table :backup_scp
|
15
|
+
drop_table :backup
|
23
16
|
end
|
24
17
|
end
|
@@ -9,8 +9,8 @@ namespace :backup do
|
|
9
9
|
task :truncate => :environment do
|
10
10
|
backup = Backup::Setup.new(ENV['trigger'], @backup_procedures)
|
11
11
|
case backup.procedure.storage_name.to_sym
|
12
|
-
when :s3 then Backup::Record::S3.destroy_all(:trigger => ENV['trigger'])
|
13
|
-
when :scp then Backup::Record::SCP.destroy_all(:trigger => ENV['trigger'])
|
12
|
+
when :s3 then Backup::Record::S3.destroy_all(:trigger => ENV['trigger'], :storage => 's3')
|
13
|
+
when :scp then Backup::Record::SCP.destroy_all(:trigger => ENV['trigger'], :storage => 'scp')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
data/lib/backup/record/s3.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
module Backup
|
2
2
|
module Record
|
3
3
|
class S3 < ActiveRecord::Base
|
4
|
-
|
5
|
-
# Establishes a connection with the SQLite3
|
6
|
-
# local database to avoid conflict with users
|
7
|
-
# Production database.
|
8
|
-
# establish_connection(
|
9
|
-
# :adapter => "sqlite3",
|
10
|
-
# :database => "db/backup.sqlite3",
|
11
|
-
# :pool => 5,
|
12
|
-
# :timeout => 5000 )
|
13
|
-
|
14
|
-
set_table_name 'backup_s3'
|
15
4
|
|
16
|
-
|
17
|
-
|
5
|
+
if connection.table_exists?('backup')
|
6
|
+
set_table_name 'backup'
|
7
|
+
default_scope \
|
8
|
+
:order => 'created_at desc',
|
9
|
+
:conditions => {:storage => 's3'}
|
10
|
+
else
|
11
|
+
set_table_name 'backup_s3'
|
12
|
+
attr_accessor :storage
|
13
|
+
default_scope \
|
14
|
+
:order => 'created_at desc'
|
15
|
+
end
|
18
16
|
|
19
17
|
# Callbacks
|
20
18
|
after_save :clean_backups
|
@@ -26,8 +24,9 @@ module Backup
|
|
26
24
|
# Sets the S3 values
|
27
25
|
def load_adapter(adapter)
|
28
26
|
self.adapter_config = adapter
|
27
|
+
self.storage = 's3'
|
29
28
|
self.trigger = adapter.procedure.trigger
|
30
|
-
self.adapter = adapter.procedure.adapter_name
|
29
|
+
self.adapter = adapter.procedure.adapter_name.to_s
|
31
30
|
self.filename = adapter.final_file
|
32
31
|
self.bucket = adapter.procedure.get_storage_configuration.attributes['bucket']
|
33
32
|
self.keep_backups = adapter.procedure.attributes['keep_backups']
|
data/lib/backup/record/scp.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
module Backup
|
2
2
|
module Record
|
3
3
|
class SCP < ActiveRecord::Base
|
4
|
-
|
5
|
-
# Establishes a connection with the SQLite3
|
6
|
-
# local database to avoid conflict with users
|
7
|
-
# Production database.
|
8
|
-
# establish_connection(
|
9
|
-
# :adapter => "sqlite3",
|
10
|
-
# :database => "db/backup.sqlite3",
|
11
|
-
# :pool => 5,
|
12
|
-
# :timeout => 5000 )
|
13
|
-
|
14
|
-
set_table_name 'backup_scp'
|
15
4
|
|
16
|
-
|
17
|
-
|
5
|
+
if connection.table_exists?('backup')
|
6
|
+
set_table_name 'backup'
|
7
|
+
default_scope \
|
8
|
+
:order => 'created_at desc',
|
9
|
+
:conditions => {:storage => 'scp'}
|
10
|
+
else
|
11
|
+
set_table_name 'backup_scp'
|
12
|
+
attr_accessor :storage
|
13
|
+
default_scope \
|
14
|
+
:order => 'created_at desc'
|
15
|
+
end
|
18
16
|
|
19
17
|
# Callbacks
|
20
18
|
after_save :clean_backups
|
@@ -26,8 +24,9 @@ module Backup
|
|
26
24
|
# Sets the SCP values
|
27
25
|
def load_adapter(adapter)
|
28
26
|
self.adapter_config = adapter
|
27
|
+
self.storage = 'scp'
|
29
28
|
self.trigger = adapter.procedure.trigger
|
30
|
-
self.adapter = adapter.procedure.adapter_name
|
29
|
+
self.adapter = adapter.procedure.adapter_name.to_s
|
31
30
|
self.filename = adapter.final_file
|
32
31
|
self.keep_backups = adapter.procedure.attributes['keep_backups']
|
33
32
|
|