listen 3.4.0 → 3.4.1

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
  SHA256:
3
- metadata.gz: 393d712be43ee070ac7d14a4ddc090176c7f388ae2f2a7e447f674fc8875f27f
4
- data.tar.gz: b4dfff00d893121350cb41362425a52ae4c78af20431b0567071a381d9216786
3
+ metadata.gz: 177b9383bf2b074aa676e65740451122818a165210268172b091a5528054dcde
4
+ data.tar.gz: cf3e77517acd2ce09a140c34a7349eedad081d4b4bc8e0f4e80cefd35ce9363f
5
5
  SHA512:
6
- metadata.gz: 7c7e46108e8cc30fc15289e12bedf0866ea6ef41a6798f701e16f265205ffee95a23b4526b098ae26ac910c942084d34280de31878e696e93f4d14a8f674c3ec
7
- data.tar.gz: 3edd0902f5833038beb0b8e33b4f6f4933bea1659d51b68dbbc9a5abc63bf3ee3edd25a56309d16cd6acffead3e3be05f6ebc4d2895c893e70baff941015fcc1
6
+ metadata.gz: c2d73e033027eb1f2fa455a180e7abbf344bb2889ad9af7b1d79a111d55c00b4f8481c080c94ca06d8383da6ef45481e47434a25b03aba75c74839b37bf4e8b4
7
+ data.tar.gz: 30c3da7656d66f93ac25fc4202ef15bb813fdb6c4a7c90221ecdd49f32b267826082c4af20275454f0ada71e790ef5ac5ea20275302c66de5dedc36dc3bcb05d
@@ -4,7 +4,7 @@ Contribute to Listen
4
4
  File an issue
5
5
  -------------
6
6
 
7
- If you haven't already, first see [TROUBLESHOOTING](https://github.com/guard/listen/wiki/Troubleshooting) for known issues, solutions and workarounds.
7
+ If you haven't already, first see [TROUBLESHOOTING](https://github.com/guard/listen/blob/master/README.md#Issues-and-Troubleshooting) for known issues, solutions and workarounds.
8
8
 
9
9
  You can report bugs and feature requests to [GitHub Issues](https://github.com/guard/listen/issues).
10
10
 
@@ -16,7 +16,7 @@ Try to figure out where the issue belongs to: Is it an issue with Listen itself
16
16
 
17
17
  **It's most likely that your bug gets resolved faster if you provide as much information as possible!**
18
18
 
19
- The MOST useful information is debugging output from Listen (`LISTEN_GEM_DEBUGGING=1`) - see [TROUBLESHOOTING](https://github.com/guard/listen/wiki/Troubleshooting) for details.
19
+ The MOST useful information is debugging output from Listen (`LISTEN_GEM_DEBUGGING=1`) - see [TROUBLESHOOTING](https://github.com/guard/listen/blob/master/README.md#Issues-and-Troubleshooting) for details.
20
20
 
21
21
 
22
22
  Development
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  The `listen` gem listens to file modifications and notifies you about the changes.
4
4
 
5
- :exclamation: `Listen` is currently accepting more maintainers. Please [read this](https://github.com/guard/guard/wiki/Maintainers) if you're interested in joining the team.
6
-
7
5
  [![Development Status](https://github.com/guard/listen/workflows/Development/badge.svg)](https://github.com/guard/listen/actions?workflow=Development)
8
6
  [![Gem Version](https://badge.fury.io/rb/listen.svg)](http://badge.fury.io/rb/listen)
9
7
  [![Code Climate](https://codeclimate.com/github/guard/listen.svg)](https://codeclimate.com/github/guard/listen)
@@ -21,12 +21,12 @@ module Listen
21
21
 
22
22
  private
23
23
 
24
- WIKI_URL = 'https://github.com/guard/listen'\
24
+ README_URL = 'https://github.com/guard/listen'\
25
25
  '/blob/master/README.md#increasing-the-amount-of-inotify-watchers'
26
26
 
27
- INOTIFY_LIMIT_MESSAGE = <<-EOS.gsub(/^\s*/, '')
27
+ INOTIFY_LIMIT_MESSAGE = <<-EOS
28
28
  FATAL: Listen error: unable to monitor directories for changes.
29
- Visit #{WIKI_URL} for info on how to fix this.
29
+ Visit #{README_URL} for info on how to fix this.
30
30
  EOS
31
31
 
32
32
  def _configure(directory, &callback)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Besides programming error exceptions like ArgumentError,
4
+ # all public interface exceptions should be declared here and inherit from Listen::Error.
5
+ module Listen
6
+ class Error < RuntimeError
7
+ class NotStarted < Error; end
8
+ class SymlinkLoop < Error; end
9
+ end
10
+ end
@@ -5,15 +5,15 @@ require 'thread'
5
5
  require 'timeout'
6
6
  require 'listen/event/processor'
7
7
  require 'listen/thread'
8
+ require 'listen/error'
8
9
 
9
10
  module Listen
10
11
  module Event
11
12
  class Loop
12
13
  include Listen::FSM
13
14
 
14
- class Error < RuntimeError
15
- class NotStarted < Error; end
16
- end
15
+ Error = ::Listen::Error
16
+ NotStarted = ::Listen::Error::NotStarted # for backward compatibility
17
17
 
18
18
  start_state :pre_start
19
19
  state :pre_start
@@ -40,6 +40,7 @@ module Listen
40
40
 
41
41
  MAX_STARTUP_SECONDS = 5.0
42
42
 
43
+ # @raises Error::NotStarted if background thread hasn't started in MAX_STARTUP_SECONDS
43
44
  def start
44
45
  # TODO: use a Fiber instead?
45
46
  return unless state == :pre_start
@@ -52,7 +53,7 @@ module Listen
52
53
 
53
54
  Listen.logger.debug("Waiting for processing to start...")
54
55
 
55
- wait_for_state(:started, MAX_STARTUP_SECONDS) or
56
+ wait_for_state(:started, timeout: MAX_STARTUP_SECONDS) or
56
57
  raise Error::NotStarted, "thread didn't start in #{MAX_STARTUP_SECONDS} seconds (in state: #{state.inspect})"
57
58
 
58
59
  Listen.logger.debug('Processing started.')
@@ -53,6 +53,9 @@ module Listen
53
53
  # if not already, waits for a state change (up to timeout seconds--`nil` means infinite)
54
54
  # returns truthy iff the transition to one of the desired state has occurred
55
55
  def wait_for_state(*wait_for_states, timeout: nil)
56
+ wait_for_states.each do |state|
57
+ state.is_a?(Symbol) or raise ArgumentError, "states must be symbols (got #{state.inspect})"
58
+ end
56
59
  @mutex.synchronize do
57
60
  if !wait_for_states.include?(@state)
58
61
  @state_changed.wait(@mutex, timeout)
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'set'
4
+ require 'listen/error'
4
5
 
5
6
  module Listen
6
7
  # @private api
7
8
  class Record
8
9
  class SymlinkDetector
9
- WIKI = 'https://github.com/guard/listen/wiki/Duplicate-directory-errors'
10
+ README_URL = 'https://github.com/guard/listen/blob/master/README.md'
10
11
 
11
12
  SYMLINK_LOOP_ERROR = <<-EOS
12
13
  ** ERROR: directory is already being watched! **
@@ -15,11 +16,10 @@ module Listen
15
16
 
16
17
  is already being watched through: %s
17
18
 
18
- MORE INFO: #{WIKI}
19
+ MORE INFO: #{README_URL}
19
20
  EOS
20
21
 
21
- class Error < RuntimeError
22
- end
22
+ Error = ::Listen::Error # for backward compatibility
23
23
 
24
24
  def initialize
25
25
  @real_dirs = Set.new
@@ -27,14 +27,14 @@ module Listen
27
27
 
28
28
  def verify_unwatched!(entry)
29
29
  real_path = entry.real_path
30
- @real_dirs.add?(real_path) || _fail(entry.sys_path, real_path)
30
+ @real_dirs.add?(real_path) or _fail(entry.sys_path, real_path)
31
31
  end
32
32
 
33
33
  private
34
34
 
35
35
  def _fail(symlinked, real_path)
36
36
  warn(format(SYMLINK_LOOP_ERROR, symlinked, real_path))
37
- raise Error, 'Failed due to looped symlinks'
37
+ raise ::Listen::Error::SymlinkLoop, 'Failed due to looped symlinks'
38
38
  end
39
39
  end
40
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Listen
4
- VERSION = '3.4.0'
4
+ VERSION = '3.4.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: listen
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
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: 2020-12-31 00:00:00.000000000 Z
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb-fsevent
@@ -76,6 +76,7 @@ files:
76
76
  - lib/listen/change.rb
77
77
  - lib/listen/cli.rb
78
78
  - lib/listen/directory.rb
79
+ - lib/listen/error.rb
79
80
  - lib/listen/event/config.rb
80
81
  - lib/listen/event/loop.rb
81
82
  - lib/listen/event/processor.rb
@@ -102,10 +103,9 @@ metadata:
102
103
  allowed_push_host: https://rubygems.org
103
104
  bug_tracker_uri: https://github.com/guard/listen/issues
104
105
  changelog_uri: https://github.com/guard/listen/releases
105
- documentation_uri: https://www.rubydoc.info/gems/listen/3.4.0
106
+ documentation_uri: https://www.rubydoc.info/gems/listen/3.4.1
106
107
  homepage_uri: https://github.com/guard/listen
107
- source_code_uri: https://github.com/guard/listen/tree/v3.4.0
108
- wiki_uri: https://github.com/guard/listen/wiki
108
+ source_code_uri: https://github.com/guard/listen/tree/v3.4.1
109
109
  post_install_message:
110
110
  rdoc_options: []
111
111
  require_paths: