backup-agent 1.0.2 → 1.0.3

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: 19c9ab6c8edabbfb6a565b27ef6d0faecce64689
4
- data.tar.gz: 56903740cb34ea34005db808a93211cddb20cc3e
3
+ metadata.gz: d42e667623d611480fdc1638183fdf82830b443d
4
+ data.tar.gz: 1d459ac8a430ecb419720fc204e6330d23d3b614
5
5
  SHA512:
6
- metadata.gz: db8433207a98dfd78cfbe4df3c5890cebad6c331d7582c4069771b26bb8e0fbbf19d1e4be0f941874c6d0943e2d74f1faf0d40d2cb79c4a23af1472bf457645b
7
- data.tar.gz: bbbf61f7767626cc3fd51ddda09957d007eefaf3d9fe5f3262a76b2fa1b081648778fdbabdac55c41449979024df847d189bc3bf87fa83761d06964228a2a850
6
+ metadata.gz: 70ff610698ab230b39e1deb3e0e3816f76991a87f3a8a3ccedf344ef7f17f73e81a412ba6a0ddc54b88e0175e062126577fac4a688bdbf83fa215f6b9081ef4f
7
+ data.tar.gz: 376d0edce3a0d55e36e3db9e2929bdf01a1b4e3024445ce50e4a4f76773a7119865ff2a8739aa7e86c86c660ce3788a101d3b3535f0bad1c435c557f8b411288
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'backup-agent'
5
- s.version = '1.0.2'
5
+ s.version = '1.0.3'
6
6
  s.authors = ['Yaroslav Konoplov']
7
7
  s.email = ['yaroslav@inbox.com']
8
8
  s.summary = 'Easy AWS S3 backup'
@@ -23,8 +23,9 @@ module Backup
23
23
 
24
24
  def backup_directories
25
25
  config.get(:directories).each do |name, dir|
26
- dir_filename = "dir-#{name}.tar.gz"
27
- cmd = "cd #{dir} && /usr/bin/env tar -czf #{tmp_path}/#{dir_filename} ."
26
+ dir_filename = "#{name}.tar.gz"
27
+ dir_fileparam = Shellwords.escape(dir_filename)
28
+ cmd = "cd #{dir} && /usr/bin/env tar -czf #{tmp_path}/#{dir_fileparam} ."
28
29
  puts "Exec #{cmd}"
29
30
  system(cmd)
30
31
  storage.upload("#{@timestamp}/#{dir_filename}", "#{tmp_path}/#{dir_filename}")
@@ -34,13 +35,14 @@ module Backup
34
35
  def backup_files
35
36
  config.get(:files).each do |name, files|
36
37
  begin
37
- files_tmp_path = File.join(tmp_path, "#{name}-tmp")
38
- file_bunch_name = "files-#{name}.tar.gz"
38
+ files_tmp_path = File.join(tmp_path, "#{name}-tmp")
39
+ file_bunch_name = "#{name}.tar.gz"
40
+ file_bunch_param = Shellwords.escape(file_bunch_name)
39
41
 
40
42
  FileUtils.mkdir_p(files_tmp_path)
41
43
  FileUtils.cp(files.select { |el| File.exists?(el) }, files_tmp_path)
42
44
 
43
- cmd = "cd #{files_tmp_path} && /usr/bin/env tar -czf #{tmp_path}/#{file_bunch_name} ."
45
+ cmd = "cd #{files_tmp_path} && /usr/bin/env tar -czf #{tmp_path}/#{file_bunch_param} ."
44
46
  system(cmd)
45
47
 
46
48
  storage.upload("#{@timestamp}/#{file_bunch_name}", "#{tmp_path}/#{file_bunch_name}")
@@ -52,9 +54,10 @@ module Backup
52
54
 
53
55
  def backup_mysql
54
56
  config.get(:mysql_databases).each do |db|
55
- db_filename = "mysql-#{db}.gz"
57
+ db_filename = "MySQL Database #{db}.gz"
58
+ db_fileparam = Shellwords.escape(db_filename)
56
59
  dump = with_env "mysqldump #{config.get(:mysql_connect)} #{config.get(:mysqldump_options).join(' ')} #{db}"
57
- gzip = with_env "gzip -5 -c > #{tmp_path}/#{db_filename}"
60
+ gzip = with_env "gzip -5 -c > #{tmp_path}/#{db_fileparam}"
58
61
 
59
62
  puts "Exec #{dump} | #{gzip}"
60
63
  system "#{dump} | #{gzip}"
@@ -68,10 +71,11 @@ module Backup
68
71
  FileUtils.mkdir_p(mongo_dump_dir)
69
72
 
70
73
  config.get(:mongo_databases).each do |db|
71
- db_filename = "mongo-#{db}.tar.gz"
74
+ db_filename = "Mongo Database #{db}.tar.gz"
75
+ db_fileparam = Shellwords.escape(db_filename)
72
76
  dump = with_env "mongodump #{config.get(:mongo_connect)} -d #{db} -o #{mongo_dump_dir}"
73
77
  cd = "cd #{mongo_dump_dir}/#{db}"
74
- tar = with_env "tar -czf #{tmp_path}/#{db_filename} ."
78
+ tar = with_env "tar -czf #{tmp_path}/#{db_fileparam} ."
75
79
 
76
80
  puts "Exec #{dump} && #{cd} && #{tar}"
77
81
  system "#{dump} && #{cd} && #{tar}"
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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Konoplov