backup-pants 0.1 → 0.2
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/lib/backup-pants/backup.rb +11 -0
- metadata +4 -4
data/lib/backup-pants/backup.rb
CHANGED
@@ -26,6 +26,7 @@ module BackupPants
|
|
26
26
|
|
27
27
|
dir_prefix = self.date_folder_name + '/dirs/'
|
28
28
|
push_to_s3(tar_destination, dir_prefix)
|
29
|
+
self.cleanup(tar_destination)
|
29
30
|
end
|
30
31
|
|
31
32
|
def backup_db(db)
|
@@ -34,6 +35,7 @@ module BackupPants
|
|
34
35
|
mysqldump = "mysqldump --opt --skip-add-locks"
|
35
36
|
mysqldump += " -u #{self.db_username}" unless self.db_username.nil?
|
36
37
|
mysqldump += " -p'#{self.db_password}'" unless self.db_password.nil?
|
38
|
+
mysqldump += " -h'#{self.db_host}'" unless self.db_host.nil?
|
37
39
|
mysqldump += " #{db}"
|
38
40
|
mysqldump += " | gzip > #{gzip_destination}"
|
39
41
|
run = system mysqldump
|
@@ -44,6 +46,11 @@ module BackupPants
|
|
44
46
|
|
45
47
|
dir_prefix = self.date_folder_name + '/dbs/'
|
46
48
|
push_to_s3(gzip_destination, dir_prefix)
|
49
|
+
self.cleanup(gzip_destination)
|
50
|
+
end
|
51
|
+
|
52
|
+
def cleanup(path)
|
53
|
+
FileUtils.rm(path)
|
47
54
|
end
|
48
55
|
|
49
56
|
def push_to_s3(file_path, dir_prefix='')
|
@@ -78,6 +85,10 @@ module BackupPants
|
|
78
85
|
self.conf['db_password'] ? self.conf['db_password'] : nil
|
79
86
|
end
|
80
87
|
|
88
|
+
def db_host
|
89
|
+
self.conf['db_host'] ? self.conf['db_host'] : nil
|
90
|
+
end
|
91
|
+
|
81
92
|
def dirs
|
82
93
|
@dirs ||= self.conf['dirs'] ? self.conf['dirs'] : []
|
83
94
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backup-pants
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 2
|
9
|
+
version: "0.2"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ivan Kanevski
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-21 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|