settings_validator.rb revision 787127631abcd463c471486a393ec0981d3ab9b7
789N/A $stderr.
puts "The settings are invalid. Please check your #{CONFIG_YML_FILES}" 1109N/A "#{format_initializer_error(key_portions)} #{format_key(key_portions)}" 294N/A#{format_messages(messages)} 294N/A Value: #{bad_value.inspect} 1086N/A category, *portions = key.to_s.split('__') 869N/A [category.to_sym, portions] 911N/A def format_key(portions) 294N/A def format_messages(messages) 294N/A messages.map { |message| format_message(message) }.join("\n") 294N/A def format_message(message) 789N/A if message == 'is not included in the list' 1109N/A "#{message} (see the comments in the config/settings.yml at this key)" 789N/A indent_message(message, 2) 1109N/A def format_initializer_error(key_portions) 1109N/A key = key_portions.join('.') 787N/A "The FQDN could not be determined. Please set the hostname in #{CONFIG_YML_FILES}" 869N/A elsif %w(data_root git_root git_daemon_path commits_path).include?(key) 869N/A 'Please check the paths keys in the settings -' 869N/A # other possible values: %w(consider_all_requests_local secret_token log_level) 789N/A "Please set a valid value in the #{CONFIG_INITIALIZER_FILES} for" 789N/A def value_of(category, key_portions) 789N/A if !%i(yml initializers).include?(category) 294N/A SettingsValidationWrapper.new.send(category) 294N/A object = SettingsValidationWrapper.base(category.to_s) 294N/A SettingsValidationWrapper.get_value(object, key_portions) 294N/A def indent_message(message, indentation) 294N/A message.split("\n").map { |line| "#{' ' * indentation}#{line}"}.join("\n")