Sha256: b5e4055bd8cda094c4cf3d092cd28cfd0ed2f738fc29c5ec124efe5e99fcc14a

Contents?: true

Size: 1.01 KB

Versions: 36

Compression:

Stored size: 1.01 KB

Contents

class ThinkingSphinx::Test
  def self.init(suppress_delta_output = true)
    set_flags suppress_delta_output
    create_indexes_folder
  end
  
  def self.start
    config.build
    config.controller.index
    config.controller.start
  end
  
  def self.start_with_autostop
    autostop
    start
  end
  
  def self.stop
    config.controller.stop
    sleep(0.5) # Ensure Sphinx has shut down completely
  end
  
  def self.autostop
    Kernel.at_exit do
      ThinkingSphinx::Test.stop
    end
  end
  
  def self.run(&block)
    start
    yield
    stop
  end
  
  def self.config
    @config ||= ::ThinkingSphinx::Configuration.instance
  end
  
  def self.index(*indexes)
    config.controller.index *indexes
  end
  
  def self.set_flags(suppress_delta_output)
    ::ThinkingSphinx.deltas_enabled        = true
    ::ThinkingSphinx.updates_enabled       = true
    ::ThinkingSphinx.suppress_delta_output = suppress_delta_output
  end
  
  def self.create_indexes_folder
    FileUtils.mkdir_p config.searchd_file_path
  end
end

Version data entries

36 entries across 36 versions & 9 rubygems

Version Path
joshcutler-thinking-sphinx-1.3.18 lib/thinking_sphinx/test.rb
skalee-thinking-sphinx-1.3.14.2 lib/thinking_sphinx/test.rb
skalee-thinking-sphinx-1.3.14.1 lib/thinking_sphinx/test.rb
thinking-sphinx-allen-1.3.18.4 lib/thinking_sphinx/test.rb
thinking-sphinx-allen-1.3.18.3 lib/thinking_sphinx/test.rb
thinking-sphinx-allen-1.3.18.2 lib/thinking_sphinx/test.rb
thinking-sphinx-allen-1.3.18.1 lib/thinking_sphinx/test.rb
thinking-sphinx-allen-1.3.18 lib/thinking_sphinx/test.rb
thinking-sphinx-1.3.18 lib/thinking_sphinx/test.rb
josh_cutler-thinking-sphinx-1.3.17 lib/thinking_sphinx/test.rb
hawkerb-thinking-sphinx-1.3.18 lib/thinking_sphinx/test.rb
thinking-sphinx-1.3.17 lib/thinking_sphinx/test.rb
warp-thinking-sphinx-1.3.16 lib/thinking_sphinx/test.rb
thinking-sphinx-1.3.16 lib/thinking_sphinx/test.rb
hawkerb-thinking-sphinx-1.3.17 lib/thinking_sphinx/test.rb
thinking-sphinx-1.3.15 lib/thinking_sphinx/test.rb
hawkerb-thinking-sphinx-1.3.16 lib/thinking_sphinx/test.rb
hawkerb-thinking-sphinx-1.3.15 lib/thinking_sphinx/test.rb
hawkerb-thinking-sphinx-1.3.14 lib/thinking_sphinx/test.rb
zipme-thinking-sphinx-1.3.14 lib/thinking_sphinx/test.rb