pg_export 0.7.3 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +6 -3
  4. data/CHANGELOG.md +17 -0
  5. data/README.md +13 -10
  6. data/bin/pg_export +20 -7
  7. data/lib/pg_export/configuration.rb +12 -8
  8. data/lib/pg_export/container.rb +17 -8
  9. data/lib/pg_export/import.rb +1 -1
  10. data/lib/pg_export/lib/pg_export/factories/ftp_gateway_factory.rb +22 -0
  11. data/lib/pg_export/lib/pg_export/factories/ssh_gateway_factory.rb +22 -0
  12. data/lib/pg_export/lib/pg_export/{adapters/ftp_adapter.rb → gateways/ftp.rb} +9 -6
  13. data/lib/pg_export/lib/pg_export/gateways/ssh.rb +74 -0
  14. data/lib/pg_export/lib/pg_export/listeners/interactive/build_dump.rb +4 -4
  15. data/lib/pg_export/lib/pg_export/listeners/interactive/{close_ftp_connection.rb → close_connection.rb} +1 -1
  16. data/lib/pg_export/lib/pg_export/listeners/interactive/decrypt_dump.rb +2 -2
  17. data/lib/pg_export/lib/pg_export/listeners/interactive/download_dump_from_ftp.rb +2 -2
  18. data/lib/pg_export/lib/pg_export/listeners/interactive/encrypt_dump.rb +2 -2
  19. data/lib/pg_export/lib/pg_export/listeners/interactive/{open_ftp_connection.rb → open_connection.rb} +1 -1
  20. data/lib/pg_export/lib/pg_export/listeners/interactive/remove_old_dumps_from_ftp.rb +5 -5
  21. data/lib/pg_export/lib/pg_export/listeners/interactive/restore.rb +2 -2
  22. data/lib/pg_export/lib/pg_export/listeners/interactive/upload_dump_to_ftp.rb +2 -2
  23. data/lib/pg_export/lib/pg_export/listeners/interactive_listener.rb +2 -2
  24. data/lib/pg_export/lib/pg_export/listeners/plain/build_dump.rb +2 -2
  25. data/lib/pg_export/lib/pg_export/listeners/plain/{close_ftp_connection.rb → close_connection.rb} +2 -2
  26. data/lib/pg_export/lib/pg_export/listeners/plain/decrypt_dump.rb +2 -2
  27. data/lib/pg_export/lib/pg_export/listeners/plain/download_dump_from_ftp.rb +2 -2
  28. data/lib/pg_export/lib/pg_export/listeners/plain/encrypt_dump.rb +2 -2
  29. data/lib/pg_export/lib/pg_export/listeners/plain/fetch_dumps_from_ftp.rb +2 -2
  30. data/lib/pg_export/lib/pg_export/listeners/plain/open_connection.rb +15 -0
  31. data/lib/pg_export/lib/pg_export/listeners/plain/remove_old_dumps_from_ftp.rb +3 -3
  32. data/lib/pg_export/lib/pg_export/listeners/plain/restore.rb +1 -1
  33. data/lib/pg_export/lib/pg_export/listeners/plain/upload_dump_to_ftp.rb +2 -2
  34. data/lib/pg_export/lib/pg_export/listeners/plain_listener.rb +2 -2
  35. data/lib/pg_export/lib/pg_export/operations/{open_ftp_connection.rb → open_connection.rb} +5 -5
  36. data/lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb +6 -6
  37. data/lib/pg_export/lib/pg_export/repositories/{ftp_dump_file_repository.rb → gateway_dump_file_repository.rb} +3 -3
  38. data/lib/pg_export/lib/pg_export/repositories/{ftp_dump_repository.rb → gateway_dump_repository.rb} +7 -7
  39. data/lib/pg_export/lib/pg_export/transactions/export_dump.rb +8 -8
  40. data/lib/pg_export/lib/pg_export/transactions/import_dump_interactively.rb +14 -14
  41. data/lib/pg_export/lib/pg_export/types.rb +1 -1
  42. data/lib/pg_export/system/boot/interactive.rb +1 -1
  43. data/lib/pg_export/system/boot/plain.rb +2 -2
  44. data/lib/pg_export/version.rb +1 -1
  45. data/pg_export.gemspec +10 -6
  46. metadata +84 -27
  47. data/lib/pg_export/lib/pg_export/factories/ftp_adapter_factory.rb +0 -22
  48. data/lib/pg_export/lib/pg_export/listeners/plain/open_ftp_connection.rb +0 -15
@@ -5,7 +5,7 @@ require 'pg_export/lib/pg_export/value_objects/dump_file'
5
5
 
6
6
  class PgExport
7
7
  module Types
8
- include Dry::Types.module
8
+ include Dry::Types()
9
9
 
10
10
  DumpName = Strict::String.constrained(format: /.+_20[0-9]{6}_[0-9]{6}\Z/)
11
11
  DumpType = Types::Coercible::String.enum('plain', 'encrypted')
@@ -17,7 +17,7 @@ PgExport::Container.boot(:interactive) do
17
17
  use :logger
18
18
 
19
19
  %i[
20
- open_ftp_connection
20
+ open_connection
21
21
  fetch_dumps_from_ftp
22
22
  download_dump_from_ftp
23
23
  decrypt_dump
@@ -19,10 +19,10 @@ PgExport::Container.boot(:plain) do
19
19
  %i[
20
20
  build_dump
21
21
  encrypt_dump
22
- open_ftp_connection
22
+ open_connection
23
23
  upload_dump_to_ftp
24
24
  remove_old_dumps_from_ftp
25
- close_ftp_connection
25
+ close_connection
26
26
  ].each do |step|
27
27
  transaction.subscribe(step => target["listeners.#{type}.#{step}"])
28
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class PgExport
4
- VERSION = '0.7.3'
4
+ VERSION = '1.0.0.rc1'
5
5
  end
data/pg_export.gemspec CHANGED
@@ -16,21 +16,25 @@ Gem::Specification.new do |spec|
16
16
  spec.homepage = 'https://github.com/maicher/pg_export'
17
17
  spec.license = 'MIT'
18
18
 
19
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
20
20
  spec.executables = ['pg_export']
21
21
  spec.require_paths = ['lib']
22
22
  spec.required_ruby_version = '>= 2.3.0'
23
23
 
24
- spec.add_dependency 'dry-initializer', '~> 2.5.0'
25
- spec.add_dependency 'dry-system', '~> 0.10.0'
26
- spec.add_dependency 'dry-transaction', '~> 0.13.0'
24
+ spec.add_dependency 'dry-initializer', '~> 3.0'
25
+ spec.add_dependency 'dry-types', '~> 1.0'
26
+ spec.add_dependency 'dry-struct', '~> 1.0'
27
+ spec.add_dependency 'dry-system', '~> 0.18'
28
+ spec.add_dependency 'dry-transaction', '~> 0.13'
29
+ spec.add_dependency 'net-ssh'
30
+ spec.add_dependency 'net-scp'
27
31
  spec.add_dependency 'tty-prompt'
28
32
  spec.add_dependency 'tty-spinner'
29
33
 
30
- spec.add_development_dependency 'bundler', '~> 1.16'
34
+ spec.add_development_dependency 'bundler', '~> 2.1'
31
35
  spec.add_development_dependency 'pg', '~> 0.21'
32
36
  spec.add_development_dependency 'pry'
33
- spec.add_development_dependency 'rake', '~> 10.0'
37
+ spec.add_development_dependency 'rake', '>= 12.3.3'
34
38
  spec.add_development_dependency 'rspec', '~> 3.4'
35
39
  spec.add_development_dependency 'rubocop', '~> 0.59.2'
36
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_export
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 1.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Maicher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-18 00:00:00.000000000 Z
11
+ date: 2021-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-initializer
@@ -16,42 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.5.0
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.5.0
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dry-types
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-struct
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: dry-system
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
59
  - - "~>"
32
60
  - !ruby/object:Gem::Version
33
- version: 0.10.0
61
+ version: '0.18'
34
62
  type: :runtime
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
- version: 0.10.0
68
+ version: '0.18'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: dry-transaction
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: 0.13.0
75
+ version: '0.13'
48
76
  type: :runtime
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: 0.13.0
82
+ version: '0.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: net-ssh
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: net-scp
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
55
111
  - !ruby/object:Gem::Dependency
56
112
  name: tty-prompt
57
113
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +142,14 @@ dependencies:
86
142
  requirements:
87
143
  - - "~>"
88
144
  - !ruby/object:Gem::Version
89
- version: '1.16'
145
+ version: '2.1'
90
146
  type: :development
91
147
  prerelease: false
92
148
  version_requirements: !ruby/object:Gem::Requirement
93
149
  requirements:
94
150
  - - "~>"
95
151
  - !ruby/object:Gem::Version
96
- version: '1.16'
152
+ version: '2.1'
97
153
  - !ruby/object:Gem::Dependency
98
154
  name: pg
99
155
  requirement: !ruby/object:Gem::Requirement
@@ -126,16 +182,16 @@ dependencies:
126
182
  name: rake
127
183
  requirement: !ruby/object:Gem::Requirement
128
184
  requirements:
129
- - - "~>"
185
+ - - ">="
130
186
  - !ruby/object:Gem::Version
131
- version: '10.0'
187
+ version: 12.3.3
132
188
  type: :development
133
189
  prerelease: false
134
190
  version_requirements: !ruby/object:Gem::Requirement
135
191
  requirements:
136
- - - "~>"
192
+ - - ">="
137
193
  - !ruby/object:Gem::Version
138
- version: '10.0'
194
+ version: 12.3.3
139
195
  - !ruby/object:Gem::Dependency
140
196
  name: rspec
141
197
  requirement: !ruby/object:Gem::Requirement
@@ -194,39 +250,41 @@ files:
194
250
  - lib/pg_export/container.rb
195
251
  - lib/pg_export/import.rb
196
252
  - lib/pg_export/lib/pg_export/adapters/bash_adapter.rb
197
- - lib/pg_export/lib/pg_export/adapters/ftp_adapter.rb
198
253
  - lib/pg_export/lib/pg_export/entities/dump.rb
199
254
  - lib/pg_export/lib/pg_export/factories/cipher_factory.rb
200
255
  - lib/pg_export/lib/pg_export/factories/dump_factory.rb
201
- - lib/pg_export/lib/pg_export/factories/ftp_adapter_factory.rb
256
+ - lib/pg_export/lib/pg_export/factories/ftp_gateway_factory.rb
257
+ - lib/pg_export/lib/pg_export/factories/ssh_gateway_factory.rb
258
+ - lib/pg_export/lib/pg_export/gateways/ftp.rb
259
+ - lib/pg_export/lib/pg_export/gateways/ssh.rb
202
260
  - lib/pg_export/lib/pg_export/listeners/interactive/build_dump.rb
203
- - lib/pg_export/lib/pg_export/listeners/interactive/close_ftp_connection.rb
261
+ - lib/pg_export/lib/pg_export/listeners/interactive/close_connection.rb
204
262
  - lib/pg_export/lib/pg_export/listeners/interactive/decrypt_dump.rb
205
263
  - lib/pg_export/lib/pg_export/listeners/interactive/download_dump_from_ftp.rb
206
264
  - lib/pg_export/lib/pg_export/listeners/interactive/encrypt_dump.rb
207
265
  - lib/pg_export/lib/pg_export/listeners/interactive/fetch_dumps_from_ftp.rb
208
- - lib/pg_export/lib/pg_export/listeners/interactive/open_ftp_connection.rb
266
+ - lib/pg_export/lib/pg_export/listeners/interactive/open_connection.rb
209
267
  - lib/pg_export/lib/pg_export/listeners/interactive/remove_old_dumps_from_ftp.rb
210
268
  - lib/pg_export/lib/pg_export/listeners/interactive/restore.rb
211
269
  - lib/pg_export/lib/pg_export/listeners/interactive/upload_dump_to_ftp.rb
212
270
  - lib/pg_export/lib/pg_export/listeners/interactive_listener.rb
213
271
  - lib/pg_export/lib/pg_export/listeners/plain/build_dump.rb
214
- - lib/pg_export/lib/pg_export/listeners/plain/close_ftp_connection.rb
272
+ - lib/pg_export/lib/pg_export/listeners/plain/close_connection.rb
215
273
  - lib/pg_export/lib/pg_export/listeners/plain/decrypt_dump.rb
216
274
  - lib/pg_export/lib/pg_export/listeners/plain/download_dump_from_ftp.rb
217
275
  - lib/pg_export/lib/pg_export/listeners/plain/encrypt_dump.rb
218
276
  - lib/pg_export/lib/pg_export/listeners/plain/fetch_dumps_from_ftp.rb
219
- - lib/pg_export/lib/pg_export/listeners/plain/open_ftp_connection.rb
277
+ - lib/pg_export/lib/pg_export/listeners/plain/open_connection.rb
220
278
  - lib/pg_export/lib/pg_export/listeners/plain/remove_old_dumps_from_ftp.rb
221
279
  - lib/pg_export/lib/pg_export/listeners/plain/restore.rb
222
280
  - lib/pg_export/lib/pg_export/listeners/plain/upload_dump_to_ftp.rb
223
281
  - lib/pg_export/lib/pg_export/listeners/plain_listener.rb
224
282
  - lib/pg_export/lib/pg_export/operations/decrypt_dump.rb
225
283
  - lib/pg_export/lib/pg_export/operations/encrypt_dump.rb
226
- - lib/pg_export/lib/pg_export/operations/open_ftp_connection.rb
284
+ - lib/pg_export/lib/pg_export/operations/open_connection.rb
227
285
  - lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb
228
- - lib/pg_export/lib/pg_export/repositories/ftp_dump_file_repository.rb
229
- - lib/pg_export/lib/pg_export/repositories/ftp_dump_repository.rb
286
+ - lib/pg_export/lib/pg_export/repositories/gateway_dump_file_repository.rb
287
+ - lib/pg_export/lib/pg_export/repositories/gateway_dump_repository.rb
230
288
  - lib/pg_export/lib/pg_export/transactions/export_dump.rb
231
289
  - lib/pg_export/lib/pg_export/transactions/import_dump_interactively.rb
232
290
  - lib/pg_export/lib/pg_export/types.rb
@@ -254,12 +312,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
254
312
  version: 2.3.0
255
313
  required_rubygems_version: !ruby/object:Gem::Requirement
256
314
  requirements:
257
- - - ">="
315
+ - - ">"
258
316
  - !ruby/object:Gem::Version
259
- version: '0'
317
+ version: 1.3.1
260
318
  requirements: []
261
- rubyforge_project:
262
- rubygems_version: 2.7.3
319
+ rubygems_version: 3.2.3
263
320
  signing_key:
264
321
  specification_version: 4
265
322
  summary: CLI for creating and exporting PostgreSQL dumps to FTP.
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # auto_register: false
4
-
5
- require 'pg_export/lib/pg_export/adapters/ftp_adapter'
6
- require 'pg_export/import'
7
-
8
- class PgExport
9
- module Factories
10
- class FtpAdapterFactory
11
- include Import['config']
12
-
13
- def ftp_adapter
14
- ::PgExport::Adapters::FtpAdapter.new(
15
- host: config.ftp_host,
16
- user: config.ftp_user,
17
- password: config.ftp_password
18
- )
19
- end
20
- end
21
- end
22
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../plain_listener'
4
-
5
- class PgExport
6
- module Listeners
7
- class Plain
8
- class OpenFtpConnection < PlainListener
9
- def on_step_succeeded(step_name:, args:, value:)
10
- logger.info("Connect to #{value[:ftp_adapter]}")
11
- end
12
- end
13
- end
14
- end
15
- end