diff options
| author | hukl <contact@smyck.org> | 2009-04-28 00:15:53 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-05-01 17:14:02 +0200 |
| commit | 4bd16f053847f2efe347ebda9136ef2233ee0d2c (patch) | |
| tree | f4c11f89455de991c8d87726d5757b752e7129e2 /vendor/plugins/thinking-sphinx/features/support/post_database.rb | |
| parent | d3a9b46ba5c863a0ff377dcffae9a494fe476e02 (diff) | |
added thinking_sphinx plugin for fulltext search on nodes and heads
Diffstat (limited to 'vendor/plugins/thinking-sphinx/features/support/post_database.rb')
| -rw-r--r-- | vendor/plugins/thinking-sphinx/features/support/post_database.rb | 37 |
1 files changed, 37 insertions, 0 deletions
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 @@ | |||
| 1 | $:.unshift File.dirname(__FILE__) + '/../../lib' | ||
| 2 | |||
| 3 | require 'lib/thinking_sphinx' | ||
| 4 | |||
| 5 | %w( tmp/config tmp/log tmp/db/sphinx/development ).each do |path| | ||
| 6 | FileUtils.mkdir_p "#{Dir.pwd}/#{path}" | ||
| 7 | end | ||
| 8 | |||
| 9 | Kernel.const_set :RAILS_ROOT, "#{Dir.pwd}/tmp" unless defined?(RAILS_ROOT) | ||
| 10 | |||
| 11 | at_exit do | ||
| 12 | ThinkingSphinx::Configuration.instance.controller.stop | ||
| 13 | sleep(1) # Ensure Sphinx has shut down completely | ||
| 14 | FileUtils.rm_r "#{Dir.pwd}/tmp" | ||
| 15 | end | ||
| 16 | |||
| 17 | # Add log file | ||
| 18 | ActiveRecord::Base.logger = Logger.new open("tmp/active_record.log", "a") | ||
| 19 | |||
| 20 | ThinkingSphinx.deltas_enabled = false | ||
| 21 | |||
| 22 | # Load Models | ||
| 23 | Dir["features/support/models/*.rb"].sort.each do |file| | ||
| 24 | require file.gsub(/\.rb$/, '') | ||
| 25 | end | ||
| 26 | |||
| 27 | # Set up database tables and records | ||
| 28 | Dir["features/support/db/migrations/*.rb"].each do |file| | ||
| 29 | require file.gsub(/\.rb$/, '') | ||
| 30 | end | ||
| 31 | |||
| 32 | ThinkingSphinx.deltas_enabled = true | ||
| 33 | ThinkingSphinx.suppress_delta_output = true | ||
| 34 | |||
| 35 | ThinkingSphinx::Configuration.instance.build | ||
| 36 | ThinkingSphinx::Configuration.instance.controller.index | ||
| 37 | ThinkingSphinx::Configuration.instance.controller.start | ||
