listen 3.2.0 → 3.2.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: 0b5f7b7bf1deb60a64ba1f6c8813d46a5ec288d06414549108708ab94e737d46
4
- data.tar.gz: bf2891917f09e057a986ae92d53fcd79f9e6497a61a1a48a4068fb1f457e5c84
3
+ metadata.gz: e9a53907593c7c8390f895d361bce34873381883dbd033e02d1706e2e28c13d1
4
+ data.tar.gz: 5a8dfdc3c74345e7283b5f5aee13b5ded0f3f44c8fecaf7027551eb2359ecdae
5
5
  SHA512:
6
- metadata.gz: 1ab40d1ea2baae96b0d822a5b491fd4eaf01e07c5357564a83108002dd1d5de1235f2a93c6514ed8f54a5ff53a532be1a63b1e14b7c6e50fec0b6f500911a239
7
- data.tar.gz: a2d25ceb884d415b9acfc316d3c9790fe0c3608ad9affe563c7afe501b59b57e9ca67a0446ef584a71c01b60877ca56503d661bf87390b31e93e165a37468a44
6
+ metadata.gz: b5cbabed841e265c54aebfff999d306f5a91590e5e5abe8f9867c5ea9e66caa4d952acc7e7b8be10c2f1ea0a77b0ff4a07d653ec45d3009e149b5faa8331a689
7
+ data.tar.gz: 76c990e22b861cae3d9c764a290fab1ed90f6547b9c1329c92be797b8d99364ae21cb3367a84e8064e6834c9a3b76ab440a8c597f0dcacae1e06b1991e39c303
@@ -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
- require 'rb-fsevent'
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
- first = @workers.pop
52
-
53
- # NOTE: _run is called within a thread, so run every other
54
- # worker in it's own thread
55
- _run_workers_in_background(_to_array(@workers))
56
- _run_worker(first)
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 _process_event(dir, event)
60
- _log :debug, "fsevent: processing event: #{event.inspect}"
61
- event.each do |path|
62
- new_path = Pathname.new(path.sub(%r{\/$}, ''))
63
- _log :debug, "fsevent: #{new_path}"
64
- # TODO: does this preserve symlinks?
65
- rel_path = new_path.relative_path_from(dir).to_s
66
- _queue_change(:dir, dir, rel_path, recursive: true)
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 :debug, "fsevent: running worker: #{worker.inspect}"
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
@@ -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|
@@ -46,6 +46,9 @@ module Listen
46
46
  )
47
47
  )
48
48
 
49
+ # Mutagen sync temporary files
50
+ | \.mutagen-temporary.*
51
+
49
52
  # other files
50
53
  | \.DS_Store
51
54
  | \.tmp
@@ -1,3 +1,3 @@
1
1
  module Listen
2
- VERSION = '3.2.0'.freeze
2
+ VERSION = '3.2.1'.freeze
3
3
  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.2.0
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-10-01 00:00:00.000000000 Z
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.4
133
+ rubygems_version: 3.0.6
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Listen to file modifications