From 978ea255291ea27fef7d5d685a49eb0d52d4e9c9 Mon Sep 17 00:00:00 2001 From: Raine Virta Date: Thu, 26 Feb 2009 19:30:06 +0200 Subject: Separate @dirs containing all botmodules (plugins and core modules) into @core_module_dirs and @plugin_dirs --- lib/rbot/ircbot.rb | 8 ++++---- lib/rbot/plugins.rb | 28 +++++++++++++++++----------- 2 files changed, 21 insertions(+), 15 deletions(-) (limited to 'lib/rbot') diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index b6843b46..7a021fb5 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -803,17 +803,17 @@ class Bot Dir.mkdir(plugdir_local) unless File.exist?(plugdir_local) @plugins.clear_botmodule_dirs - @plugins.add_botmodule_dir(File.join(Config::coredir, 'utils')) - @plugins.add_botmodule_dir(Config::coredir) + @plugins.add_core_module_dir(File.join(Config::coredir, 'utils')) + @plugins.add_core_module_dir(Config::coredir) if FileTest.directory? plugdir_local - @plugins.add_botmodule_dir(plugdir_local) + @plugins.add_plugin_dir(plugdir_local) else warning "local plugin location #{plugdir_local} is not a directory" end @config['plugins.path'].each do |_| path = _.sub(/^\(default\)/, plugdir_default) - @plugins.add_botmodule_dir(path) + @plugins.add_plugin_dir(path) end end diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index e099e18e..5c5cdddc 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -424,7 +424,8 @@ module Plugins h[k] = Array.new } - @dirs = [] + @core_module_dirs = [] + @plugin_dirs = [] @failed = Array.new @ignored = Array.new @@ -580,18 +581,23 @@ module Plugins private :load_botmodule_file # add one or more directories to the list of directories to - # load botmodules from - # - # TODO find a way to specify necessary plugins which _must_ be loaded - # - def add_botmodule_dir(*dirlist) - @dirs += dirlist - debug "Botmodule loading path: #{@dirs.join(', ')}" + # load core modules from + def add_core_module_dir(*dirlist) + @core_module_dirs += dirlist + debug "Core module loading paths: #{@core_module_dirs.join(', ')}" + end + + # add one or more directories to the list of directories to + # load plugins from + def add_plugin_dir(*dirlist) + @plugin_dirs += dirlist + debug "Plugin loading paths: #{@plugin_dirs.join(', ')}" end def clear_botmodule_dirs - @dirs.clear - debug "Botmodule loading path cleared" + @core_module_dirs.clear + @plugin_dirs.clear + debug "Core module and plugin loading paths cleared" end # load plugins from pre-assigned list of directories @@ -607,7 +613,7 @@ module Plugins processed[pn.intern] = :blacklisted } - dirs = @dirs + dirs = @core_module_dirs + @plugin_dirs dirs.each {|dir| if(FileTest.directory?(dir)) d = Dir.new(dir) -- cgit v1.2.3