Module: Heel::Configuration

Defined in:
lib/heel/configuration.rb

Overview

Configuration module used by all the other modules and classes for determining paths and default values.

Constant Summary collapse

HOMEPAGE =
"http://copiousfreetime.rubyforge.org/heel/"

Class Method Summary collapse

Class Method Details

.config_path(*args) ⇒ Object

returns
String

The full expanded path of the config directory

below root_dir. All parameters passed in are joined onto the result. Trailing File::SEPARATOR is guaranteed if args are not present.



34
35
36
# File 'lib/heel/configuration.rb', line 34

def self.config_path(*args)
  self.sub_path("config", *args)
end

.data_path(*args) ⇒ Object

returns
String

The full expanded path of the data directory below

root_dir. All parameters passed in are joined onto the result. Trailing File::SEPARATOR is guaranteed if _*args_ are not present.



43
44
45
# File 'lib/heel/configuration.rb', line 43

def self.data_path(*args)
  self.sub_path("data", *args)
end

.lib_path(*args) ⇒ Object

returns
String

The full expanded path of the lib directory below

root_dir. All parameters passed in are joined onto the result. Trailing File::SEPARATOR is guaranteed if _*args_ are not present.



52
53
54
# File 'lib/heel/configuration.rb', line 52

def self.lib_path(*args)
  self.sub_path("lib", *args)
end

.root_dirObject

The root directory of the project is considered to be the parent directory of the ‘lib’ directory.

returns
String

The full expanded path of the parent directory of ‘lib’

going up the path from the current file. Trailing File::SEPARATOR is guaranteed.



20
21
22
23
24
25
26
27
# File 'lib/heel/configuration.rb', line 20

def self.root_dir
  unless @root_dir
    path_parts = ::File.expand_path(__FILE__).split(::File::SEPARATOR)
    lib_index  = path_parts.rindex("lib")
    @root_dir = path_parts[0...lib_index].join(::File::SEPARATOR) + ::File::SEPARATOR
  end
  return @root_dir
end