listen 3.0.8 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f18e337415a04b4714aa6a4b52bbf21a7c8a3d01
4
- data.tar.gz: e70d968dd1f9d350a35d319bd932c521d15e0b75
3
+ metadata.gz: d04237309b5073d900c70a81c8541f2531788404
4
+ data.tar.gz: 5836d56ad7c14047b7839f800c4bcced1c873dbb
5
5
  SHA512:
6
- metadata.gz: 3a84d19f4ecc7131d6ccfddf937c77f8d05b786a4b84d05bbf0808efd16d3066ecff5b2d25c511b3ac7fe70d73ad208f748a1236edc92ccb7bd8ec9f82b832b0
7
- data.tar.gz: 5bbab04e17fa7e957343cad614936a59ea822af8e4a77657317b40a854f6fa3b8c0b2c26e7480b3fcd8e71129cdcdc0e66219c412a9e27f94e66df04b4792fc9
6
+ metadata.gz: f6ec5d3c5fcde2494c9ffff5c3f74bcb7b6173839907e375e91cd52c216d4876af9fe4bfb24d217d900af69f30c752ee760d65b707b2586a06463c1e67a4040e
7
+ data.tar.gz: b2e7d18eeabc1fd755684eea761caa67ab7054756fdeb00109af89fc0afee507dcc71f6ebfb90753b2d1ab27f4a3ead7b7447543c7abd5834fd2ddf0df011725
data/README.md CHANGED
@@ -13,7 +13,7 @@ The Listen gem listens to file modifications and notifies you about the changes.
13
13
  * You can watch multiple directories.
14
14
  * Regexp-patterns for ignoring paths for more accuracy and speed
15
15
  * Increased change detection accuracy on OS X HFS and VFAT volumes.
16
- * Tested on MRI Ruby environments (2.0+ only) via [Travis CI](https://travis-ci.org/guard/listen),
16
+ * Tested on MRI Ruby environments (2.2+ only) via [Travis CI](https://travis-ci.org/guard/listen),
17
17
 
18
18
  ## Issues / limitations
19
19
 
@@ -27,7 +27,7 @@ The Listen gem listens to file modifications and notifies you about the changes.
27
27
  * Specs suite on JRuby and Rubinius aren't reliable on Travis CI, but should work.
28
28
  * Windows and \*BSD adapter aren't continuously and automatically tested.
29
29
  * OSX adapter has some performance limitations ([#342](https://github.com/guard/listen/issues/342)).
30
- * Ruby 1.9.3 is no longer maintained (and may not work with Listen) - it's best to upgrade to Ruby 2.2.2.
30
+ * Ruby < 2.2.x is no longer supported - upgrade to Ruby 2.2 or 2.3
31
31
 
32
32
  Pull requests or help is very welcome for these.
33
33
 
data/lib/listen.rb CHANGED
@@ -45,10 +45,7 @@ module Listen
45
45
  @listeners ||= []
46
46
 
47
47
  # TODO: should use a mutex for this
48
- @listeners.each do |listener|
49
- # call stop to halt the main loop
50
- listener.stop
51
- end
48
+ @listeners.each(&:stop)
52
49
  @listeners = nil
53
50
  end
54
51
  end
@@ -7,37 +7,39 @@ require 'listen/adapter/windows'
7
7
 
8
8
  module Listen
9
9
  module Adapter
10
- OPTIMIZED_ADAPTERS = [Darwin, Linux, BSD, Windows]
10
+ OPTIMIZED_ADAPTERS = [Darwin, Linux, BSD, Windows].freeze
11
11
  POLLING_FALLBACK_MESSAGE = 'Listen will be polling for changes.'\
12
- 'Learn more at https://github.com/guard/listen#listen-adapters.'
12
+ 'Learn more at https://github.com/guard/listen#listen-adapters.'.freeze
13
13
 
14
- def self.select(options = {})
15
- _log :debug, 'Adapter: considering polling ...'
16
- return Polling if options[:force_polling]
17
- _log :debug, 'Adapter: considering optimized backend...'
18
- return _usable_adapter_class if _usable_adapter_class
19
- _log :debug, 'Adapter: falling back to polling...'
20
- _warn_polling_fallback(options)
21
- Polling
22
- rescue
23
- _log :warn, format('Adapter: failed: %s:%s', $ERROR_POSITION.inspect,
24
- $ERROR_POSITION * "\n")
25
- raise
26
- end
14
+ class << self
15
+ def select(options = {})
16
+ _log :debug, 'Adapter: considering polling ...'
17
+ return Polling if options[:force_polling]
18
+ _log :debug, 'Adapter: considering optimized backend...'
19
+ return _usable_adapter_class if _usable_adapter_class
20
+ _log :debug, 'Adapter: falling back to polling...'
21
+ _warn_polling_fallback(options)
22
+ Polling
23
+ rescue
24
+ _log :warn, format('Adapter: failed: %s:%s', $ERROR_POSITION.inspect,
25
+ $ERROR_POSITION * "\n")
26
+ raise
27
+ end
27
28
 
28
- private
29
+ private
29
30
 
30
- def self._usable_adapter_class
31
- OPTIMIZED_ADAPTERS.detect(&:usable?)
32
- end
31
+ def _usable_adapter_class
32
+ OPTIMIZED_ADAPTERS.detect(&:usable?)
33
+ end
33
34
 
34
- def self._warn_polling_fallback(options)
35
- msg = options.fetch(:polling_fallback_message, POLLING_FALLBACK_MESSAGE)
36
- Kernel.warn "[Listen warning]:\n #{msg}" if msg
37
- end
35
+ def _warn_polling_fallback(options)
36
+ msg = options.fetch(:polling_fallback_message, POLLING_FALLBACK_MESSAGE)
37
+ Kernel.warn "[Listen warning]:\n #{msg}" if msg
38
+ end
38
39
 
39
- def self._log(type, message)
40
- Listen::Logger.send(type, message)
40
+ def _log(type, message)
41
+ Listen::Logger.send(type, message)
42
+ end
41
43
  end
42
44
  end
43
45
  end
@@ -8,7 +8,7 @@ module Listen
8
8
  attr_reader :options
9
9
 
10
10
  # TODO: only used by tests
11
- DEFAULTS = {}
11
+ DEFAULTS = {}.freeze
12
12
 
13
13
  attr_reader :config
14
14
 
@@ -129,8 +129,12 @@ module Listen
129
129
  _log(:error, formatted)
130
130
  end
131
131
 
132
- def self._log(*args, &block)
133
- Listen::Logger.send(*args, &block)
132
+ class << self
133
+ private
134
+
135
+ def _log(*args, &block)
136
+ Listen::Logger.send(*args, &block)
137
+ end
134
138
  end
135
139
  end
136
140
  end
@@ -16,7 +16,7 @@ module Listen
16
16
  :rename
17
17
  # :link, :revoke
18
18
  ]
19
- }
19
+ }.freeze
20
20
 
21
21
  BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '')
22
22
  Please add the following to your Gemfile to avoid polling for changes:
@@ -38,9 +38,9 @@ module Listen
38
38
 
39
39
  private
40
40
 
41
- def _configure(directory, &_callback)
41
+ def _configure(directory, &callback)
42
42
  @worker ||= KQueue::Queue.new
43
- @callback = _callback
43
+ @callback = callback
44
44
  # use Record to make a snapshot of dir, so we
45
45
  # can detect new files
46
46
  _find(directory.to_s) { |path| _watch_file(path, @worker) }
@@ -11,7 +11,7 @@ module Listen
11
11
  def initialize(directories, queue, silencer, adapter_options)
12
12
  # Default to current directory if no directories are supplied
13
13
  directories = [Dir.pwd] if directories.to_a.empty?
14
-
14
+
15
15
  # TODO: fix (flatten, array, compact?)
16
16
  @directories = directories.map do |directory|
17
17
  Pathname.new(directory.to_s).realpath
@@ -9,7 +9,7 @@ module Listen
9
9
  OS_REGEXP = /darwin(?<major_version>1\d+)/i
10
10
 
11
11
  # The default delay between checking for changes.
12
- DEFAULTS = { latency: 0.1 }
12
+ DEFAULTS = { latency: 0.1 }.freeze
13
13
 
14
14
  INCOMPATIBLE_GEM_VERSION = <<-EOS.gsub(/^ {8}/, '')
15
15
  rb-fsevent > 0.9.4 no longer supports OS X 10.6 through 10.8.
@@ -23,9 +23,12 @@ module Listen
23
23
 
24
24
  def self.usable?
25
25
  require 'rb-fsevent'
26
- darwin_version = RbConfig::CONFIG['target_os'][OS_REGEXP, :major_version] or return false
27
- return true if darwin_version.to_i >= 13 # darwin13 is OS X 10.9
28
- return true if Gem::Version.new(FSEvent::VERSION) <= Gem::Version.new('0.9.4')
26
+ version = RbConfig::CONFIG['target_os'][OS_REGEXP, :major_version]
27
+ return false unless version
28
+ return true if version.to_i >= 13 # darwin13 is OS X 10.9
29
+
30
+ fsevent_version = Gem::Version.new(FSEvent::VERSION)
31
+ return true if fsevent_version <= Gem::Version.new('0.9.4')
29
32
  Kernel.warn INCOMPATIBLE_GEM_VERSION
30
33
  false
31
34
  end
@@ -55,7 +58,7 @@ module Listen
55
58
  def _process_event(dir, event)
56
59
  _log :debug, "fsevent: processing event: #{event.inspect}"
57
60
  event.each do |path|
58
- new_path = Pathname.new(path.sub(/\/$/, ''))
61
+ new_path = Pathname.new(path.sub(%r{\/$}, ''))
59
62
  _log :debug, "fsevent: #{new_path}"
60
63
  # TODO: does this preserve symlinks?
61
64
  rel_path = new_path.relative_path_from(dir).to_s
@@ -67,7 +70,8 @@ module Listen
67
70
  _log :debug, "fsevent: running worker: #{worker.inspect}"
68
71
  worker.run
69
72
  rescue
70
- _log_exception 'fsevent: running worker failed: %s:%s called from: %s', caller
73
+ format_string = 'fsevent: running worker failed: %s:%s called from: %s'
74
+ _log_exception format_string, caller
71
75
  end
72
76
 
73
77
  def _run_workers_in_background(workers)
@@ -14,12 +14,12 @@ module Listen
14
14
  :close_write
15
15
  ],
16
16
  wait_for_delay: 0.1
17
- }
17
+ }.freeze
18
18
 
19
19
  private
20
20
 
21
21
  WIKI_URL = 'https://github.com/guard/listen'\
22
- '/wiki/Increasing-the-amount-of-inotify-watchers'
22
+ '/wiki/Increasing-the-amount-of-inotify-watchers'.freeze
23
23
 
24
24
  INOTIFY_LIMIT_MESSAGE = <<-EOS.gsub(/^\s*/, '')
25
25
  FATAL: Listen error: unable to monitor directories for changes.
@@ -35,9 +35,7 @@ module Listen
35
35
  end
36
36
 
37
37
  def _run
38
- Thread.current[:listen_blocking_read_thread] = true
39
38
  @worker.run
40
- Thread.current[:listen_blocking_read_thread] = false
41
39
  end
42
40
 
43
41
  def _process_event(dir, event)
@@ -52,10 +50,8 @@ module Listen
52
50
  if /1|true/ =~ ENV['LISTEN_GEM_SIMULATE_FSEVENT']
53
51
  if (event.flags & [:moved_to, :moved_from]) || _dir_event?(event)
54
52
  rel_path = path.dirname.relative_path_from(dir).to_s
55
- _queue_change(:dir, dir, rel_path, {})
56
- else
57
- _queue_change(:dir, dir, rel_path, {})
58
53
  end
54
+ _queue_change(:dir, dir, rel_path, {})
59
55
  return
60
56
  end
61
57
 
@@ -101,7 +97,7 @@ module Listen
101
97
  end
102
98
 
103
99
  def _stop
104
- @worker && @worker.close
100
+ @worker.close
105
101
  end
106
102
  end
107
103
  end
@@ -8,7 +8,7 @@ module Listen
8
8
  class Polling < Base
9
9
  OS_REGEXP = // # match every OS
10
10
 
11
- DEFAULTS = { latency: 1.0, wait_for_delay: 0.05 }
11
+ DEFAULTS = { latency: 1.0, wait_for_delay: 0.05 }.freeze
12
12
 
13
13
  private
14
14
 
@@ -24,21 +24,21 @@ module Listen
24
24
 
25
25
  private
26
26
 
27
- def _configure(dir, &callback)
27
+ def _configure(dir)
28
28
  require 'wdm'
29
29
  _log :debug, 'wdm - starting...'
30
30
  @worker ||= WDM::Monitor.new
31
31
  @worker.watch_recursively(dir.to_s, :files) do |change|
32
- callback.call([:file, change])
32
+ yield([:file, change])
33
33
  end
34
34
 
35
35
  @worker.watch_recursively(dir.to_s, :directories) do |change|
36
- callback.call([:dir, change])
36
+ yield([:dir, change])
37
37
  end
38
38
 
39
39
  events = [:attributes, :last_write]
40
40
  @worker.watch_recursively(dir.to_s, *events) do |change|
41
- callback.call([:attr, change])
41
+ yield([:attr, change])
42
42
  end
43
43
  end
44
44
 
@@ -70,7 +70,6 @@ module Listen
70
70
  _queue_change(:dir, dir, Pathname(rel_path).dirname.to_s, {})
71
71
  elsif change.type == :added
72
72
  _queue_change(:dir, dir, rel_path, {})
73
- else
74
73
  # do nothing - changed directory means either:
75
74
  # - removed subdirs (handled above)
76
75
  # - added subdirs (handled above)
@@ -81,7 +80,7 @@ module Listen
81
80
  end
82
81
  rescue
83
82
  details = event.inspect
84
- _log :error, format('wdm - callback (%): %s:%s', details, $ERROR_INFO,
83
+ _log :error, format('wdm - callback (%s): %s:%s', details, $ERROR_INFO,
85
84
  $ERROR_POSITION * "\n")
86
85
  raise
87
86
  end
@@ -2,12 +2,12 @@ require 'listen/adapter'
2
2
  require 'listen/adapter/base'
3
3
  require 'listen/adapter/config'
4
4
 
5
- require 'forwardable'
6
-
7
5
  # This class just aggregates configuration object to avoid Listener specs
8
6
  # from exploding with huge test setup blocks
9
7
  module Listen
10
8
  class Backend
9
+ extend Forwardable
10
+
11
11
  def initialize(directories, queue, silencer, config)
12
12
  adapter_select_opts = config.adapter_select_options
13
13
 
@@ -24,17 +24,10 @@ module Listen
24
24
  @adapter = adapter_class.new(aconfig)
25
25
  end
26
26
 
27
- def start
28
- adapter.start
29
- end
30
-
31
- def stop
32
- adapter.stop
33
- end
27
+ delegate start: :adapter
28
+ delegate stop: :adapter
34
29
 
35
- def min_delay_between_events
36
- @min_delay_between_events
37
- end
30
+ attr_reader :min_delay_between_events
38
31
 
39
32
  private
40
33
 
data/lib/listen/change.rb CHANGED
@@ -35,7 +35,7 @@ module Listen
35
35
  cookie = options[:cookie]
36
36
 
37
37
  if !cookie && config.silenced?(rel_path, type)
38
- Listen::Logger.debug { "(silenced): #{rel_path.inspect}" }
38
+ Listen::Logger.debug { "(silenced): #{rel_path.inspect}" }
39
39
  return
40
40
  end
41
41
 
@@ -49,16 +49,14 @@ module Listen
49
49
  if change
50
50
  options = cookie ? { cookie: cookie } : {}
51
51
  config.queue(type, change, watched_dir, rel_path, options)
52
+ elsif type == :dir
53
+ # NOTE: POSSIBLE RECURSION
54
+ # TODO: fix - use a queue instead
55
+ Directory.scan(self, rel_path, options)
52
56
  else
53
- if type == :dir
54
- # NOTE: POSSIBLE RECURSION
55
- # TODO: fix - use a queue instead
56
- Directory.scan(self, rel_path, options)
57
- else
58
- change = File.change(record, rel_path)
59
- return if !change || options[:silence]
60
- config.queue(:file, change, watched_dir, rel_path)
61
- end
57
+ change = File.change(record, rel_path)
58
+ return if !change || options[:silence]
59
+ config.queue(:file, change, watched_dir, rel_path)
62
60
  end
63
61
  rescue RuntimeError => ex
64
62
  msg = format(
@@ -12,7 +12,7 @@ module Listen
12
12
 
13
13
  # TODO: use children(with_directory: false)
14
14
  path = dir + rel_path
15
- current = Set.new(_children(path))
15
+ current = Set.new(path.children)
16
16
 
17
17
  Listen::Logger.debug do
18
18
  format('%s: %s(%s): %s -> %s',
@@ -28,7 +28,7 @@ module Listen
28
28
  end
29
29
  rescue Errno::ENOENT
30
30
  # The directory changed meanwhile, so rescan it
31
- current = Set.new(_children(path))
31
+ current = Set.new(path.children)
32
32
  retry
33
33
  end
34
34
 
@@ -72,16 +72,5 @@ module Listen
72
72
  opts.delete(:recursive)
73
73
  snapshot.invalidate(type, path, opts)
74
74
  end
75
-
76
- def self._children(path)
77
- return path.children unless RUBY_ENGINE == 'jruby'
78
-
79
- # JRuby inconsistency workaround, see:
80
- # https://github.com/jruby/jruby/issues/3840
81
- exists = path.exist?
82
- directory = path.directory?
83
- return path.children unless (exists && !directory)
84
- raise Errno::ENOTDIR, path.to_s
85
- end
86
75
  end
87
76
  end
@@ -27,9 +27,7 @@ module Listen
27
27
  Time.now.to_f
28
28
  end
29
29
 
30
- def event_queue
31
- @event_queue
32
- end
30
+ attr_reader :event_queue
33
31
 
34
32
  def callable?
35
33
  @block
@@ -39,9 +37,7 @@ module Listen
39
37
  @queue_optimizer.smoosh_changes(changes)
40
38
  end
41
39
 
42
- def min_delay_between_events
43
- @min_delay_between_events
44
- end
40
+ attr_reader :min_delay_between_events
45
41
 
46
42
  def stopped?
47
43
  listener.state == :stopped
@@ -1,10 +1,10 @@
1
1
  require 'thread'
2
2
 
3
- require 'forwardable'
4
-
5
3
  module Listen
6
4
  module Event
7
5
  class Queue
6
+ extend Forwardable
7
+
8
8
  class Config
9
9
  def initialize(relative)
10
10
  @relative = relative
@@ -33,13 +33,8 @@ module Listen
33
33
  block.call(args) if block
34
34
  end
35
35
 
36
- def empty?
37
- event_queue.empty?
38
- end
39
-
40
- def pop
41
- event_queue.pop
42
- end
36
+ delegate empty?: :event_queue
37
+ delegate pop: :event_queue
43
38
 
44
39
  private
45
40
 
data/lib/listen/file.rb CHANGED
@@ -26,7 +26,7 @@ module Listen
26
26
  end
27
27
 
28
28
  return if /1|true/ =~ ENV['LISTEN_GEM_DISABLE_HASHING']
29
- return unless self.inaccurate_mac_time?(lstat)
29
+ return unless inaccurate_mac_time?(lstat)
30
30
 
31
31
  # Check if change happened within 1 second (maybe it's even
32
32
  # too much, e.g. 0.3-0.5 could be sufficient).
data/lib/listen/fsm.rb CHANGED
@@ -111,7 +111,8 @@ module Listen
111
111
  attr_reader :name, :transitions
112
112
 
113
113
  def initialize(name, transitions = nil, &block)
114
- @name, @block = name, block
114
+ @name = name
115
+ @block = block
115
116
  @transitions = nil
116
117
  @transitions = Array(transitions).map(&:to_sym) if transitions
117
118
  end
@@ -13,16 +13,8 @@ module Listen
13
13
  return if @threads.empty? # return to avoid using possibly stubbed Queue
14
14
 
15
15
  killed = Queue.new
16
- # You can't kill a read on a descriptor in JRuby, so let's just
17
- # ignore running threads (listen rb-inotify waiting for disk activity
18
- # before closing) pray threads die faster than they are created...
19
- limit = RUBY_ENGINE == 'jruby' ? [1] : []
20
-
21
16
  killed << @threads.pop.kill until @threads.empty?
22
- until killed.empty?
23
- th = killed.pop
24
- th.join(*limit) unless th[:listen_blocking_read_thread]
25
- end
17
+ killed.pop.join until killed.empty?
26
18
  end
27
19
  end
28
20
  end
@@ -61,13 +61,13 @@ module Listen
61
61
 
62
62
  default_state :initializing
63
63
 
64
- state :initializing, to: [:backend_started, :stopped]
64
+ state :initializing, to: :backend_started
65
65
 
66
- state :backend_started, to: [:frontend_ready, :stopped] do
66
+ state :backend_started, to: [:frontend_ready] do
67
67
  backend.start
68
68
  end
69
69
 
70
- state :frontend_ready, to: [:processing_events, :stopped] do
70
+ state :frontend_ready, to: [:processing_events] do
71
71
  processor.setup
72
72
  end
73
73
 
@@ -10,7 +10,7 @@ module Listen
10
10
  # Backend selecting options
11
11
  force_polling: false,
12
12
  polling_fallback_message: nil
13
- }
13
+ }.freeze
14
14
 
15
15
  def initialize(opts)
16
16
  @options = DEFAULTS.merge(opts)
@@ -23,13 +23,9 @@ module Listen
23
23
  @relative
24
24
  end
25
25
 
26
- def min_delay_between_events
27
- @min_delay_between_events
28
- end
26
+ attr_reader :min_delay_between_events
29
27
 
30
- def silencer_rules
31
- @silencer_rules
32
- end
28
+ attr_reader :silencer_rules
33
29
 
34
30
  def adapter_instance_options(klass)
35
31
  valid_keys = klass.const_get('DEFAULTS').keys
@@ -88,7 +88,7 @@ module Listen
88
88
  # editor rename() call (e.g. Kate and Sublime)
89
89
  def _reinterpret_related_changes(cookies)
90
90
  table = { moved_to: :added, moved_from: :removed }
91
- cookies.map do |_, changes|
91
+ cookies.flat_map do |_, changes|
92
92
  data = _detect_possible_editor_save(changes)
93
93
  if data
94
94
  to_dir, to_file = data
@@ -101,7 +101,7 @@ module Listen
101
101
  [table.fetch(change, change), dir, path]
102
102
  end
103
103
  end
104
- end.flatten(1)
104
+ end
105
105
  end
106
106
 
107
107
  def _detect_possible_editor_save(changes)
@@ -113,9 +113,9 @@ module Listen
113
113
  changes.each do |data|
114
114
  case data[1]
115
115
  when :moved_from
116
- from_type, from_change, _, from, _ = data
116
+ from_type, from_change, _, from, = data
117
117
  when :moved_to
118
- to_type, to_change, to_dir, to, _ = data
118
+ to_type, to_change, to_dir, to, = data
119
119
  else
120
120
  return nil
121
121
  end
data/lib/listen/record.rb CHANGED
@@ -74,9 +74,7 @@ module Listen
74
74
  Hash.new { |h, k| h[k] = Hash.new }
75
75
  end
76
76
 
77
- def tree
78
- @tree
79
- end
77
+ attr_reader :tree
80
78
 
81
79
  def _fast_update_file(dirname, basename, data)
82
80
  if [nil, '', '.'].include? dirname
@@ -6,14 +6,16 @@ module Listen
6
6
  # file: "/home/me/watched_dir", "app/models", "foo.rb"
7
7
  # dir, "/home/me/watched_dir", "."
8
8
  def initialize(root, relative, name = nil)
9
- @root, @relative, @name = root, relative, name
9
+ @root = root
10
+ @relative = relative
11
+ @name = name
10
12
  end
11
13
 
12
14
  attr_reader :root, :relative, :name
13
15
 
14
16
  def children
15
17
  child_relative = _join
16
- (_entries(sys_path) - %w(. ..)).map do |name|
18
+ (Dir.entries(sys_path) - %w(. ..)).map do |name|
17
19
  Entry.new(@root, child_relative, name)
18
20
  end
19
21
  end
@@ -46,17 +48,6 @@ module Listen
46
48
  args = [@relative, @name].compact
47
49
  args.empty? ? nil : ::File.join(*args)
48
50
  end
49
-
50
- def _entries(dir)
51
- return Dir.entries(dir) unless RUBY_ENGINE == 'jruby'
52
-
53
- # JRuby inconsistency workaround, see:
54
- # https://github.com/jruby/jruby/issues/3840
55
- exists = ::File.exist?(dir)
56
- directory = ::File.directory?(dir)
57
- return Dir.entries(dir) unless (exists && !directory)
58
- raise Errno::ENOTDIR, dir
59
- end
60
51
  end
61
52
  end
62
53
  end
@@ -4,9 +4,9 @@ module Listen
4
4
  # @private api
5
5
  class Record
6
6
  class SymlinkDetector
7
- WIKI = 'https://github.com/guard/listen/wiki/Duplicate-directory-errors'
7
+ WIKI = 'https://github.com/guard/listen/wiki/Duplicate-directory-errors'.freeze
8
8
 
9
- SYMLINK_LOOP_ERROR = <<-EOS
9
+ SYMLINK_LOOP_ERROR = <<-EOS.freeze
10
10
  ** ERROR: directory is already being watched! **
11
11
 
12
12
  Directory: %s
@@ -15,7 +15,7 @@ module Listen
15
15
  )(/|$)}x
16
16
 
17
17
  # The default list of files that get ignored.
18
- DEFAULT_IGNORED_EXTENSIONS = /(?:
18
+ DEFAULT_IGNORED_EXTENSIONS = %r{(?:
19
19
  # Kate's tmp\/swp files
20
20
  \..*\d+\.new
21
21
  | \.kate-swp
@@ -50,7 +50,7 @@ module Listen
50
50
  | \.DS_Store
51
51
  | \.tmp
52
52
  | ~
53
- )$/x
53
+ )$}x
54
54
 
55
55
  attr_accessor :only_patterns, :ignore_patterns
56
56
 
@@ -1,3 +1,3 @@
1
1
  module Listen
2
- VERSION = '3.0.8'
2
+ VERSION = '3.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,42 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: listen
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.8
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibaud Guillaume-Gentil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-18 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb-fsevent
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.9'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: 0.9.4
19
+ version: 0.9.3
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '0.9'
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
- version: 0.9.4
26
+ version: 0.9.3
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: rb-inotify
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '0.9'
40
31
  - - ">="
41
32
  - !ruby/object:Gem::Version
42
33
  version: 0.9.7
@@ -44,9 +35,6 @@ dependencies:
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '0.9'
50
38
  - - ">="
51
39
  - !ruby/object:Gem::Version
52
40
  version: 0.9.7
@@ -118,9 +106,9 @@ require_paths:
118
106
  - lib
119
107
  required_ruby_version: !ruby/object:Gem::Requirement
120
108
  requirements:
121
- - - ">="
109
+ - - "~>"
122
110
  - !ruby/object:Gem::Version
123
- version: 1.9.3
111
+ version: '2.2'
124
112
  required_rubygems_version: !ruby/object:Gem::Requirement
125
113
  requirements:
126
114
  - - ">="
@@ -128,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
116
  version: '0'
129
117
  requirements: []
130
118
  rubyforge_project:
131
- rubygems_version: 2.5.1
119
+ rubygems_version: 2.4.8
132
120
  signing_key:
133
121
  specification_version: 4
134
122
  summary: Listen to file modifications