pg_export 1.0.0.rc4 → 1.0.0.rc5
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 +4 -4
- data/bin/pg_export +1 -0
- data/lib/pg_export/configuration.rb +6 -14
- data/lib/pg_export/lib/pg_export/listeners/interactive/select_database.rb +12 -0
- data/lib/pg_export/lib/pg_export/listeners/interactive/select_dump.rb +12 -0
- data/lib/pg_export/lib/pg_export/listeners/plain/prepare_params.rb +15 -0
- data/lib/pg_export/lib/pg_export/transactions/import_dump_interactively.rb +4 -4
- data/lib/pg_export/system/boot/config.rb +2 -2
- data/lib/pg_export/system/boot/interactive.rb +3 -13
- data/lib/pg_export/system/boot/plain.rb +2 -13
- data/lib/pg_export/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b927b4b2f8c0ca36682a15ae9f90aa975980d9d3874989f7ab19fe256fcecb7d
|
4
|
+
data.tar.gz: b653c480d52143bf58864f7904a404a21802aa389e9b24ee9f271dbafa064969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1ae01b513f51ef4675b1dbae7337ac6ffe11d3ca481bf272ea6338e1f1b1bcd5fb75b240aefdcc12117e721a6097e945b1832af56344ac232ebfad55a5e98db
|
7
|
+
data.tar.gz: 31dc4ab7b943ce973f14b6a42867d388fa18a8c8f56d52bd9c0e5e30b241258555e804a4d59b53ed9d409fae8d7a8aa8ad8a130356383b66cbbbc4b1a1b75aba
|
data/bin/pg_export
CHANGED
@@ -10,8 +10,10 @@ class PgExport
|
|
10
10
|
attribute :gateway_host, PgExport::Types::Strict::String
|
11
11
|
attribute :gateway_user, PgExport::Types::Strict::String
|
12
12
|
attribute :gateway_password, PgExport::Types::Strict::String.optional
|
13
|
-
attribute :logger_format, PgExport::Types::Coercible::
|
13
|
+
attribute :logger_format, PgExport::Types::Coercible::Symbol.enum(:plain, :timestamped, :muted)
|
14
14
|
attribute :keep_dumps, PgExport::Types::Coercible::Integer.constrained(gteq: 0)
|
15
|
+
attribute :gateway, PgExport::Types::Coercible::Symbol.enum(:ftp, :ssh)
|
16
|
+
attribute :mode, PgExport::Types::Coercible::Symbol.enum(:plain, :interactive)
|
15
17
|
|
16
18
|
def self.build(env)
|
17
19
|
new(
|
@@ -21,22 +23,12 @@ class PgExport
|
|
21
23
|
gateway_user: env['PG_EXPORT_GATEWAY_USER'],
|
22
24
|
gateway_password: env['PG_EXPORT_GATEWAY_PASSWORD'] == '' ? nil : env['PG_EXPORT_GATEWAY_PASSWORD'],
|
23
25
|
logger_format: env['LOGGER_FORMAT'] || 'plain',
|
24
|
-
keep_dumps: env['KEEP_DUMPS'] || 10
|
26
|
+
keep_dumps: env['KEEP_DUMPS'] || 10,
|
27
|
+
gateway: env['GATEWAY'],
|
28
|
+
mode: env['PG_EXPORT_MODE']
|
25
29
|
)
|
26
30
|
rescue Dry::Struct::Error => e
|
27
31
|
raise PgExport::InitializationError, e.message.gsub('[PgExport::Configuration.new] ', '')
|
28
32
|
end
|
29
|
-
|
30
|
-
def gateway
|
31
|
-
ENV['GATEWAY'].to_sym
|
32
|
-
end
|
33
|
-
|
34
|
-
def mode
|
35
|
-
ENV['PG_EXPORT_MODE'].to_sym
|
36
|
-
end
|
37
|
-
|
38
|
-
def logger_muted?
|
39
|
-
logger_format == 'muted'
|
40
|
-
end
|
41
33
|
end
|
42
34
|
end
|
@@ -12,10 +12,10 @@ class PgExport
|
|
12
12
|
class ImportDumpInteractively
|
13
13
|
include Dry::Transaction(container: PgExport::Container)
|
14
14
|
include Import[
|
15
|
+
'ui.interactive.input',
|
15
16
|
'adapters.bash_adapter',
|
16
17
|
'repositories.gateway_dump_repository',
|
17
|
-
'repositories.gateway_dump_file_repository'
|
18
|
-
'ui_input'
|
18
|
+
'repositories.gateway_dump_file_repository'
|
19
19
|
]
|
20
20
|
|
21
21
|
step :open_connection, with: 'operations.open_connection'
|
@@ -37,7 +37,7 @@ class PgExport
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def select_dump(dumps:, gateway:)
|
40
|
-
dump =
|
40
|
+
dump = input.select_dump(dumps)
|
41
41
|
Success(dump: dump, gateway: gateway)
|
42
42
|
end
|
43
43
|
|
@@ -52,7 +52,7 @@ class PgExport
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def select_database(dump:)
|
55
|
-
name =
|
55
|
+
name = input.enter_database_name(dump.database)
|
56
56
|
Success(dump: dump, database: name)
|
57
57
|
end
|
58
58
|
|
@@ -12,14 +12,14 @@ PgExport::Container.boot :config do
|
|
12
12
|
|
13
13
|
formatters = {
|
14
14
|
plain: ->(_, _, _, message) { "#{message}\n" },
|
15
|
-
muted: ->(*) {
|
15
|
+
muted: ->(*) {},
|
16
16
|
timestamped: lambda do |severity, datetime, progname, message|
|
17
17
|
"#{datetime} #{Process.pid} TID-#{Thread.current.object_id.to_s(36)}#{progname} #{severity}: #{message}\n"
|
18
18
|
end
|
19
19
|
}
|
20
20
|
|
21
21
|
register(:logger, memoize: true) do
|
22
|
-
Logger.new($stdout, formatter: formatters.fetch(config.logger_format
|
22
|
+
Logger.new($stdout, formatter: formatters.fetch(config.logger_format))
|
23
23
|
end
|
24
24
|
|
25
25
|
register(:config, memoize: true) { config }
|
@@ -6,19 +6,9 @@ PgExport::Container.boot(:interactive) do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
start do
|
9
|
-
|
10
|
-
transaction
|
11
|
-
|
12
|
-
unless target[:config].logger_muted?
|
13
|
-
%i[
|
14
|
-
open_connection
|
15
|
-
fetch_dumps
|
16
|
-
download_dump
|
17
|
-
decrypt_dump
|
18
|
-
restore
|
19
|
-
].each do |step|
|
20
|
-
transaction.subscribe(step => target["listeners.#{type}.#{step}"])
|
21
|
-
end
|
9
|
+
transaction = PgExport::Transactions::ImportDumpInteractively.new
|
10
|
+
transaction.steps.each do |step|
|
11
|
+
transaction.subscribe(step.name => target["listeners.interactive.#{step.name}"])
|
22
12
|
end
|
23
13
|
|
24
14
|
register('transaction', memoize: true) { transaction }
|
@@ -7,19 +7,8 @@ PgExport::Container.boot(:plain) do
|
|
7
7
|
|
8
8
|
start do
|
9
9
|
transaction = PgExport::Transactions::ExportDump.new
|
10
|
-
|
11
|
-
|
12
|
-
type = 'plain'
|
13
|
-
%i[
|
14
|
-
build_dump
|
15
|
-
encrypt_dump
|
16
|
-
open_connection
|
17
|
-
upload_dump
|
18
|
-
remove_old_dumps
|
19
|
-
close_connection
|
20
|
-
].each do |step|
|
21
|
-
transaction.subscribe(step => target["listeners.#{type}.#{step}"])
|
22
|
-
end
|
10
|
+
transaction.steps.each do |step|
|
11
|
+
transaction.subscribe(step.name => target["listeners.plain.#{step.name}"])
|
23
12
|
end
|
24
13
|
|
25
14
|
register('transaction', memoize: true) { transaction }
|
data/lib/pg_export/version.rb
CHANGED
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: 1.0.0.
|
4
|
+
version: 1.0.0.rc5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Maicher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt_pbkdf
|
@@ -293,6 +293,8 @@ files:
|
|
293
293
|
- lib/pg_export/lib/pg_export/listeners/interactive/open_connection.rb
|
294
294
|
- lib/pg_export/lib/pg_export/listeners/interactive/remove_old_dumps.rb
|
295
295
|
- lib/pg_export/lib/pg_export/listeners/interactive/restore.rb
|
296
|
+
- lib/pg_export/lib/pg_export/listeners/interactive/select_database.rb
|
297
|
+
- lib/pg_export/lib/pg_export/listeners/interactive/select_dump.rb
|
296
298
|
- lib/pg_export/lib/pg_export/listeners/interactive/upload_dump.rb
|
297
299
|
- lib/pg_export/lib/pg_export/listeners/interactive_listener.rb
|
298
300
|
- lib/pg_export/lib/pg_export/listeners/plain/build_dump.rb
|
@@ -302,6 +304,7 @@ files:
|
|
302
304
|
- lib/pg_export/lib/pg_export/listeners/plain/encrypt_dump.rb
|
303
305
|
- lib/pg_export/lib/pg_export/listeners/plain/fetch_dumps.rb
|
304
306
|
- lib/pg_export/lib/pg_export/listeners/plain/open_connection.rb
|
307
|
+
- lib/pg_export/lib/pg_export/listeners/plain/prepare_params.rb
|
305
308
|
- lib/pg_export/lib/pg_export/listeners/plain/remove_old_dumps.rb
|
306
309
|
- lib/pg_export/lib/pg_export/listeners/plain/restore.rb
|
307
310
|
- lib/pg_export/lib/pg_export/listeners/plain/upload_dump.rb
|