diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-06 21:55:12 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-06 21:55:12 +0100 |
commit | 00f2fa9d625b19d6c8b33c62ea41460924e43634 (patch) | |
tree | 55eb38943ef966c7cbaddde0abd9b232d1617c89 | |
parent | 0a44338d09e921440fac821b1db8d03e71a10ff0 (diff) |
load rubygems if available
Try loading rubygems as soon as we're set up, since it can be needed for
gettext and a number of other things. This also allows us to get rid of
some stupid convoluted tricks in utils.
-rw-r--r-- | lib/rbot/core/utils/utils.rb | 20 | ||||
-rw-r--r-- | lib/rbot/ircbot.rb | 6 |
2 files changed, 6 insertions, 20 deletions
diff --git a/lib/rbot/core/utils/utils.rb b/lib/rbot/core/utils/utils.rb index f9912ebb..c47601c1 100644 --- a/lib/rbot/core/utils/utils.rb +++ b/lib/rbot/core/utils/utils.rb @@ -16,15 +16,6 @@ require 'set' begin require 'htmlentities' rescue LoadError - gems = nil - begin - gems = require 'rubygems' - rescue LoadError - gems = false - end - if gems - retry - else module ::Irc module Utils UNESCAPE_TABLE = { @@ -108,7 +99,6 @@ rescue LoadError } end end - end end begin @@ -121,15 +111,6 @@ begin end end rescue LoadError - gems = nil - begin - gems = require 'rubygems' - rescue LoadError - gems = false - end - if gems - retry - else module ::Irc module Utils # Some regular expressions to manage HTML data @@ -150,7 +131,6 @@ rescue LoadError AFTER_PAR2_REGEX = /<br(?:\s+[^>]*)?\/?>.*?<\/?(?:br|p|div|html|body|table|td|tr)(?:\s+[^>]*)?\/?>/im end end - end end module ::Irc diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 6279cfe2..35fc2dfd 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -135,6 +135,12 @@ $interrupted = 0 # these first require 'rbot/rbotconfig' +begin + require 'rubygems' +rescue LoadError + log "rubygems unavailable" +end + require 'rbot/load-gettext' require 'rbot/config' require 'rbot/config-compat' |