diff options
author | Raine Virta <rane@kapsi.fi> | 2009-02-26 19:30:06 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-02-28 01:43:45 +0100 |
commit | 978ea255291ea27fef7d5d685a49eb0d52d4e9c9 (patch) | |
tree | 5d2010c60e8374be441f64c439af9850e47e5c56 /lib/rbot | |
parent | 8db7c8ac71ecec319683b7ffc1980d6e22b692e9 (diff) |
Separate @dirs containing all botmodules (plugins and core modules)
into @core_module_dirs and @plugin_dirs
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/ircbot.rb | 8 | ||||
-rw-r--r-- | lib/rbot/plugins.rb | 28 |
2 files changed, 21 insertions, 15 deletions
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) |