backy_rb 0.1.4 → 0.1.5

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
  SHA256:
3
- metadata.gz: 976aef5ff1edf205faaa2494ddbf2e7a52ee40437b85f2b4a7e9b5cc46cdfef1
4
- data.tar.gz: b8774cee38066ddcc000d916e204573a08c07cef91f1d5e809521e990e3a299e
3
+ metadata.gz: 22c60d417618b6d91862bf0de81b3dc88cdd61af8bc5854f498ffc6bad749727
4
+ data.tar.gz: cbf338342040184c61bcbeffbec63c6a9479e4f370beea2e217cac3b2a1e0c53
5
5
  SHA512:
6
- metadata.gz: d786dd5a26d31bc9a7d17c68bd1dff4f796ce50860c900e302cedb55442b4493a62f00ef5103cd0c019052fa16a06f90b2c9d05e97c597c74dc145210537c357
7
- data.tar.gz: df6656391c48a16172ef5dcaded48df92228f690c0a137c752fc879012542317ceb62a97f71cb721f0d21241ffb9838f2830815a2659525067cae1d6a31f899a
6
+ metadata.gz: 45ccce1e737f6e34b4e0f4f6b686974dc7341ae1c29e4a0bbe70582ef597502160edb6e5beee657d8df58e82b3f4900f85570a5fe67f37eb974c98641453202d
7
+ data.tar.gz: 8565246f494bb1302aa947a8ef8623aa4f5d7b2c225931a8342ec46eb24d27e904bcf5183a680baff0299c19ceaf863888260bce8f52caf7f7b73b74cc2cae70
@@ -15,11 +15,11 @@ module Backy
15
15
  use_multicore = ENV["BACKY_USE_PARALLEL"] == "true"
16
16
 
17
17
  if pigz_installed && multicore && use_multicore
18
- log_message('Using parallel restore with pigz')
18
+ Logger.log('Using parallel restore with pigz')
19
19
  parallel_restore
20
20
  else
21
- log_message("Pigz not installed or system is not multicore")
22
- log_message('Using plain text restore')
21
+ Logger.log("Pigz not installed or system is not multicore")
22
+ Logger.log('Using plain text restore')
23
23
  plain_text_restore
24
24
  end
25
25
  end
@@ -31,11 +31,11 @@ module Backy
31
31
  def plain_text_restore
32
32
  cmd = "(#{pg_password_env}psql -c \"#{terminate_connection_sql};\" #{pg_credentials} #{database}; #{pg_password_env}dropdb #{pg_credentials} #{database}; #{pg_password_env}createdb #{pg_credentials} #{database}; gunzip -c #{file_name} | #{pg_password_env}psql #{pg_credentials} -q -d #{database}) 2>&1 >> #{log_file}"
33
33
 
34
- log_message("Restoring #{database} from #{file_name} ...")
34
+ Logger.log("Restoring #{database} from #{file_name} ...")
35
35
  if system(cmd)
36
- log_message("Database restoration completed successfully.")
36
+ Logger.log("Database restoration completed successfully.")
37
37
  else
38
- log_message("Database restoration failed. See #{log_file} for details.")
38
+ Logger.log("Database restoration failed. See #{log_file} for details.")
39
39
  end
40
40
  end
41
41
 
@@ -50,40 +50,40 @@ module Backy
50
50
  # Terminate connections and drop/create database
51
51
  terminate_and_recreate_db = "(#{pg_password_env}psql -c \"#{terminate_connection_sql};\" #{pg_credentials} #{database}; #{pg_password_env}dropdb #{pg_credentials} #{database}; #{pg_password_env}createdb #{pg_credentials} #{database}) 2>&1 >> #{log_file}"
52
52
 
53
- log_message("Terminating connections to #{database}")
53
+ Logger.log("Terminating connections to #{database}")
54
54
  if system(terminate_and_recreate_db)
55
- log_message("Database connections terminated and database recreated.")
55
+ Logger.log("Database connections terminated and database recreated.")
56
56
  else
57
- log_message("Error during database termination and recreation. See #{log_file}")
57
+ Logger.log("Error during database termination and recreation. See #{log_file}")
58
58
  return
59
59
  end
60
60
 
61
61
  # Decompress and restore
62
- log_message("Decompressing #{file_name} into #{dump_dir} ...")
62
+ Logger.log("Decompressing #{file_name} into #{dump_dir} ...")
63
63
  if system(decompress_cmd)
64
- log_message("Decompression completed successfully.")
64
+ Logger.log("Decompression completed successfully.")
65
65
 
66
66
  # Check the expected file
67
67
  unless File.exist?("#{dump_dir}/toc.dat")
68
- log_message("toc.dat not found in #{dump_dir}.")
68
+ Logger.log("toc.dat not found in #{dump_dir}.")
69
69
  return
70
70
  end
71
71
  else
72
- log_message("Decompression failed. See #{log_file} for details.")
72
+ Logger.log("Decompression failed. See #{log_file} for details.")
73
73
  return
74
74
  end
75
75
 
76
- log_message("Restoring database from #{dump_dir} ...")
76
+ Logger.log("Restoring database from #{dump_dir} ...")
77
77
  if system(restore_cmd)
78
- log_message("Database restoration completed successfully.")
78
+ Logger.log("Database restoration completed successfully.")
79
79
  else
80
- log_message("Database restoration failed. See #{log_file} for details.")
80
+ Logger.log("Database restoration failed. See #{log_file} for details.")
81
81
  return
82
82
  end
83
83
 
84
- log_message("Cleanup: Removing #{dump_dir} ...")
84
+ Logger.log("Cleanup: Removing #{dump_dir} ...")
85
85
  FileUtils.rm_rf(dump_dir)
86
- log_message("Cleanup completed.")
86
+ Logger.log("Cleanup completed.")
87
87
  end
88
88
 
89
89
  def terminate_connection_sql
data/lib/backy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Backy
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backy_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Kharchenko