scalingo_backups_manager 0.6.1 → 0.6.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: 9ad746fbff41863b29fd1397102a5f002db68ba2e162e56a4b680dd32bb03b0d
4
- data.tar.gz: 0d2a17507863261fa862657a32b0263a78f48be9b5e71c2bc9cd6bbaac476a92
3
+ metadata.gz: 8d1183b7232fbf6ee4b1706d3491c96b893815ec0af2d4752c8ad37681754ca2
4
+ data.tar.gz: e93a2443de456f28c6f4389f487e14d7140fd52bc53b3ea99d161cd8c25fe0fb
5
5
  SHA512:
6
- metadata.gz: 6d7eb018cb31fc1b3ac6a24d8f6ff13d216045864157949489554dbe63b432169a36209a3febaa2c5c617f96d4900cad5b3caff62a889912156396cb6ad66495
7
- data.tar.gz: 41187c900181fb75e102f4883057a6fc80ff3741af463c08dcaed9d631495dccecc690e2c7dcb2be895b4bf715371fd71a8726e3f8599b55f8dc464f9a254488
6
+ metadata.gz: 4a0c53e2c044c77c3e5343aa9f9a3cb427e2300d3fa9619c060e8c3d2e080e313d66664b09896cf5159a225bd53e6bdf7462fa0b5093d4a55a882b10d2d687f8
7
+ data.tar.gz: 8939a178fce0cc48fbd15822b9189a0bd11a77de27735a87588124e73669eb68bb32b5454fa5f50f2b6c50dae0d0af9d41aff8691a590c7203129437df15c397
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scalingo_backups_manager (0.6.0)
4
+ scalingo_backups_manager (0.6.4)
5
5
  httparty (~> 0.18)
6
6
  net-sftp (~> 3.0.0)
7
7
  scalingo (~> 3.0)
@@ -10,16 +10,27 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.3.2)
13
+ activesupport (6.1.4)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
17
17
  tzinfo (~> 2.0)
18
18
  zeitwerk (~> 2.3)
19
- concurrent-ruby (1.1.8)
19
+ concurrent-ruby (1.1.9)
20
20
  diff-lcs (1.4.4)
21
- faraday (1.0.1)
21
+ faraday (1.4.3)
22
+ faraday-em_http (~> 1.0)
23
+ faraday-em_synchrony (~> 1.0)
24
+ faraday-excon (~> 1.1)
25
+ faraday-net_http (~> 1.0)
26
+ faraday-net_http_persistent (~> 1.1)
22
27
  multipart-post (>= 1.2, < 3)
28
+ ruby2_keywords (>= 0.0.4)
29
+ faraday-em_http (1.0.0)
30
+ faraday-em_synchrony (1.0.0)
31
+ faraday-excon (1.1.0)
32
+ faraday-net_http (1.0.1)
33
+ faraday-net_http_persistent (1.1.0)
23
34
  faraday_middleware (1.0.0)
24
35
  faraday (~> 1.0)
25
36
  httparty (0.18.1)
@@ -51,10 +62,11 @@ GEM
51
62
  diff-lcs (>= 1.2.0, < 2.0)
52
63
  rspec-support (~> 3.10.0)
53
64
  rspec-support (3.10.2)
54
- scalingo (3.0.0)
65
+ ruby2_keywords (0.0.4)
66
+ scalingo (3.0.1)
55
67
  activesupport (>= 5, < 7)
56
- faraday (~> 1.0.1)
57
- faraday_middleware (~> 1.0.0)
68
+ faraday (~> 1.0)
69
+ faraday_middleware (~> 1.0)
58
70
  multi_json (~> 1.0, >= 1.0.3)
59
71
  thor (1.1.0)
60
72
  tzinfo (2.0.4)
@@ -89,7 +89,7 @@ module ScalingoBackupsManager
89
89
  if File.exist?(path)
90
90
  puts "Backup already download, skipping..."
91
91
  else
92
- system "curl #{download_link} -o #{path} --create-dirs"
92
+ system "curl #{download_link} -o #{path} --create-dirs -k"
93
93
  end
94
94
  else
95
95
  puts "No download link found for #{addon.addon_provider[:id]}, Skipping..."
@@ -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
@@ -33,22 +33,32 @@ module ScalingoBackupsManager
33
33
  password: rails_db_config["password"],
34
34
  user: rails_db_config["user"],
35
35
  }
36
+ restore_cmd = ""
37
+ if config[:password].present?
38
+ restore_cmd = "PGPASSWORD=#{config[:password]} "
39
+ end
40
+ restore_cmd << "/usr/bin/env"
41
+ restore_cmd << " pg_restore"
36
42
 
37
- restore_cmd = "/usr/bin/env psql #{config[:database]} -h #{opts[:host] || config[:host]}"
43
+ file_path = Dir["#{destination_path}*.pgsql"]
44
+ if file_path.empty?
45
+ puts "*** No SQL file found in tar ***"
46
+ return
47
+ end
48
+ restore_cmd << " #{file_path.first}"
38
49
 
50
+ if config[:host].present?
51
+ restore_cmd << " -h #{opts[:host] || config[:host] || 'localhost'}"
52
+ end
39
53
  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
54
+ restore_cmd << " -U #{config[:user]}"
45
55
  end
46
56
 
47
- if config[:port].present?
57
+ if opts[:port].present? || config[:port].present?
48
58
  restore_cmd << " -p #{opts[:port] || config[:port] || 5432}"
49
59
  end
50
60
 
51
- restore_cmd << " < #{destination_path}"
61
+ restore_cmd << " -d #{config[:database]} --no-owner"
52
62
 
53
63
  puts "*** Restoring backup to Postgres database ***"
54
64
  system(restore_cmd)
@@ -1,3 +1,3 @@
1
1
  module ScalingoBackupsManager
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.5"
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.1
4
+ version: 0.6.5
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: 2022-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.0.3
124
+ rubygems_version: 3.1.6
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Gem allowing to download backups from scalingo