From d38bad05f1a36c588d78e2b8b60fb3710c0325bd Mon Sep 17 00:00:00 2001 From: Voker57 Date: Fri, 24 Sep 2010 10:36:31 +0400 Subject: Check BDB version only if it's loaded --- lib/rbot/registry/tc.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'lib') 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' -- cgit v1.2.3