class Focus::ConfigLoader

Public Class Methods

load(config) click to toggle source
# File lib/focus/config_loader.rb, line 4
def load(config)
  YAML.load_file(config_file)[config]
end

Private Class Methods

config_file() click to toggle source
# File lib/focus/config_loader.rb, line 10
def config_file
  opts = {
    project_file:    "./.focus.yml",
    focus_repo_file: "#{Focus.root}/.focus.yml",
    home_file:       "#{ENV['HOME']}/.focus.yml",
    default_file:    "#{Focus.root}/config/default.yml"
  }

  opts.each do |_k, file|
    break file if exist?(file)
  end
end
exist?(path) click to toggle source
# File lib/focus/config_loader.rb, line 23
def exist?(path)
  full_path = File.expand_path(path)
  File.exist?(full_path) || File.symlink?(full_path)
end