Parent

Class/Module Index [+]

Quicksearch

HammerCLI::Settings

Public Class Methods

clear() click to toggle source
# File lib/hammer_cli/settings.rb, line 48
def self.clear
  settings.clear
  path_history.clear
end
dump() click to toggle source
# File lib/hammer_cli/settings.rb, line 53
def self.dump
  settings
end
get(*keys) click to toggle source
# File lib/hammer_cli/settings.rb, line 8
def self.get(*keys)
  keys.inject(settings) do |value, key|
    return nil unless value
    value[key.to_sym]
  end
end
load(settings_hash) click to toggle source
# File lib/hammer_cli/settings.rb, line 44
def self.load(settings_hash)
  deep_merge!(settings, settings_hash)
end
load_from_file(file_path) click to toggle source
# File lib/hammer_cli/settings.rb, line 34
def self.load_from_file(file_path)
  if File.file? file_path
    config = YAML::load(File.open(file_path))
    if config
      load(config)
      path_history << file_path
    end
  end
end
load_from_paths(files) click to toggle source
# File lib/hammer_cli/settings.rb, line 15
def self.load_from_paths(files)
  files.reverse.each do |path|
    full_path = File.expand_path path
    if File.directory? full_path
      # check for cli_config.yml
      load_from_file(File.join(full_path, 'cli_config.yml'))
      # load config for modules
      Dir.glob(File.join(full_path, 'cli.modules.d/*.yml')).sort.each do |f|
        load_from_file(f)
      end
      Dir.glob(File.join(full_path, 'hammer.modules.d/*.yml')).sort.each do |f|
        warn _("Warning: location hammer.modules.d is deprecated, move your module configurations to cli.modules.d")
        warn "    #{f} -> #{f.gsub('hammer.modules.d', 'cli.modules.d')}"
        load_from_file(f)
      end
    end
  end
end
path_history() click to toggle source
# File lib/hammer_cli/settings.rb, line 57
def self.path_history
  @path_history ||= []
  @path_history
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.