class FileConfigParser

Constants

FALSY_VALUE_PATTERN

Public Class Methods

falsy?(value) click to toggle source
# File lib/hiptest-publisher/options_parser.rb, line 42
def self.falsy?(value)
  FALSY_VALUE_PATTERN.match(value)
end
update_options(options, reporter) click to toggle source
# File lib/hiptest-publisher/options_parser.rb, line 18
def self.update_options(options, reporter)
  config = ParseConfig.new(options.config)
  config.get_params.each do |param|
    next if options.__cli_args && options.__cli_args.include?(param.to_sym)
    if param.start_with?("no_")
      value = falsy?(config[param]) ? "true" : "false"
      param = param.sub("no_", "")
    else
      value = config[param]
    end
    if falsy?(value)
      options[param] = false
    else
      options[param] = value
    end
    if %w(overriden_templates output_directory).include?(param)
      update_path!(param, config, options)
    end
    options.__config_args << param.to_sym if options.__config_args
  end
rescue => err
  reporter.dump_error(err)
end
update_path!(param, config, options) click to toggle source
# File lib/hiptest-publisher/options_parser.rb, line 46
def self.update_path!(param, config, options)
  path = Pathname.new(config[param])
  return unless path.relative?
  config_path = Pathname.new(options.config)
  config_absolute_path = config_path.relative? ? Pathname.pwd + config_path : config_path
  resolved_path = config_absolute_path.cleanpath.dirname + path
  options[param] = resolved_path.cleanpath.to_path
end