From 4bd16f053847f2efe347ebda9136ef2233ee0d2c Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 28 Apr 2009 00:15:53 +0200 Subject: added thinking_sphinx plugin for fulltext search on nodes and heads --- .../features/support/post_database.rb | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 vendor/plugins/thinking-sphinx/features/support/post_database.rb (limited to 'vendor/plugins/thinking-sphinx/features/support/post_database.rb') diff --git a/vendor/plugins/thinking-sphinx/features/support/post_database.rb b/vendor/plugins/thinking-sphinx/features/support/post_database.rb new file mode 100644 index 0000000..51cefb5 --- /dev/null +++ b/vendor/plugins/thinking-sphinx/features/support/post_database.rb @@ -0,0 +1,37 @@ +$:.unshift File.dirname(__FILE__) + '/../../lib' + +require 'lib/thinking_sphinx' + +%w( tmp/config tmp/log tmp/db/sphinx/development ).each do |path| + FileUtils.mkdir_p "#{Dir.pwd}/#{path}" +end + +Kernel.const_set :RAILS_ROOT, "#{Dir.pwd}/tmp" unless defined?(RAILS_ROOT) + +at_exit do + ThinkingSphinx::Configuration.instance.controller.stop + sleep(1) # Ensure Sphinx has shut down completely + FileUtils.rm_r "#{Dir.pwd}/tmp" +end + +# Add log file +ActiveRecord::Base.logger = Logger.new open("tmp/active_record.log", "a") + +ThinkingSphinx.deltas_enabled = false + +# Load Models +Dir["features/support/models/*.rb"].sort.each do |file| + require file.gsub(/\.rb$/, '') +end + +# Set up database tables and records +Dir["features/support/db/migrations/*.rb"].each do |file| + require file.gsub(/\.rb$/, '') +end + +ThinkingSphinx.deltas_enabled = true +ThinkingSphinx.suppress_delta_output = true + +ThinkingSphinx::Configuration.instance.build +ThinkingSphinx::Configuration.instance.controller.index +ThinkingSphinx::Configuration.instance.controller.start -- cgit v1.3