From 30c9b2bf58f2211f10d0833c1cfac56f82988c66 Mon Sep 17 00:00:00 2001 From: Jens Wille Date: Fri, 6 Feb 2015 12:50:36 +0100 Subject: [PATCH] lib/lingo/attendee.rb: Include config file in invalid options warning (e099aaa). --- lib/lingo/attendee.rb | 5 +++-- lib/lingo/config.rb | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/lingo/attendee.rb b/lib/lingo/attendee.rb index ddb8d99e..85750fcc 100644 --- a/lib/lingo/attendee.rb +++ b/lib/lingo/attendee.rb @@ -6,7 +6,7 @@ # Lingo -- A full-featured automatic indexing system # # # # Copyright (C) 2005-2007 John Vorhauer # -# Copyright (C) 2007-2012 John Vorhauer, Jens Wille # +# Copyright (C) 2007-2015 John Vorhauer, Jens Wille # # # # Lingo is free software; you can redistribute it and/or modify it under the # # terms of the GNU Affero General Public License as published by the Free # @@ -85,7 +85,8 @@ def initialize(config, lingo) unless (invalid_keys = config.keys - @valid_keys).empty? warn( "CONFIGURATION NOTICE: #{self.class.name.sub(/\ALingo::/, '')}" << - " options invalid or obsolete: #{invalid_keys.sort.join(', ')}" + " options invalid or obsolete: #{invalid_keys.sort.join(', ')}" << + " (in #{lingo.config.config_file})" ) end end diff --git a/lib/lingo/config.rb b/lib/lingo/config.rb index 1c67c1ac..7d1f4781 100644 --- a/lib/lingo/config.rb +++ b/lib/lingo/config.rb @@ -6,7 +6,7 @@ # Lingo -- A full-featured automatic indexing system # # # # Copyright (C) 2005-2007 John Vorhauer # -# Copyright (C) 2007-2014 John Vorhauer, Jens Wille # +# Copyright (C) 2007-2015 John Vorhauer, Jens Wille # # # # Lingo is free software; you can redistribute it and/or modify it under the # # terms of the GNU Affero General Public License as published by the Free # @@ -58,6 +58,8 @@ def initialize(*args) end end + attr_reader :language_file, :config_file + def to_h @opts end @@ -129,6 +131,8 @@ def nodes_to_key(nodes) def load_config(key, type = key.to_sym) file = Lingo.find(type, @opts[key]) { quit } + instance_variable_set("@#{type}_file", file) + File.open(file, encoding: ENC) { |f| @opts.update(SafeYAML.load(f)) } rescue Psych::SyntaxError => err err.message << " (in #{file})"