Sha256: d6933e760e06ff4a27f139bb28b39758a8181a446c10b1335f1e0411f3f210d0
Contents?: true
Size: 1.1 KB
Versions: 6
Compression:
Stored size: 1.1 KB
Contents
module Outback class Backup attr_reader :configuration, :name, :timestamp, :archives, :tmpdir delegate :sources, :targets, :to => :configuration def initialize(configuration) raise ArgumentError, "configuration required" unless configuration.is_a?(Outback::Configuration) @configuration = configuration @name = configuration.name @timestamp = Time.now.to_formatted_s(:number) end def run! @archives = [] begin @tmpdir = Dir.mktmpdir([name, timestamp]) @archives = create_archives Outback.info "Created #{@archives.size} archives" store_archives ensure FileUtils.remove_entry_secure(tmpdir) end purge_targets end private def create_archives archives = sources.collect do |source| source.create_archives(name, timestamp, tmpdir) end archives.flatten.compact end def store_archives targets.each { |target| target.put(archives) } end def purge_targets targets.each { |target| target.purge!(name) } end end end
Version data entries
6 entries across 6 versions & 1 rubygems