module Worktree::Config

Public Class Methods

config() click to toggle source
# File lib/worktree/config.rb, line 17
def config
  YAML.load_file(Worktree::Config.config_file)
end
config_file() click to toggle source
# File lib/worktree/config.rb, line 7
def config_file
  xdg_config_home = ENV.fetch('XDG_CONFIG_HOME') { "#{ENV['HOME']}/.config" }
  _config_file = "#{xdg_config_home}/worktree/worktree.yml"
  unless File.exist?(_config_file)
    raise Worktree::Error, "config file #{_config_file} not found!"
  end

  _config_file
end

Private Instance Methods

config() click to toggle source
# File lib/worktree/config.rb, line 17
def config
  YAML.load_file(Worktree::Config.config_file)
end
config_file() click to toggle source
# File lib/worktree/config.rb, line 7
def config_file
  xdg_config_home = ENV.fetch('XDG_CONFIG_HOME') { "#{ENV['HOME']}/.config" }
  _config_file = "#{xdg_config_home}/worktree/worktree.yml"
  unless File.exist?(_config_file)
    raise Worktree::Error, "config file #{_config_file} not found!"
  end

  _config_file
end