summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVoker57 <voker57@gmail.com>2010-09-24 10:36:31 +0400
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-09-24 08:46:07 +0200
commitd38bad05f1a36c588d78e2b8b60fb3710c0325bd (patch)
treeef233ba4c611db9b60bfe581eae55b1bd3145ebe /lib
parenta7ac54ea20995ecc82ecc6f968fc580b022552ee (diff)
Check BDB version only if it's loaded
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/registry/tc.rb21
1 files changed, 11 insertions, 10 deletions
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'