class ThinkingSphinx::Hooks::GuardPresence

Attributes

configuration[R]
stream[R]

Public Class Methods

call(configuration = nil, stream = STDERR) click to toggle source
# File lib/thinking_sphinx/hooks/guard_presence.rb, line 4
def self.call(configuration = nil, stream = STDERR)
  new(configuration, stream).call
end
new(configuration = nil, stream = STDERR) click to toggle source
# File lib/thinking_sphinx/hooks/guard_presence.rb, line 8
def initialize(configuration = nil, stream = STDERR)
  @configuration = configuration || ThinkingSphinx::Configuration.instance
  @stream        = stream
end

Public Instance Methods

call() click to toggle source
# File lib/thinking_sphinx/hooks/guard_presence.rb, line 13
  def call
    return if files.empty?

    stream.puts "WARNING: The following indexing guard files exist:"
    files.each do |file|
      stream.puts " * #{file}"
    end
    stream.puts <<-TXT
These files indicate indexing is already happening. If that is not the case,
these files should be deleted to ensure all indices can be processed.

    TXT
  end

Private Instance Methods

files() click to toggle source
# File lib/thinking_sphinx/hooks/guard_presence.rb, line 31
def files
  @files ||= Dir["#{configuration.indices_location}/ts-*.tmp"]
end