Module: Klenod::Build::ConfigLoader

Defined in:
lib/klenod/build/config.rb

Constant Summary collapse

CONFIG_FILE =
"klenod.config.rb"

Class Method Summary collapse

Class Method Details

.find(start_dir = Dir.pwd) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/klenod/build/config.rb', line 121

def find(start_dir = Dir.pwd)
  dir = File.expand_path(start_dir)

  loop do
    path = File.join(dir, CONFIG_FILE)
    return path if File.file?(path)

    parent = File.dirname(dir)
    return nil if parent == dir

    dir = parent
  end
end

.load(path) ⇒ Object



135
136
137
138
139
# File 'lib/klenod/build/config.rb', line 135

def load(path)
  builder = ConfigBuilder.new(base_dir: File.dirname(File.expand_path(path)))
  builder.instance_eval(File.read(path), path, 1)
  builder.config
end