Class: ThinkingSphinx::Test
- Inherits:
-
Object
- Object
- ThinkingSphinx::Test
- Defined in:
- lib/thinking_sphinx/test.rb
Class Method Summary collapse
- .autostop ⇒ Object
- .clear ⇒ Object
- .config ⇒ Object
- .index(*indexes) ⇒ Object
- .init(suppress_delta_output = true) ⇒ Object
- .run(&block) ⇒ Object
- .start(options = {}) ⇒ Object
- .start_with_autostop ⇒ Object
- .stop ⇒ Object
Class Method Details
.autostop ⇒ Object
25 26 27 28 29 |
# File 'lib/thinking_sphinx/test.rb', line 25 def self.autostop Kernel.at_exit do ThinkingSphinx::Test.stop end end |
.clear ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/thinking_sphinx/test.rb', line 40 def self.clear [ config.indices_location, config.searchd.binlog_path ].each do |path| FileUtils.rm_rf(path) if File.exist?(path) end end |
.config ⇒ Object
49 50 51 |
# File 'lib/thinking_sphinx/test.rb', line 49 def self.config @config ||= ::ThinkingSphinx::Configuration.instance end |
.index(*indexes) ⇒ Object
53 54 55 |
# File 'lib/thinking_sphinx/test.rb', line 53 def self.index(*indexes) config.controller.index *indexes end |
.init(suppress_delta_output = true) ⇒ Object
4 5 6 7 |
# File 'lib/thinking_sphinx/test.rb', line 4 def self.init(suppress_delta_output = true) FileUtils.mkdir_p config.indices_location config.settings['quiet_deltas'] = suppress_delta_output end |
.run(&block) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/thinking_sphinx/test.rb', line 31 def self.run(&block) begin start yield ensure stop end end |
.start(options = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/thinking_sphinx/test.rb', line 9 def self.start( = {}) config.render_to_file config.controller.index if [:index].nil? || [:index] config.controller.start end |
.start_with_autostop ⇒ Object
15 16 17 18 |
# File 'lib/thinking_sphinx/test.rb', line 15 def self.start_with_autostop autostop start end |
.stop ⇒ Object
20 21 22 23 |
# File 'lib/thinking_sphinx/test.rb', line 20 def self.stop config.controller.stop sleep(0.5) # Ensure Sphinx has shut down completely end |