Sha256: 35e6f2588aa6e5117fb1acd929ad847894b532ef018a437b8f0c6ba1da533247

Contents?: true

Size: 411 Bytes

Versions: 14

Compression:

Stored size: 411 Bytes

Contents

# frozen_string_literal: true

class ThinkingSphinx::Guard::File
  attr_reader :name

  def initialize(name)
    @name = name
  end

  def lock
    FileUtils.touch path
  end

  def locked?
    File.exists? path
  end

  def path
    @path ||= File.join(
      ThinkingSphinx::Configuration.instance.indices_location,
      "ts-#{name}.tmp"
    )
  end

  def unlock
    FileUtils.rm(path) if locked?
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
thinking-sphinx-5.4.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-5.3.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-5.2.1 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-5.2.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-5.1.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-5.0.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-4.4.1 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-4.4.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-4.3.2 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-4.3.1 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-4.3.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-4.2.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-4.1.0 lib/thinking_sphinx/guard/file.rb
thinking-sphinx-4.0.0 lib/thinking_sphinx/guard/file.rb