backup-agent 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db01b64b87205698b0d42f38377b53aba47b35b3
4
- data.tar.gz: 18fc289eb9246b74f27812e5f6ad39dcd112c70d
3
+ metadata.gz: 820a15a09fd0413a06a73500bee8889cf9dba6a5
4
+ data.tar.gz: ad4d69b45552d4a52a462eec64e507e64c15873b
5
5
  SHA512:
6
- metadata.gz: 3ea0401050f5160ad6a540188b91bcda069d37252a67500dbf1b7f22f14712170bdba6b8f697eb6299f1c3b454bd7289cab6d4e041001eb4ee5de896295d5f58
7
- data.tar.gz: 9c10accd9407eee892134aa58f9bbe9e9092f9159a2986702ade0479d7960db55a4f245a04f64b3be7ff789174150a074637189e09c09a505de97da3f442ff12
6
+ metadata.gz: b311d7a0c1bf67cf4f25de10eaa271d3238e75bb350775c611523876fcb2795d79c229668c953b4cd9857418ab6bdf0d7fe62294d83e4d1c549ee8da45ef04b1
7
+ data.tar.gz: dd45244140b0445f76337991825a3bacfe660885acf52f2a70c86d8ea2a685abb7b7283a3a0508b42b1fc9b02f2e3032a4b5d578cdf20b9091940af26d11df21
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'backup-agent'
5
- s.version = '1.0.7'
5
+ s.version = '1.0.8'
6
6
  s.authors = ['Yaroslav Konoplov']
7
7
  s.email = ['yaroslav@inbox.com']
8
8
  s.summary = 'Easy AWS S3 backup'
@@ -54,15 +54,13 @@ module Backup
54
54
 
55
55
  def backup_mysql
56
56
  config.get(:mysql_databases).each do |db|
57
- db_filename = "MySQL Database #{db}.xz"
58
- db_fileparam = Shellwords.escape(db_filename)
59
- dump = with_env "mysqldump #{config.get(:mysql_connect)} #{config.get(:mysqldump_options).join(' ')} --databases #{db}"
60
- xz = with_env "xz --compress --extreme -9 --keep --threads=0 --verbose --stdout"
57
+ dump_path = "#{tmp_path}/#{ shell_escape(db) }.sql"
58
+ dump_cmd = "mysqldump #{config.get(:mysql_connect)} #{config.get(:mysqldump_options).join(' ')} --databases #{db}"
61
59
 
62
- puts "Exec #{dump} | #{xz} > #{tmp_path}/#{db_fileparam} "
63
- system "#{dump} | #{xz} > #{tmp_path}/#{db_fileparam}"
60
+ exec with_env("#{dump_cmd} > #{dump_path}")
61
+ exec with_env("xz --compress --extreme -9 --keep --threads=0 --verbose #{dump_path}")
64
62
 
65
- storage.upload("#{@timestamp}/#{db_filename}", "#{tmp_path}/#{db_filename}")
63
+ storage.upload("#{@timestamp}/#{ shell_escape(db) }.sql.xz", "#{dump_path}.xz")
66
64
  end
67
65
  end
68
66
 
@@ -108,5 +106,14 @@ module Backup
108
106
  def with_env(cmd)
109
107
  "/usr/bin/env #{cmd}"
110
108
  end
109
+
110
+ def shell_escape(x)
111
+ Shellwords.escape(x)
112
+ end
113
+
114
+ def exec(cmd)
115
+ puts "Exec #{cmd}"
116
+ system cmd
117
+ end
111
118
  end
112
119
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Konoplov