Sha256: 428a9f0454894d9688491d0e928c509aea7ab8072799f75ce7e974e7b0ee6149

Contents?: true

Size: 826 Bytes

Versions: 20

Compression:

Stored size: 826 Bytes

Contents

require 'set'

module Listen
  # @private api
  class Record
    class SymlinkDetector
      WIKI = 'https://github.com/guard/listen/wiki/Duplicate-directory-errors'

      SYMLINK_LOOP_ERROR = <<-EOS
        ** ERROR: directory is already being watched! **

        Directory: %s

        is already begin watched through: %s

        MORE INFO: #{WIKI}
      EOS

      class Error < RuntimeError
      end

      def initialize
        @real_dirs = Set.new
      end

      def verify_unwatched!(entry)
        real_path = entry.real_path
        @real_dirs.add?(real_path) || _fail(entry.sys_path, real_path)
      end

      private

      def _fail(symlinked, real_path)
        STDERR.puts format(SYMLINK_LOOP_ERROR, symlinked, real_path)
        fail Error, 'Failed due to looped symlinks'
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
listen-3.0.4 lib/listen/record/symlink_detector.rb
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/listen-3.0.3/lib/listen/record/symlink_detector.rb
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/listen-3.0.3/lib/listen/record/symlink_detector.rb
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/listen-3.0.3/lib/listen/record/symlink_detector.rb
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/listen-3.0.3/lib/listen/record/symlink_detector.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/listen-3.0.3/lib/listen/record/symlink_detector.rb
geminfo-0.1.0 path/gems/listen-3.0.3/lib/listen/record/symlink_detector.rb
listen-3.0.3 lib/listen/record/symlink_detector.rb
listen-3.0.2 lib/listen/record/symlink_detector.rb
listen-3.0.1 lib/listen/record/symlink_detector.rb
listen-3.0.0 lib/listen/record/symlink_detector.rb
listen-2.10.1 lib/listen/record/symlink_detector.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/listen-2.8.6/lib/listen/record/symlink_detector.rb
listen-2.10.0 lib/listen/record/symlink_detector.rb
listen-2.9.0 lib/listen/record/symlink_detector.rb
listen-2.8.6 lib/listen/record/symlink_detector.rb
listen-2.8.5 lib/listen/record/symlink_detector.rb
listen-2.8.4 lib/listen/record/symlink_detector.rb
listen-2.8.3 lib/listen/record/symlink_detector.rb
listen-2.8.2 lib/listen/record/symlink_detector.rb