From: Voker57 Date: Fri, 24 Sep 2010 06:36:31 +0000 (+0400) Subject: Check BDB version only if it's loaded X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=d38bad05f1a36c588d78e2b8b60fb3710c0325bd;hp=a7ac54ea20995ecc82ecc6f968fc580b022552ee;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git Check BDB version only if it's loaded --- diff --git a/lib/rbot/registry/tc.rb b/lib/rbot/registry/tc.rb index b4e60d71..eae6e29e 100644 --- a/lib/rbot/registry/tc.rb +++ b/lib/rbot/registry/tc.rb @@ -5,6 +5,17 @@ begin require 'bdb' + if BDB::VERSION_MAJOR < 4 + fatal "Your bdb (Berkeley DB) version #{BDB::VERSION} is too old!" + fatal "rbot will only run with bdb version 4 or higher, please upgrade." + fatal "For maximum reliability, upgrade to version 4.2 or higher." + raise BDB::Fatal, BDB::VERSION + " is too old" + end + + if BDB::VERSION_MAJOR == 4 and BDB::VERSION_MINOR < 2 + warning "Your bdb (Berkeley DB) version #{BDB::VERSION} may not be reliable." + warning "If possible, try upgrade version 4.2 or later." + end rescue LoadError warning "rbot couldn't load the bdb module. Old registries won't be upgraded" rescue Exception => e @@ -12,17 +23,7 @@ rescue Exception => e end -if BDB::VERSION_MAJOR < 4 - fatal "Your bdb (Berkeley DB) version #{BDB::VERSION} is too old!" - fatal "rbot will only run with bdb version 4 or higher, please upgrade." - fatal "For maximum reliability, upgrade to version 4.2 or higher." - raise BDB::Fatal, BDB::VERSION + " is too old" -end -if BDB::VERSION_MAJOR == 4 and BDB::VERSION_MINOR < 2 - warning "Your bdb (Berkeley DB) version #{BDB::VERSION} may not be reliable." - warning "If possible, try upgrade version 4.2 or later." -end require 'tokyocabinet'