]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Check BDB version only if it's loaded
authorVoker57 <voker57@gmail.com>
Fri, 24 Sep 2010 06:36:31 +0000 (10:36 +0400)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 24 Sep 2010 06:46:07 +0000 (08:46 +0200)
lib/rbot/registry/tc.rb

index b4e60d711276010baba787b70269da45e8ff1f6a..eae6e29e6a6bd62e195244c2fc922f7a5437b669 100644 (file)
@@ -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'