Sha256: ecf1463fbacb9ac41a0756322c21bea528216fb8db2cbdb30c08a5e0357b7c0b
Contents?: true
Size: 836 Bytes
Versions: 2
Compression:
Stored size: 836 Bytes
Contents
module Riddle class Controller def initialize(configuration, path) @configuration = configuration @path = path end def index cmd = "indexer --config #{@path} --all" cmd << " --rotate" if running? `#{cmd}` end def start return if running? cmd = "searchd --config #{@path}" `#{cmd}` sleep(1) unless running? puts "Failed to start searchd daemon. Check #{@configuration.searchd.log}." end end def stop return unless running? `kill #{pid}` end def pid if File.exists?("#{@configuration.searchd.pid_file}") `cat #{@configuration.searchd.pid_file}`[/\d+/] else nil end end def running? pid && `ps #{pid} | wc -l`.to_i > 1 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
freelancing-god-thinking-sphinx-1.1.2 | vendor/riddle/lib/riddle/controller.rb |
freelancing-god-thinking-sphinx-1.1.3 | vendor/riddle/lib/riddle/controller.rb |