From 7f134adccb20abe773234acecf526c9951b418e8 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 20 Apr 2014 04:23:20 -0700 Subject: Improved namespace and directory structure. --- dinobot.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'dinobot.rb') diff --git a/dinobot.rb b/dinobot.rb index 1bd3c46..7eb47f1 100644 --- a/dinobot.rb +++ b/dinobot.rb @@ -1,7 +1,7 @@ require 'timeout' -require_relative 'irc' -require_relative 'logger' +require_relative 'core/irc' +require_relative 'core/logger' module Dinobot class Bot @@ -16,8 +16,8 @@ module Dinobot @trigger = '!' - @irc = Dinobot::IRC.new(@server, @port, @nick, @pass) - @logger = Dinobot::Logger.instance + @irc = Dinobot::Core::IRC.new(@server, @port, @nick, @pass) + @logger = Dinobot::Core::Logger.instance @modules = Hash.new @channels = Array.new @@ -61,9 +61,10 @@ module Dinobot @logger.info "Loading module: #{mod}" begin - load "#{mod}.rb" + load "module/#{mod}.rb" - m = Dinobot.const_get(Dinobot.constants.find { |x| x.downcase == mod }) + m = Dinobot::Module.const_get( + Dinobot::Module.constants.find { |x| x.downcase == mod }) @modules[mod] = m.new(self) @logger.info "Loaded module: #{mod} (#{m})" @@ -80,8 +81,8 @@ module Dinobot raise 'module not loaded' unless @modules.has_key?(mod) @modules.delete(mod) - m = Dinobot.send(:remove_const, - Dinobot.constants.find { |x| x.downcase == mod }) + m = Dinobot::Module.send(:remove_const, + Dinobot::Module.constants.find { |x| x.downcase == mod }) @logger.info "Unloaded module: #{mod} (#{m})" rescue => e -- cgit v1.2.3-70-g09d2