Class: PgExport

Inherits:
Object
  • Object
show all
Includes:
Roles::Validatable
Defined in:
lib/pg_export.rb,
lib/pg_export/dump.rb,
lib/pg_export/errors.rb,
lib/pg_export/version.rb,
lib/pg_export/aes/base.rb,
lib/pg_export/ftp/adapter.rb,
lib/pg_export/bash/adapter.rb,
lib/pg_export/bash/factory.rb,
lib/pg_export/build_logger.rb,
lib/pg_export/aes/decryptor.rb,
lib/pg_export/aes/encryptor.rb,
lib/pg_export/configuration.rb,
lib/pg_export/boot_container.rb,
lib/pg_export/ftp/connection.rb,
lib/pg_export/ftp/repository.rb,
lib/pg_export/bash/repository.rb,
lib/pg_export/roles/interactive.rb,
lib/pg_export/roles/validatable.rb,
lib/pg_export/roles/human_readable.rb,
lib/pg_export/roles/colourable_string.rb,
lib/pg_export/services/create_and_export_dump.rb

Defined Under Namespace

Modules: Aes, Bash, Ftp, Roles, Services Classes: BootContainer, BuildLogger, Configuration, Dump, PgDumpError, PgExportError, PgRestoreError

Constant Summary collapse

VERSION =
'0.6.0'.freeze

Constants included from Roles::Validatable

Roles::Validatable::VALID_NON_EMPTY_STRING, Roles::Validatable::VALID_POSITIVE_INTEGER

Instance Method Summary collapse

Methods included from Roles::Validatable

#validate_database_name, #validate_keep_dumps

Constructor Details

#initialize(**args) ⇒ PgExport

Returns a new instance of PgExport.



11
12
13
14
15
16
17
# File 'lib/pg_export.rb', line 11

def initialize(**args)
  config = Configuration.new(**args)
  extend Roles::Interactive if config.interactive
  @container = BootContainer.call(config.to_h)
rescue Dry::Struct::Error => e
  raise ArgumentError, e
end

Instance Method Details

#call(database_name, keep_dumps) ⇒ Object



19
20
21
22
23
24
# File 'lib/pg_export.rb', line 19

def call(database_name, keep_dumps)
  container[:create_and_export_dump].call(
    validate_database_name(database_name),
    validate_keep_dumps(keep_dumps)
  )
end