Method: Falsework::CliConfig#loadFile

Defined in:
lib/falsework/cliconfig.rb

#loadFileObject

Load a config from file. Return true on success or false otherwise.



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/falsework/cliconfig.rb', line 62

def loadFile
  file = getConfigPath
  return false unless file

  CliUtils::veputs(2, "Loading #{File.basename(file)}... " + CliUtils::NNL_MARK)
  myconf = YAML.load_file(file) rescue CliUtils.errx(EX_CONFIG, "cannot parse config #{file}: #{$!}")
  # preserve existing values
  @conf.merge!(myconf) {|key, oldval, newval| oldval }
  CliUtils::veputs 2, "OK"
  return true
end