Sha256: 5c4940cbcaab8451c3efcb4db0b07fdc2b8e16733bdb7b90534c8d21af179234
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
require 'logger' require 'pathname' require 'fileutils' require 'zlib' require 'net/ftp' require 'pg' require 'pg_export/version' require 'pg_export/logging' require 'pg_export/configuration' require 'pg_export/errors' require 'pg_export/dump' require 'pg_export/actions' require 'pg_export/ftp_service' require 'pg_export/ftp_service/connection' class PgExport include Logging def initialize @config = Configuration.new yield config if block_given? config.validate end def call initialize_dump concurrently do |job| job << Thread.new { perform_local_job } job << Thread.new { initialize_ftp_service } end perform_ftp_job self end private attr_reader :config attr_accessor :ftp_service, :dump def initialize_dump self.dump = Dump.new(config.database, config.dumpfile_dir) end def initialize_ftp_service self.ftp_service = FtpService.new(config.ftp_params) end def concurrently t = [] yield t t.each(&:join) end def perform_local_job CreateDump.new(dump).call CompressDump.new(dump).call RemoveOldDumps.new(dump, config.keep_dumps).call end def perform_ftp_job SendDumpToFtp.new(dump, ftp_service).call RemoveOldDumpsFromFtp.new(dump, ftp_service, config.keep_ftp_dumps).call end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pg_export-0.2.0 | lib/pg_export.rb |