listen 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +8 -1
- data/README.md +18 -0
- data/lib/listen/adapter/darwin.rb +24 -38
- data/lib/listen/directory.rb +6 -0
- data/lib/listen/silencer.rb +3 -0
- data/lib/listen/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9a53907593c7c8390f895d361bce34873381883dbd033e02d1706e2e28c13d1
|
4
|
+
data.tar.gz: 5a8dfdc3c74345e7283b5f5aee13b5ded0f3f44c8fecaf7027551eb2359ecdae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5cbabed841e265c54aebfff999d306f5a91590e5e5abe8f9867c5ea9e66caa4d952acc7e7b8be10c2f1ea0a77b0ff4a07d653ec45d3009e149b5faa8331a689
|
7
|
+
data.tar.gz: 76c990e22b861cae3d9c764a290fab1ed90f6547b9c1329c92be797b8d99364ae21cb3367a84e8064e6834c9a3b76ab440a8c597f0dcacae1e06b1991e39c303
|
data/CONTRIBUTING.md
CHANGED
@@ -31,8 +31,15 @@ Pull requests are very welcome! Please try to follow these simple rules if appli
|
|
31
31
|
* Make sure your patches are well tested. All specs run with `rake spec` must pass.
|
32
32
|
* Update the [Yard](http://yardoc.org/) documentation.
|
33
33
|
* Update the [README](https://github.com/guard/listen/blob/master/README.md).
|
34
|
-
* Update the [CHANGELOG](https://github.com/guard/listen/blob/master/CHANGELOG.md) for noteworthy changes.
|
35
34
|
* Please **do not change** the version number.
|
36
35
|
|
36
|
+
The title of your PR will automatically be included in the release notes for the next version of the gem. A maintainer can add one of the following GitHub labels to the PR to automatically categorize it when the release notes are generated:
|
37
|
+
|
38
|
+
- ⚠️ Breaking
|
39
|
+
- ✨ Feature
|
40
|
+
- 🐛 Bug Fix
|
41
|
+
- 📚 Docs
|
42
|
+
- 🏠 Housekeeping
|
43
|
+
|
37
44
|
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
38
45
|
`#guard` (irc.freenode.net).
|
data/README.md
CHANGED
@@ -262,6 +262,24 @@ Pull requests are very welcome! Please try to follow these simple rules if appli
|
|
262
262
|
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
263
263
|
`#guard` (irc.freenode.net).
|
264
264
|
|
265
|
+
## Releasing
|
266
|
+
|
267
|
+
### Prerequisites
|
268
|
+
|
269
|
+
* You must have commit rights to the GitHub repository.
|
270
|
+
* You must have push rights for rubygems.org.
|
271
|
+
|
272
|
+
### How to release
|
273
|
+
|
274
|
+
1. Run `bundle install` to make sure that you have all the gems necessary for testing and releasing.
|
275
|
+
2. **Ensure all tests are passing by running `bundle exec rake`.**
|
276
|
+
3. Determine which would be the correct next version number according to [semver](http://semver.org/).
|
277
|
+
4. Update the version in `./lib/listen/version.rb`.
|
278
|
+
5. Update the version in the Install section of `./README.md` (`gem 'listen', '~> X.Y'`).
|
279
|
+
6. Commit the version in a single commit, the message should be "Preparing vX.Y.Z"
|
280
|
+
7. Run `bundle exec rake release:full`; this will tag, push to GitHub, and publish to rubygems.org.
|
281
|
+
8. Update and publish the release notes on the [GitHub releases page](https://github.com/guard/listen/releases) if necessary
|
282
|
+
|
265
283
|
## Acknowledgments
|
266
284
|
|
267
285
|
* [Michael Kessler (netzpirat)][] for having written the [initial specs](https://github.com/guard/listen/commit/1e457b13b1bb8a25d2240428ce5ed488bafbed1f).
|
@@ -35,59 +35,45 @@ module Listen
|
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
-
# NOTE: each directory gets a DIFFERENT callback!
|
39
38
|
def _configure(dir, &callback)
|
40
|
-
|
41
|
-
opts = { latency: options.latency }
|
42
|
-
|
43
|
-
@workers ||= ::Queue.new
|
44
|
-
@workers << FSEvent.new.tap do |worker|
|
45
|
-
_log :debug, "fsevent: watching: #{dir.to_s.inspect}"
|
46
|
-
worker.watch(dir.to_s, opts, &callback)
|
47
|
-
end
|
39
|
+
@callbacks[dir] = callback
|
48
40
|
end
|
49
41
|
|
50
42
|
def _run
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
_run_worker(
|
43
|
+
require 'rb-fsevent'
|
44
|
+
worker = FSEvent.new
|
45
|
+
dirs_to_watch = @callbacks.keys.map(&:to_s)
|
46
|
+
_log(:info) { "fsevent: watching: #{dirs_to_watch.inspect}" }
|
47
|
+
worker.watch(dirs_to_watch, { latency: options.latency }, &method(:_process_changes))
|
48
|
+
Listen::Internals::ThreadPool.add { _run_worker(worker) }
|
57
49
|
end
|
58
50
|
|
59
|
-
def
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
51
|
+
def _process_changes(dirs)
|
52
|
+
dirs.each do |dir|
|
53
|
+
dir = Pathname.new(dir.sub(%r{\/$}, ''))
|
54
|
+
|
55
|
+
@callbacks.each do |watched_dir, callback|
|
56
|
+
if watched_dir.eql?(dir) || Listen::Directory.ascendant_of?(watched_dir, dir)
|
57
|
+
callback.call(dir)
|
58
|
+
end
|
59
|
+
end
|
67
60
|
end
|
68
61
|
end
|
69
62
|
|
63
|
+
def _process_event(dir, path)
|
64
|
+
_log(:debug) { "fsevent: processing path: #{path.inspect}" }
|
65
|
+
# TODO: does this preserve symlinks?
|
66
|
+
rel_path = path.relative_path_from(dir).to_s
|
67
|
+
_queue_change(:dir, dir, rel_path, recursive: true)
|
68
|
+
end
|
69
|
+
|
70
70
|
def _run_worker(worker)
|
71
|
-
_log
|
71
|
+
_log(:debug) { "fsevent: running worker: #{worker.inspect}" }
|
72
72
|
worker.run
|
73
73
|
rescue
|
74
74
|
format_string = 'fsevent: running worker failed: %s:%s called from: %s'
|
75
75
|
_log_exception format_string, caller
|
76
76
|
end
|
77
|
-
|
78
|
-
def _run_workers_in_background(workers)
|
79
|
-
workers.each do |worker|
|
80
|
-
# NOTE: while passing local variables to the block below is not
|
81
|
-
# thread safe, using 'worker' from the enumerator above is ok
|
82
|
-
Listen::Internals::ThreadPool.add { _run_worker(worker) }
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def _to_array(queue)
|
87
|
-
workers = []
|
88
|
-
workers << queue.pop until queue.empty?
|
89
|
-
workers
|
90
|
-
end
|
91
77
|
end
|
92
78
|
end
|
93
79
|
end
|
data/lib/listen/directory.rb
CHANGED
@@ -53,6 +53,12 @@ module Listen
|
|
53
53
|
raise
|
54
54
|
end
|
55
55
|
|
56
|
+
def self.ascendant_of?(base, other)
|
57
|
+
other.ascend do |ascendant|
|
58
|
+
break true if base == ascendant
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
56
62
|
def self._async_changes(snapshot, path, previous, options)
|
57
63
|
fail "Not a Pathname: #{path.inspect}" unless path.respond_to?(:children)
|
58
64
|
previous.each do |entry, data|
|
data/lib/listen/silencer.rb
CHANGED
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.2.
|
4
|
+
version: 3.2.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: 2019-
|
11
|
+
date: 2019-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb-fsevent
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
|
-
rubygems_version: 3.0.
|
133
|
+
rubygems_version: 3.0.6
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Listen to file modifications
|