Class: PgExport

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/pg_export.rb,
lib/pg_export/dump.rb,
lib/pg_export/errors.rb,
lib/pg_export/logging.rb,
lib/pg_export/version.rb,
lib/pg_export/ftp_service.rb,
lib/pg_export/configuration.rb,
lib/pg_export/actions/create_dump.rb,
lib/pg_export/actions/compress_dump.rb,
lib/pg_export/ftp_service/connection.rb,
lib/pg_export/actions/remove_old_dumps.rb,
lib/pg_export/actions/send_dump_to_ftp.rb,
lib/pg_export/actions/remove_old_dumps_from_ftp.rb

Defined Under Namespace

Modules: Logging Classes: CompressDump, Configuration, CreateDump, DatabaseDoesNotExistError, DependencyRequiredError, Dump, DumpFileDoesNotExistError, FtpService, InvalidConfigurationError, RemoveOldDumps, RemoveOldDumpsFromFtp, SendDumpToFtp

Constant Summary collapse

VERSION =
'0.1.1'.freeze

Instance Method Summary collapse

Methods included from Logging

#logger, logger

Constructor Details

#initialize {|config| ... } ⇒ PgExport

Returns a new instance of PgExport.

Yields:

  • (config)


21
22
23
24
25
26
# File 'lib/pg_export.rb', line 21

def initialize
  @config = Configuration.new
  yield config if block_given?
  config.validate
  @dump = Dump.new(config.database, config.dumpfile_dir)
end

Instance Method Details

#callObject



32
33
34
35
36
37
38
39
# File 'lib/pg_export.rb', line 32

def call
  t = []
  t << Thread.new { perform_local_job }
  t << Thread.new { initialize_ftp_service }
  t.each(&:join)
  perform_ftp_job
  self
end

#initialize_ftp_serviceObject



28
29
30
# File 'lib/pg_export.rb', line 28

def initialize_ftp_service
  self.ftp_service = FtpService.new(config.ftp_params)
end