backup2s3 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +5 -3
- data/Rakefile +1 -1
- data/backup2s3.gemspec +1 -1
- data/lib/backup2s3.rb +2 -2
- data/lib/system.rb +13 -7
- metadata +3 -3
data/README
CHANGED
@@ -3,13 +3,15 @@ SETUP
|
|
3
3
|
1. Install the gem
|
4
4
|
gem install backup2s3
|
5
5
|
|
6
|
+
2. Add these dependencies to your application Gemfile
|
7
|
+
gem 'backup2s3'
|
8
|
+
gem 'aws-s3'
|
6
9
|
|
7
|
-
|
10
|
+
3. Run the generator in your application root directory
|
8
11
|
rails g backup2s3
|
9
12
|
|
10
13
|
|
11
|
-
|
12
|
-
|
14
|
+
4. Change your settings in config/backup2s3.yml
|
13
15
|
|
14
16
|
|
15
17
|
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('backup2s3', '0.3.
|
5
|
+
Echoe.new('backup2s3', '0.3.2') do |p|
|
6
6
|
p.description = "Backup2s3 is a gem that performs database and application backups and stores this data on Amazon S3."
|
7
7
|
p.summary = "Backup2s3 is a gem that creates, deletes and restores db and application backups."
|
8
8
|
p.url = "http://github.com/aricwalker/backup2s3"
|
data/backup2s3.gemspec
CHANGED
data/lib/backup2s3.rb
CHANGED
@@ -60,7 +60,7 @@ class Backup2s3
|
|
60
60
|
@database_file = System.clean("#{@time}-#{System.db_credentials['database']}-database") << ".sql"
|
61
61
|
print "\nDumping database..."
|
62
62
|
database_temp = System.db_dump
|
63
|
-
puts "
|
63
|
+
puts "\ndone\n- Database dump file size: " << database_temp.size.to_s << " B"; print "Backing up database dump file..."
|
64
64
|
@adapter.store(@database_file, open(database_temp.path))
|
65
65
|
puts "done"
|
66
66
|
end
|
@@ -69,7 +69,7 @@ class Backup2s3
|
|
69
69
|
@application_file = System.clean("#{@time}-#{System.db_credentials['database']}-application") << ".tar.gz"
|
70
70
|
print "\nZipping application folders..."
|
71
71
|
application_temp = System.tarzip_folders(@conf[:backups][:backup_application_folders])
|
72
|
-
puts "
|
72
|
+
puts "\ndone\n- Application tarball size: " << application_temp.size.to_s << " B"; print "Backing up application tarball..."
|
73
73
|
@adapter.store(@application_file, open(application_temp.path))
|
74
74
|
puts "done"
|
75
75
|
end
|
data/lib/system.rb
CHANGED
@@ -20,13 +20,19 @@ module System
|
|
20
20
|
|
21
21
|
# Creates app tar file
|
22
22
|
def self.tarzip_folders(folders)
|
23
|
-
application_tar = Tempfile.new("app")
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
application_tar = Tempfile.new("app")
|
24
|
+
ex_folders = ''
|
25
|
+
folders.each { |folder|
|
26
|
+
unless File.exist?(folder)
|
27
|
+
print "\nWARNING: Folder \'" + folder + "\' does not exist! Excluding from backup."
|
28
|
+
else
|
29
|
+
ex_folders << folder << ' '
|
30
|
+
end
|
31
|
+
}
|
32
|
+
if ex_folders.length > 0
|
33
|
+
cmd = "tar --dereference -czpf #{application_tar.path} #{ex_folders}"
|
34
|
+
run(cmd)
|
35
|
+
end
|
30
36
|
return application_tar
|
31
37
|
end
|
32
38
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backup2s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aric Walker
|