1 $:.unshift File.dirname(__FILE__)
12 load File.join(File.expand_path(File.dirname(__FILE__)), 'session.rb')
13 load File.join(File.expand_path(File.dirname(__FILE__)), 'client.rb')
18 commands_file = File.join(File.expand_path(File.dirname(__FILE__)), 'commands.rb')
19 if [commands_file, plugin_files].flatten.any? { |f| plugin_changed? f }
20 Commands.send(:reload_filters!)
21 MatzBot.send(:remove_const, :Commands)
28 plugin_files.each do |file|
29 puts "Loading #{file}..."
34 puts "Unable to load #{file}, disabled."
41 [dot_matz_bot, 'plugins'].map do |directory|
42 next unless File.exists? directory
43 Dir[File.join(directory, '*.rb')]
49 if PLATFORM =~ /win32/
50 dot_matz_bot = ENV['HOMEDRIVE'] + ENV['HOMEPATH']
51 dot_matz_bot = File.join(home, 'MatzBot')
53 dot_matz_bot = File.join(File.expand_path("~/matzbot/"), "configuration")
57 def plugin_changed?(file)
58 touch_plugin(file) if !@loaded_plugins[file] || @loaded_plugins[file] < File.mtime(file)
61 def touch_plugin(file)
62 @loaded_plugins[file] = File.mtime(file)