Sha256: ea4da7dd031c4565794affcc0c5f5dbe51a236cb18a80b65f078eff7ad648dcf

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8

module Backup
  module Database
    class Base
      include Backup::CLI::Helpers
      include Backup::Configuration::Helpers

      ##
      # Contains the path to where the database should be dumped
      attr_accessor :dump_path

      ##
      # Allows the user to specify the path to a "dump" utility
      # in case it cannot be auto-detected by Backup
      attr_accessor :utility_path

      ##
      # Super method for all child (database) objects. Every database object's #perform!
      # method should call #super before anything else to prepare
      def perform!
        prepare!
        log!
      end

      ##
      # Defines the @dump_path and ensures it exists by creating it
      def prepare!
        @dump_path = File.join(TMP_PATH, TRIGGER, self.class.name.split('::').last)
        mkdir(dump_path)
      end

      ##
      # Logs a message to the console and log file to inform
      # the client that Backup is dumping the database
      def log!
        Logger.message "#{self.class} started dumping and archiving '#{ name }'."
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
backup-3.0.20 lib/backup/database/base.rb