Sha256: f933f9d4480f829b2c0c486500e8ffddcf0f31fb20a6f840c3bf6323ff7b1293
Contents?: true
Size: 756 Bytes
Versions: 1
Compression:
Stored size: 756 Bytes
Contents
class PgExport class BashUtils include Logging def initialize(database_name) @database_name = database_name end def create_dump dump = Dump.new('Dump') Open3.popen3("pg_dump -Fc --file #{dump.path} #{database_name}") do |_, _, err| error = err.read raise PgDumpError, error unless error.empty? end logger.info "Create #{dump}" dump end def restore_dump(dump, restore_database_name) Open3.popen3("pg_restore -c -d #{restore_database_name} #{dump.path}") do |_, _, err| error = err.read raise PgRestoreError, error if /FATAL/ =~ error end logger.info "Restore #{dump}" self end private attr_reader :database_name end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pg_export-0.5.1 | lib/pg_export/services/bash_utils.rb |