diff options
author | Matthias Hecker <apoc@geekosphere.org> | 2015-06-13 19:54:18 +0200 |
---|---|---|
committer | Matthias Hecker <apoc@geekosphere.org> | 2015-06-13 19:54:18 +0200 |
commit | 91b88cb3a769cc3b7ef97da9354aa1727caf3437 (patch) | |
tree | ff63d0b1e789e8c47836c51ff9a03641da325a78 /lib/rbot/plugins.rb | |
parent | 7b35acadbd3726d46db8a691036217c336b11058 (diff) |
plugins, improved how we lookup plugins filename
Diffstat (limited to 'lib/rbot/plugins.rb')
-rw-r--r-- | lib/rbot/plugins.rb | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index cf145c83..e40cfcc4 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -4,6 +4,7 @@ # :title: rbot plugin management require 'singleton' +require_relative './core/utils/where_is.rb' module Irc class Bot @@ -603,17 +604,6 @@ module Plugins debug "loading #{desc}#{fname}" plugin_module.module_eval(plugin_string, fname) - # this sets a BOTMODULE_FNAME constant in all BotModule - # classes defined in the module. This allows us to know - # the filename the plugin was declared in from outside - # the plugin itself (from within, a __FILE__ would work.) - plugin_module.constants.each do |const| - cls = plugin_module.const_get(const) - if cls.is_a? Class and cls < BotModule - cls.const_set("BOTMODULE_FNAME", fname) - end - end - return :loaded rescue Exception => err # rescue TimeoutError, StandardError, NameError, LoadError, SyntaxError => err @@ -800,7 +790,7 @@ module Plugins if botmodule @failed.clear @ignored.clear - filename = botmodule.class::BOTMODULE_FNAME + filename = where_is(botmodule.class) err = load_botmodule_file(filename, "plugin") if err.is_a? Exception @failed << { :name => botmodule.to_s, |