scalingo_backups_manager 0.6.2 → 0.6.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bec014dcdbd0fe4aa8a6e646b131b43f7af832aa3a13d22f24900d9dcfeff857
4
- data.tar.gz: 1758ce4b459fe4448ddeaeda52302e94b48083685148d398061bc4be96211574
3
+ metadata.gz: 7be1ca03d45192dc394492ef8fb5c0a8b852ca08b4f96bbc4469960fda01e2f6
4
+ data.tar.gz: 721b03b36837bff777bbc9e79fdc85e188fa03524fac0405c92844209ba2fa59
5
5
  SHA512:
6
- metadata.gz: 7b7a1f1f853aa11ea8135effcc15df970aedf269145cccb471a430705f1130e71919116f93ed1f9b2c2062a141191f214d9c99bfe5bc5f3a806abf591453b3a0
7
- data.tar.gz: d313ddc959d7757050d9276e79a516395e119dc32de69278736d350a31a0ac1581a1c41b1b490ba1b842801710ba93e4985dd469312a7a0e5c88448b2494fe98
6
+ metadata.gz: 4015ae6b481e82b6a565caa4db86738df7a819875241e405cc2ca742874ef8d09d3f68e50d13459a7cb341c07b4813aed998978a950afbafb6b97f6a4c115732
7
+ data.tar.gz: 405ef4f1c59acd60099b9a5bd71246e906d181d86399ba998b4290f5dce976210ffe02b420aebb4f0a514975de13674aa007e54050efa60650e6e7a52a14c724
@@ -63,7 +63,7 @@ module ScalingoBackupsManager
63
63
  puts "*** Restoring backup to mysql database ***"
64
64
  puts "Command: #{restore_cmd}"
65
65
  system(restore_cmd)
66
- #FileUtils.rm_r destination_path unless opts[:skip_rm]
66
+ FileUtils.rm_r destination_path unless opts[:skip_rm]
67
67
  end
68
68
 
69
69
  end
@@ -34,21 +34,27 @@ module ScalingoBackupsManager
34
34
  user: rails_db_config["user"],
35
35
  }
36
36
 
37
- restore_cmd = "/usr/bin/env psql #{config[:database]} -h #{opts[:host] || config[:host]}"
37
+ restore_cmd = "/usr/bin/env pg_restore"
38
38
 
39
+ file_path = Dir["#{destination_path}*.pgsql"]
40
+ if file_path.empty?
41
+ puts "*** No SQL file found in tar ***"
42
+ return
43
+ end
44
+ restore_cmd << " #{file_path.first}"
45
+
46
+ if config[:host].present?
47
+ restore_cmd << " -h #{opts[:host] || config[:host] || 'localhost'}"
48
+ end
39
49
  if config[:user].present?
40
- restore_cmd << " --u #{config[:user]}"
41
- if config[:password].present?
42
- restore_cmd << " --password"
43
- restore_cmd << " #{config[:password]}"
44
- end
50
+ restore_cmd << " -U #{config[:user]}"
45
51
  end
46
52
 
47
- if opts[:port].present? && config[:port].present?
53
+ if opts[:port].present? || config[:port].present?
48
54
  restore_cmd << " -p #{opts[:port] || config[:port] || 5432}"
49
55
  end
50
56
 
51
- restore_cmd << " < #{destination_path}"
57
+ restore_cmd << " -d #{config[:database]}"
52
58
 
53
59
  puts "*** Restoring backup to Postgres database ***"
54
60
  system(restore_cmd)
@@ -1,3 +1,3 @@
1
1
  module ScalingoBackupsManager
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scalingo_backups_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Clercin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-02 00:00:00.000000000 Z
11
+ date: 2021-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor