Class: ThinkingSphinx::Hooks::GuardPresence

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/hooks/guard_presence.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration = nil, stream = STDERR) ⇒ GuardPresence

Returns a new instance of GuardPresence.



8
9
10
11
# File 'lib/thinking_sphinx/hooks/guard_presence.rb', line 8

def initialize(configuration = nil, stream = STDERR)
  @configuration = configuration || ThinkingSphinx::Configuration.instance
  @stream        = stream
end

Class Method Details

.call(configuration = nil, stream = STDERR) ⇒ Object



4
5
6
# File 'lib/thinking_sphinx/hooks/guard_presence.rb', line 4

def self.call(configuration = nil, stream = STDERR)
  new(configuration, stream).call
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# 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