Class: PgExport::CommandsFactory
- Inherits:
-
Object
- Object
- PgExport::CommandsFactory
- Defined in:
- lib/pg_export/commands_factory.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #export_dump ⇒ Object
- #gateway_welcome ⇒ Object
- #import_dump_interactively ⇒ Object
-
#initialize(config:) ⇒ CommandsFactory
constructor
A new instance of CommandsFactory.
- #print_configuration ⇒ Object
- #print_help ⇒ Object
- #print_version ⇒ Object
Constructor Details
#initialize(config:) ⇒ CommandsFactory
Returns a new instance of CommandsFactory.
9 10 11 |
# File 'lib/pg_export/commands_factory.rb', line 9 def initialize(config:) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/pg_export/commands_factory.rb', line 7 def config @config end |
Instance Method Details
#export_dump ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/pg_export/commands_factory.rb', line 29 def export_dump require 'pg_export/transactions/export_dump' require 'pg_export/factories/dump_factory' require 'pg_export/adapters/shell_adapter' require 'pg_export/operations/encrypt_dump' require 'pg_export/operations/open_connection' require 'pg_export/operations/remove_old_dumps' require 'pg_export/repositories/gateway_dump_repository' PgExport::Transactions::ExportDump.new( dump_factory: Factories::DumpFactory.new, shell_adapter: Adapters::ShellAdapter.new, encrypt_dump: Operations::EncryptDump.new(cipher_factory: cipher_factory), open_connection: Operations::OpenConnection.new(gateway_factory: gateway_factory), remove_old_dumps: Operations::RemoveOldDumps.new( gateway_dump_repository: Repositories::GatewayDumpRepository.new, keep: config.keep_dumps ), listeners: plain_listeners ) end |
#gateway_welcome ⇒ Object
17 18 19 |
# File 'lib/pg_export/commands_factory.rb', line 17 def gateway_welcome ->(_) { ValueObjects::Success.new(gateway_factory.gateway.welcome) } end |
#import_dump_interactively ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/pg_export/commands_factory.rb', line 51 def import_dump_interactively require 'pg_export/transactions/import_dump_interactively' require 'pg_export/ui/interactive/input' require 'pg_export/adapters/shell_adapter' require 'pg_export/factories/gateway_dump_file_factory' require 'pg_export/repositories/gateway_dump_repository' require 'pg_export/operations/open_connection' require 'pg_export/operations/decrypt_dump' PgExport::Transactions::ImportDumpInteractively.new( input: Ui::Interactive::Input.new, shell_adapter: Adapters::ShellAdapter.new, gateway_dump_file_factory: Factories::GatewayDumpFileFactory.new, gateway_dump_repository: Repositories::GatewayDumpRepository.new, open_connection: Operations::OpenConnection.new(gateway_factory: gateway_factory), decrypt_dump: Operations::DecryptDump.new(cipher_factory: cipher_factory), listeners: interactive_listeners ) end |
#print_configuration ⇒ Object
13 14 15 |
# File 'lib/pg_export/commands_factory.rb', line 13 def print_configuration ->(_) { ValueObjects::Success.new(config) } end |
#print_help ⇒ Object
25 26 27 |
# File 'lib/pg_export/commands_factory.rb', line 25 def print_help ->(_) { ValueObjects::Success.new(PgExport::ConfigurationParser.help) } end |
#print_version ⇒ Object
21 22 23 |
# File 'lib/pg_export/commands_factory.rb', line 21 def print_version ->(_) { ValueObjects::Success.new(PgExport::VERSION) } end |