module Hieraviz::Config

module to manage parsing and holding of configuration variables

Public Class Methods

basepaths() click to toggle source
# File lib/hieraviz/config.rb, line 12
def basepaths
  basepath_dir = @_config['basepath_dir']
  if @_config && basepath_dir
    Dir.glob(root_path(basepath_dir)).map { |path| File.expand_path(path) }.sort
  end
end
configfile() click to toggle source
# File lib/hieraviz/config.rb, line 8
def configfile
  root_path(ENV['HIERAVIZ_CONFIG_FILE'] || File.join('config', 'hieraviz.yml'))
end
load() click to toggle source
# File lib/hieraviz/config.rb, line 4
def load
  @_config = YAML.load_file(configfile)
end
root() click to toggle source
# File lib/hieraviz/config.rb, line 19
def root
  File.expand_path('../../../', __FILE__)
end
root_path(path) click to toggle source
# File lib/hieraviz/config.rb, line 23
def root_path(path)
  if path[0] == '/'
    path
  else
    File.join(root, path)
  end
end

Private Instance Methods

basepaths() click to toggle source
# File lib/hieraviz/config.rb, line 12
def basepaths
  basepath_dir = @_config['basepath_dir']
  if @_config && basepath_dir
    Dir.glob(root_path(basepath_dir)).map { |path| File.expand_path(path) }.sort
  end
end
configfile() click to toggle source
# File lib/hieraviz/config.rb, line 8
def configfile
  root_path(ENV['HIERAVIZ_CONFIG_FILE'] || File.join('config', 'hieraviz.yml'))
end
load() click to toggle source
# File lib/hieraviz/config.rb, line 4
def load
  @_config = YAML.load_file(configfile)
end
root() click to toggle source
# File lib/hieraviz/config.rb, line 19
def root
  File.expand_path('../../../', __FILE__)
end
root_path(path) click to toggle source
# File lib/hieraviz/config.rb, line 23
def root_path(path)
  if path[0] == '/'
    path
  else
    File.join(root, path)
  end
end