Sha256: 1a0af2ec3052a36c6b4f5a9b56f7567c4ec005dbafe5f6ac467a5390c9c0b9d5
Contents?: true
Size: 511 Bytes
Versions: 2
Compression:
Stored size: 511 Bytes
Contents
class PgExport class RemoveOldDumps include Logging def initialize(dump, keep_dumps_count) @dump = dump @keep_dumps_count = keep_dumps_count.to_i end def call files.sort.reverse.drop(keep_dumps_count).each do |filename| File.delete("#{dump.dirname}/#{filename}") logger.info "Remove file #{filename}" end end private attr_reader :dump, :keep_dumps_count def files Dir.entries(dump.dirname).grep(dump.regexp) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pg_export-0.2.0 | lib/pg_export/actions/remove_old_dumps.rb |
pg_export-0.1.3 | lib/pg_export/actions/remove_old_dumps.rb |