class ThinkingSphinx::Commands::Base
Public Class Methods
call(configuration, options, stream = STDOUT)
click to toggle source
# File lib/thinking_sphinx/commands/base.rb, line 4 def self.call(configuration, options, stream = STDOUT) new(configuration, options, stream).call_with_handling end
Public Instance Methods
call_with_handling()
click to toggle source
# File lib/thinking_sphinx/commands/base.rb, line 8 def call_with_handling call rescue Riddle::CommandFailedError => error handle_failure error.command_result end
Private Instance Methods
command_output(output)
click to toggle source
# File lib/thinking_sphinx/commands/base.rb, line 18 def command_output(output) return "See above\n" if output.nil? "\n\t" + output.gsub("\n", "\n\t") end
handle_failure(result)
click to toggle source
# File lib/thinking_sphinx/commands/base.rb, line 24 def handle_failure(result) stream.puts <<-TXT The Sphinx #{type} command failed: Command: #{result.command} Status: #{result.status} Output: #{command_output result.output} There may be more information about the failure in #{configuration.searchd.log}. TXT exit result.status end
log(message)
click to toggle source
# File lib/thinking_sphinx/commands/base.rb, line 36 def log(message) return if options[:silent] stream.puts message end