---
 lib/sup.rb       |    2 ++
 lib/sup/index.rb |   10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/sup.rb b/lib/sup.rb
index 5689c2b..54de73f 100644
--- a/lib/sup.rb
+++ b/lib/sup.rb
@@ -54,6 +54,8 @@ module Redwood
   YAML_DOMAIN = "masanjin.net"
   YAML_DATE = "2006-10-01"
 
+  DEFAULT_INDEX = 'ferret'
+
   ## record exceptions thrown in threads nicely
   @exceptions = []
   @exception_mutex = Mutex.new
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
index 45382f1..df428f7 100644
--- a/lib/sup/index.rb
+++ b/lib/sup/index.rb
@@ -212,7 +212,13 @@ EOS
   end
 end
 
+index_name = ENV['SUP_INDEX'] || $config[:index] || DEFAULT_INDEX
+begin
+  require "sup/#{index_name}_index"
+rescue LoadError
+  fail "invalid index name #{index_name.inspect}"
 end
+Index = Redwood.const_get "#{index_name.capitalize}Index"
+Redwood::log "using index #{Index.name}"
 
-require 'lib/sup/ferret_index'
-Redwood::Index = Redwood::FerretIndex
+end
-- 
1.6.0.4

_______________________________________________
sup-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/sup-talk

Reply via email to