class Siba::Source::Mysql::Init

Attributes

db[RW]

Public Class Methods

new(options) click to toggle source
# File lib/siba-source-mysql/init.rb, line 29
def initialize(options)
  parsed_options = {}
  OPTION_NAMES.each do |option_name|
    if MULTIPLE_CHOISES.include? option_name
      value = Siba::SibaCheck.options_string_array options, option_name.to_s, true
    else
      value = Siba::SibaCheck.options_string options, option_name.to_s, true
      if value.nil?
        # try get the setting from environment variable
        value = ENV["#{ENV_PREFIX}#{option_name.to_s.upcase}"]
      end
    end
    parsed_options[option_name] = value
  end

  @db = Siba::Source::Mysql::Db.new parsed_options
end

Public Instance Methods

backup(dest_dir) click to toggle source

Collect source files and put them into dest_dir No return value is expected

# File lib/siba-source-mysql/init.rb, line 49
def backup(dest_dir)
  logger.info "Dumping MySQL#{db.db_and_table_names}"
  @db.backup dest_dir
end
restore(from_dir) click to toggle source

Restore source files from_dir No return value is expected

# File lib/siba-source-mysql/init.rb, line 56
def restore(from_dir)
  logger.info "Restoring MySQL#{db.db_and_table_names}"
  @db.restore from_dir
end