listen 3.4.0 → 3.6.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 +4 -4
- data/CONTRIBUTING.md +2 -2
- data/README.md +0 -4
- data/lib/listen/adapter/linux.rb +3 -3
- data/lib/listen/error.rb +10 -0
- data/lib/listen/event/loop.rb +5 -4
- data/lib/listen/file.rb +7 -5
- data/lib/listen/fsm.rb +3 -0
- data/lib/listen/record/symlink_detector.rb +6 -6
- data/lib/listen/thread.rb +1 -1
- data/lib/listen/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 656e49f1b6eca9a31fd9c09b916aa73ed6d3df255e4859c4b77ebdb7a0f4a6bf
|
4
|
+
data.tar.gz: 98be9697f64242c869fa47211477f84f8b636402fa4e865989e1b54e020a8032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af8bfbe37ce9b791f78ebdee29c32781742f3e58e98eae92381c34169bdf389db38f82228b77a56ba13e73646dbb7d2dae9a275be0c5b75e300010adb4382129
|
7
|
+
data.tar.gz: f97c76664f9aa893bd89bcf93484701a6bda473ab9b13e2101cacb4f450f5ca0d116362027368fe561a724fb0c55213bbc6944bd58b0ee4cb6812f588d00feeb
|
data/CONTRIBUTING.md
CHANGED
@@ -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/
|
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/
|
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
|
[](https://github.com/guard/listen/actions?workflow=Development)
|
8
6
|
[](http://badge.fury.io/rb/listen)
|
9
7
|
[](https://codeclimate.com/github/guard/listen)
|
@@ -27,10 +25,8 @@ The `listen` gem listens to file modifications and notifies you about the change
|
|
27
25
|
* Support for plugins planned for future.
|
28
26
|
* TCP functionality was removed in `listen` [3.0.0](https://github.com/guard/listen/releases/tag/v3.0.0) ([#319](https://github.com/guard/listen/issues/319), [#218](https://github.com/guard/listen/issues/218)). There are plans to extract this feature to separate gems ([#258](https://github.com/guard/listen/issues/258)), until this is finished, you can use by locking the `listen` gem to version `'~> 2.10'`.
|
29
27
|
* Some filesystems won't work without polling (VM/Vagrant Shared folders, NFS, Samba, sshfs, etc.).
|
30
|
-
* Specs suite on JRuby and Rubinius aren't reliable on Travis CI, but should work.
|
31
28
|
* Windows and \*BSD adapter aren't continuously and automatically tested.
|
32
29
|
* OSX adapter has some performance limitations ([#342](https://github.com/guard/listen/issues/342)).
|
33
|
-
* FreeBSD users need patched version of rb-kqueue (as of 2020/11). See #475 for the issue, mat813/rb-kqueue#12 for the patch, and Bug 250432 in bugzilla.
|
34
30
|
* Listeners do not notify across forked processes, if you wish for multiple processes to receive change notifications you must [listen inside of each process](https://github.com/guard/listen/issues/398#issuecomment-223957952).
|
35
31
|
|
36
32
|
Pull requests or help is very welcome for these.
|
data/lib/listen/adapter/linux.rb
CHANGED
@@ -21,12 +21,12 @@ module Listen
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
|
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
|
27
|
+
INOTIFY_LIMIT_MESSAGE = <<-EOS
|
28
28
|
FATAL: Listen error: unable to monitor directories for changes.
|
29
|
-
Visit #{
|
29
|
+
Visit #{README_URL} for info on how to fix this.
|
30
30
|
EOS
|
31
31
|
|
32
32
|
def _configure(directory, &callback)
|
data/lib/listen/error.rb
ADDED
@@ -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
|
data/lib/listen/event/loop.rb
CHANGED
@@ -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
|
-
|
15
|
-
|
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.')
|
data/lib/listen/file.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'digest
|
3
|
+
require 'digest'
|
4
4
|
|
5
5
|
module Listen
|
6
6
|
class File
|
@@ -53,7 +53,7 @@ module Listen
|
|
53
53
|
# then at ???14.998, but the fstat time would be ???14.0 in
|
54
54
|
# both cases).
|
55
55
|
#
|
56
|
-
# If change
|
56
|
+
# If change happened at ???14.999997, the mtime is 14.0, so for
|
57
57
|
# an mtime=???14.0 we assume it could even be almost ???15.0
|
58
58
|
#
|
59
59
|
# So if Time.now.to_f is ???15.999998 and stat reports mtime
|
@@ -67,9 +67,11 @@ module Listen
|
|
67
67
|
#
|
68
68
|
return if data[:mtime].to_i + 2 <= Time.now.to_f
|
69
69
|
|
70
|
-
|
71
|
-
record.update_file(rel_path, data.merge(
|
72
|
-
|
70
|
+
sha = Digest::SHA256.file(path).digest
|
71
|
+
record.update_file(rel_path, data.merge(sha: sha))
|
72
|
+
if record_data[:sha] && sha != record_data[:sha]
|
73
|
+
:modified
|
74
|
+
end
|
73
75
|
rescue SystemCallError
|
74
76
|
record.unset_path(rel_path)
|
75
77
|
:removed
|
data/lib/listen/fsm.rb
CHANGED
@@ -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
|
-
|
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: #{
|
19
|
+
MORE INFO: #{README_URL}
|
19
20
|
EOS
|
20
21
|
|
21
|
-
|
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)
|
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
|
data/lib/listen/thread.rb
CHANGED
@@ -24,7 +24,7 @@ module Listen
|
|
24
24
|
|
25
25
|
def rescue_and_log(method_name, *args, caller_stack: nil)
|
26
26
|
yield(*args)
|
27
|
-
rescue
|
27
|
+
rescue => exception
|
28
28
|
_log_exception(exception, method_name, caller_stack: caller_stack)
|
29
29
|
end
|
30
30
|
|
data/lib/listen/version.rb
CHANGED
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
|
+
version: 3.6.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:
|
11
|
+
date: 2021-07-20 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.
|
106
|
+
documentation_uri: https://www.rubydoc.info/gems/listen/3.6.0
|
106
107
|
homepage_uri: https://github.com/guard/listen
|
107
|
-
source_code_uri: https://github.com/guard/listen/tree/v3.
|
108
|
-
wiki_uri: https://github.com/guard/listen/wiki
|
108
|
+
source_code_uri: https://github.com/guard/listen/tree/v3.6.0
|
109
109
|
post_install_message:
|
110
110
|
rdoc_options: []
|
111
111
|
require_paths:
|
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 2.
|
117
|
+
version: 2.4.0
|
118
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - ">="
|