summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Hecker <apoc@sixserv.org>2014-03-05 13:04:47 +0100
committerMatthias Hecker <apoc@sixserv.org>2014-03-05 13:04:47 +0100
commit269d874e9dfc9e076eb45ca22397ad2f3715aa29 (patch)
tree8d99ab4248a36363179f3e05d6c055495b7a3ea5
parent35b38d0adfb6b00827c4552520a316a10b217958 (diff)
[registry] use tc by-default if available
-rw-r--r--lib/rbot/ircbot.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 02414a07..34c82926 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -435,8 +435,8 @@ class Bot
},
:desc => "Percentage of IRC penalty to consider when sending messages to prevent being disconnected for excess flood. Set to 0 to disable penalty control.")
Config.register Config::StringValue.new('core.db',
- :default => "dbm",
- :wizard => true, :default => "dbm",
+ :default => default_db,
+ :wizard => true,
:validate => Proc.new { |v| Registry::formats.include? v },
:requires_restart => true,
:desc => "DB adaptor to use for storing the plugin data/registries. Options: " + Registry::formats.join(', '))
@@ -822,6 +822,16 @@ class Bot
end
end
+ # Determine if tokyocabinet is installed, if it is use it as a default.
+ def default_db
+ begin
+ require 'tokyocabinet'
+ return 'tc'
+ rescue LoadError
+ return 'dbm'
+ end
+ end
+
def repopulate_botclass_directory
template_dir = File.join Config::datadir, 'templates'
if FileTest.directory? @botclass