Sha256: d191a4d5fd6de458febef96bee7e98d4993ffa327d5e2b32d0abc255eceb21bf

Contents?: true

Size: 833 Bytes

Versions: 17

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

class ThinkingSphinx::Hooks::GuardPresence
  def self.call(configuration = nil, stream = STDERR)
    new(configuration, stream).call
  end

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

  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

  attr_reader :configuration, :stream

  def files
    @files ||= Dir["#{configuration.indices_location}/ts-*.tmp"]
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-5.5.1 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-5.5.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-5.4.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-5.3.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-5.2.1 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-5.2.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-5.1.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-5.0.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-4.4.1 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-4.4.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-4.3.2 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-4.3.1 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-4.3.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-4.2.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-4.1.0 lib/thinking_sphinx/hooks/guard_presence.rb
thinking-sphinx-4.0.0 lib/thinking_sphinx/hooks/guard_presence.rb