Namespace

Included Modules

Class/Module Index [+]

Quicksearch

Backup::Config

Constants

DEFAULTS

Attributes

cache_path[R]
config_file[R]
data_path[R]
root_path[R]
tmp_path[R]
user[R]

Public Class Methods

hostname() click to toggle source
# File lib/backup/config.rb, line 56
def hostname
  @hostname ||= run(utility(:hostname))
end
load_config!() click to toggle source

Tries to find and load the configuration file

# File lib/backup/config.rb, line 32
def load_config!
  unless File.exist?(@config_file)
    raise Error, "Could not find configuration file: '#{@config_file}'."
  end

  module_eval(File.read(@config_file), @config_file)
end
preconfigure(name, &block) click to toggle source

Allows users to create preconfigured models.

# File lib/backup/config.rb, line 41
def preconfigure(name, &block)
  unless name.is_a?(String) && name =~ /^[A-Z]/
    raise Error, "Preconfigured model names must be given as a string " +
                 " and start with a capital letter."
  end

  if Backup.const_defined?(name)
    raise Error, "'#{ name }' is already in use " +
                  "and can not be used for a preconfigured model."
  end

  Backup.const_set(name, Class.new(Model))
  Backup.const_get(name).preconfigure(&block)
end
update(options = {}) click to toggle source

Setup required paths based on the given options

# File lib/backup/config.rb, line 21
def update(options = {})
  root_path = options[:root_path].to_s.strip
  new_root = root_path.empty? ? false : set_root_path(root_path)

  DEFAULTS.each do |name, ending|
    set_path_variable(name, options[name], ending, new_root)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.