scalingo_backups_manager 0.6.5 → 0.8.0

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: 8d1183b7232fbf6ee4b1706d3491c96b893815ec0af2d4752c8ad37681754ca2
4
- data.tar.gz: e93a2443de456f28c6f4389f487e14d7140fd52bc53b3ea99d161cd8c25fe0fb
3
+ metadata.gz: 22aae190ac267f91679c59c01c34a385d7d31b8859c05c106e280bd8c449bc32
4
+ data.tar.gz: 4db5340d871f30d632067a274178837561716c289fe57fa72b1cc7a7af6a38cc
5
5
  SHA512:
6
- metadata.gz: 4a0c53e2c044c77c3e5343aa9f9a3cb427e2300d3fa9619c060e8c3d2e080e313d66664b09896cf5159a225bd53e6bdf7462fa0b5093d4a55a882b10d2d687f8
7
- data.tar.gz: 8939a178fce0cc48fbd15822b9189a0bd11a77de27735a87588124e73669eb68bb32b5454fa5f50f2b6c50dae0d0af9d41aff8691a590c7203129437df15c397
6
+ metadata.gz: 50c9ee867cfbb4f09c14cc82a7675ebd43c561d87fdaea720cf4ad0455be6aec87dcb022103e82638bc722c2c09f07fe29386c621e05338e30cafd43074eb8a2
7
+ data.tar.gz: af4e44b07ad73739b00fdb2e77be8c7dd80e8a0fdff376e87cfaf73c3a1e2618e90761adc46c5d61477b78c1730f2c0c3fadf705b2ed8cb5822008230b559bf6
data/.DS_Store ADDED
Binary file
data/.gitignore CHANGED
@@ -11,4 +11,5 @@
11
11
  .rspec_status
12
12
  scalingo-backups-config.yml
13
13
  /backups/
14
- .idea
14
+ .idea
15
+ .rbenv-vars
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scalingo_backups_manager (0.6.4)
4
+ scalingo_backups_manager (0.7.0)
5
5
  httparty (~> 0.18)
6
6
  net-sftp (~> 3.0.0)
7
7
  scalingo (~> 3.0)
@@ -10,41 +10,50 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.4)
13
+ activesupport (7.0.3)
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
- zeitwerk (~> 2.3)
19
- concurrent-ruby (1.1.9)
18
+ concurrent-ruby (1.1.10)
20
19
  diff-lcs (1.4.4)
21
- faraday (1.4.3)
20
+ faraday (1.10.0)
22
21
  faraday-em_http (~> 1.0)
23
22
  faraday-em_synchrony (~> 1.0)
24
23
  faraday-excon (~> 1.1)
24
+ faraday-httpclient (~> 1.0)
25
+ faraday-multipart (~> 1.0)
25
26
  faraday-net_http (~> 1.0)
26
- faraday-net_http_persistent (~> 1.1)
27
- multipart-post (>= 1.2, < 3)
27
+ faraday-net_http_persistent (~> 1.0)
28
+ faraday-patron (~> 1.0)
29
+ faraday-rack (~> 1.0)
30
+ faraday-retry (~> 1.0)
28
31
  ruby2_keywords (>= 0.0.4)
29
32
  faraday-em_http (1.0.0)
30
33
  faraday-em_synchrony (1.0.0)
31
34
  faraday-excon (1.1.0)
35
+ faraday-httpclient (1.0.1)
36
+ faraday-multipart (1.0.3)
37
+ multipart-post (>= 1.2, < 3)
32
38
  faraday-net_http (1.0.1)
33
- faraday-net_http_persistent (1.1.0)
34
- faraday_middleware (1.0.0)
39
+ faraday-net_http_persistent (1.2.0)
40
+ faraday-patron (1.0.0)
41
+ faraday-rack (1.0.0)
42
+ faraday-retry (1.0.3)
43
+ faraday_middleware (1.2.0)
35
44
  faraday (~> 1.0)
36
- httparty (0.18.1)
45
+ httparty (0.20.0)
37
46
  mime-types (~> 3.0)
38
47
  multi_xml (>= 0.5.2)
39
- i18n (1.8.10)
48
+ i18n (1.10.0)
40
49
  concurrent-ruby (~> 1.0)
41
- mime-types (3.3.1)
50
+ mime-types (3.4.1)
42
51
  mime-types-data (~> 3.2015)
43
- mime-types-data (3.2021.0225)
44
- minitest (5.14.4)
52
+ mime-types-data (3.2022.0105)
53
+ minitest (5.15.0)
45
54
  multi_json (1.15.0)
46
55
  multi_xml (0.6.0)
47
- multipart-post (2.1.1)
56
+ multipart-post (2.2.0)
48
57
  net-sftp (3.0.0)
49
58
  net-ssh (>= 5.0.0, < 7.0.0)
50
59
  net-ssh (6.1.0)
@@ -62,16 +71,15 @@ GEM
62
71
  diff-lcs (>= 1.2.0, < 2.0)
63
72
  rspec-support (~> 3.10.0)
64
73
  rspec-support (3.10.2)
65
- ruby2_keywords (0.0.4)
66
- scalingo (3.0.1)
67
- activesupport (>= 5, < 7)
74
+ ruby2_keywords (0.0.5)
75
+ scalingo (3.1.0)
76
+ activesupport (>= 5, < 8)
68
77
  faraday (~> 1.0)
69
78
  faraday_middleware (~> 1.0)
70
79
  multi_json (~> 1.0, >= 1.0.3)
71
- thor (1.1.0)
80
+ thor (1.2.1)
72
81
  tzinfo (2.0.4)
73
82
  concurrent-ruby (~> 1.0)
74
- zeitwerk (2.4.2)
75
83
 
76
84
  PLATFORMS
77
85
  ruby
@@ -82,4 +90,4 @@ DEPENDENCIES
82
90
  scalingo_backups_manager!
83
91
 
84
92
  BUNDLED WITH
85
- 2.1.4
93
+ 2.3.13
@@ -79,20 +79,24 @@ module ScalingoBackupsManager
79
79
  end
80
80
 
81
81
  configuration.for_each_addons(searched_application, searched_addon) do |application, addon|
82
- backups = addon.backups
83
- next unless backups.size > 0
84
- backup = backups.first
85
- download_link = backup.download_link
86
- if download_link
82
+ begin
87
83
  puts "Downloading #{application.name} last backup"
88
- path = ("#{addon.config[:path]}" || "backups/#{addon.addon_provider[:id]}") + "/#{Time.now.strftime("%Y%m%d")}.tar.gz"
89
- if File.exist?(path)
90
- puts "Backup already download, skipping..."
84
+ backups = addon.backups
85
+ next unless backups.size > 0
86
+ backup = backups.first
87
+ download_link = backup.download_link
88
+ if download_link
89
+ path = ("#{addon.config[:path]}" || "backups/#{addon.addon_provider[:id]}") + "/#{Time.now.strftime("%Y%m%d")}.tar.gz"
90
+ if File.exist?(path)
91
+ puts "Backup already download, skipping..."
92
+ else
93
+ system "curl #{download_link} -o #{path} --create-dirs -k"
94
+ end
91
95
  else
92
- system "curl #{download_link} -o #{path} --create-dirs -k"
96
+ puts "No download link found for #{addon.addon_provider[:id]}, Skipping..."
93
97
  end
94
- else
95
- puts "No download link found for #{addon.addon_provider[:id]}, Skipping..."
98
+ rescue
99
+ puts "Issue with configuration of #{application.name}"
96
100
  end
97
101
  end
98
102
  end
@@ -164,6 +168,7 @@ module ScalingoBackupsManager
164
168
  when "daily"
165
169
  sftp.upload_file(path, remote_path, options: opts)
166
170
  files = sftp.list_files(remote_path)
171
+ p files.length
167
172
  puts "#{step} - Checking daily backups"
168
173
  step += 1
169
174
  if files.size > retention_config[:ttl]
@@ -10,16 +10,25 @@ module ScalingoBackupsManager
10
10
  end
11
11
 
12
12
  def start
13
- Net::SFTP.start(@ftp_host[:host], @ftp_host[:user], password: @ftp_host[:password], port: @ftp_host[:port]) do |sftp|
14
- yield(sftp) if block_given?
13
+ if @ftp_host[:password]
14
+ Net::SFTP.start(@ftp_host[:host], @ftp_host[:user], password: @ftp_host[:password], port: @ftp_host[:port]) do |sftp|
15
+ yield(sftp) if block_given?
16
+ end
17
+ elsif @ftp_host[:private_key_path]
18
+ Net::SFTP.start(@ftp_host[:host], @ftp_host[:user], key_data: [], keys: @ftp_host[:private_key_path], keys_only: true, port: @ftp_host[:port]) do |sftp|
19
+ yield(sftp) if block_given?
20
+ end
15
21
  end
16
22
  end
17
23
 
18
24
  def list_files(path)
19
25
  files = []
20
26
  start do |sftp|
21
- sftp.dir.glob("#{path}", "*.tar.gz").each do |file|
22
- files << file
27
+ begin
28
+ sftp.dir.glob("#{path}", "*.tar.gz").each do |file|
29
+ files << file
30
+ end
31
+ rescue
23
32
  end
24
33
  end
25
34
  files
@@ -36,7 +45,6 @@ module ScalingoBackupsManager
36
45
  folder_tree = []
37
46
  path.split("/").each do |folder_name|
38
47
  next if folder_name.blank?
39
-
40
48
  folder_tree << folder_name
41
49
  begin
42
50
  sftp.mkdir!(folder_tree.join("/"))
@@ -1,3 +1,3 @@
1
1
  module ScalingoBackupsManager
2
- VERSION = "0.6.5"
2
+ VERSION = "0.8.0"
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.5
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Clercin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-06 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.0.0
69
- description:
69
+ description:
70
70
  email:
71
71
  - kevin@9troisquarts.com
72
72
  executables:
@@ -74,6 +74,7 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - ".DS_Store"
77
78
  - ".gitignore"
78
79
  - ".rspec"
79
80
  - ".travis.yml"
@@ -106,7 +107,7 @@ metadata:
106
107
  homepage_uri: https://github.com/9troisquarts/scalingo_backups_manager
107
108
  source_code_uri: https://github.com/9troisquarts/scalingo_backups_manager
108
109
  changelog_uri: https://github.com/9troisquarts/scalingo_backups_manager/CHANGELOG.md
109
- post_install_message:
110
+ post_install_message:
110
111
  rdoc_options: []
111
112
  require_paths:
112
113
  - lib
@@ -121,8 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
122
  - !ruby/object:Gem::Version
122
123
  version: '0'
123
124
  requirements: []
124
- rubygems_version: 3.1.6
125
- signing_key:
125
+ rubygems_version: 3.3.7
126
+ signing_key:
126
127
  specification_version: 4
127
128
  summary: Gem allowing to download backups from scalingo
128
129
  test_files: []