Method: Bench::Main.load_configuration_file

Defined in:
lib/bench9000/main.rb

.load_configuration_file(config, name, fail_on_missing = true) ⇒ Object



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/bench9000/main.rb', line 245

def self.load_configuration_file(config, name, fail_on_missing = true)
  if name.scan('/').any?
    config.load File.expand_path(name)
  else
    full_name = if name =~ /\.config\.rb$/
                  name
                else
                  name + '.config.rb'
                end

    config_files = Dir["{.,bench,benchmark,benchmarks}/#{full_name}"]
    unless config_files.any?
      puts "Configuration file #{name} not found."
      exit 1
    end
    config_files.each do |config_file|
      config.load config_file
    end
  end
end