listen 3.1.5 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7386f68792e7b45304769943823e31ad245b400d
4
- data.tar.gz: f199b345bccc4a716fe87fa703c9aea864a25d17
2
+ SHA256:
3
+ metadata.gz: e9a53907593c7c8390f895d361bce34873381883dbd033e02d1706e2e28c13d1
4
+ data.tar.gz: 5a8dfdc3c74345e7283b5f5aee13b5ded0f3f44c8fecaf7027551eb2359ecdae
5
5
  SHA512:
6
- metadata.gz: 12ad0394d61e54beefef077dfcbf798c2b358ed56f0c8cf3e5d57df015623d6f823f7346f88463d6d7ce3a6845dff19fb2e3538030911050b68f9153cd43d72b
7
- data.tar.gz: ef7151a3ce30aa79ae408eb22c2e455b418229e3fce9c4584b0a1a1c913c34235661cd72e94802b811b624c01ecb04ce6b9c5814aafa0810a233ecd7e900e7ff
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
@@ -1,12 +1,10 @@
1
- ## IMPORTANT: [Ruby 2.1 is officially outdated and unsupported!](https://www.ruby-lang.org/en/news/2016/03/30/ruby-2-1-9-released/) Please upgrade to Ruby 2.2 before installing Listen!
2
-
3
- ### (To install for older versions, update Bundler to a prerelease version: `gem install bundler --pre` and Bundler should correctly resolve to an earlier gems for your given Ruby version).
1
+ ## IMPORTANT: If you cannot install Listen (e.g. on Travis/CI builds), [a workaround is here](https://github.com/guard/listen/wiki/Ruby-version-requirements)
4
2
 
5
3
  :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
4
 
7
5
  # Listen
8
6
 
9
- [![Gem Version](https://badge.fury.io/rb/listen.png)](http://badge.fury.io/rb/listen) [![Build Status](https://travis-ci.org/guard/listen.png)](https://travis-ci.org/guard/listen) [![Dependency Status](https://gemnasium.com/guard/listen.png)](https://gemnasium.com/guard/listen) [![Code Climate](https://codeclimate.com/github/guard/listen.png)](https://codeclimate.com/github/guard/listen) [![Coverage Status](https://coveralls.io/repos/guard/listen/badge.png?branch=master)](https://coveralls.io/r/guard/listen)
7
+ [![Gem Version](https://badge.fury.io/rb/listen.svg)](http://badge.fury.io/rb/listen) [![Build Status](https://travis-ci.org/guard/listen.svg)](https://travis-ci.org/guard/listen) [![Code Climate](https://codeclimate.com/github/guard/listen.svg)](https://codeclimate.com/github/guard/listen) [![Coverage Status](https://coveralls.io/repos/guard/listen/badge.svg?branch=master)](https://coveralls.io/r/guard/listen)
10
8
 
11
9
  The Listen gem listens to file modifications and notifies you about the changes.
12
10
 
@@ -31,7 +29,8 @@ The Listen gem listens to file modifications and notifies you about the changes.
31
29
  * Specs suite on JRuby and Rubinius aren't reliable on Travis CI, but should work.
32
30
  * Windows and \*BSD adapter aren't continuously and automatically tested.
33
31
  * OSX adapter has some performance limitations ([#342](https://github.com/guard/listen/issues/342)).
34
- * Ruby < 2.2.x is no longer supported - upgrade to Ruby 2.2 or 2.3
32
+ * Ruby < 2.2.x is no longer supported - upgrade to Ruby 2.2 or 2.3.
33
+ * 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
34
 
36
35
  Pull requests or help is very welcome for these.
37
36
 
@@ -170,7 +169,7 @@ polling_fallback_message: 'custom message' # Set a custom polling fallback
170
169
 
171
170
  ## Debugging
172
171
 
173
- Setting the environment variable `LISTEN_GEM_DEBUGGING=1` sets up the INFO level logger, while `LISTEN_GEM_DEBUGGING=2` sets up the DEBUG level logger.
172
+ Setting the environment variable `LISTEN_GEM_DEBUGGING=1` sets up the INFO level logger, while `LISTEN_GEM_DEBUGGING=2` sets up the DEBUG level logger.
174
173
 
175
174
  You can also set `Listen.logger` to a custom logger.
176
175
 
@@ -263,11 +262,29 @@ Pull requests are very welcome! Please try to follow these simple rules if appli
263
262
  For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
264
263
  `#guard` (irc.freenode.net).
265
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
+
266
283
  ## Acknowledgments
267
284
 
268
285
  * [Michael Kessler (netzpirat)][] for having written the [initial specs](https://github.com/guard/listen/commit/1e457b13b1bb8a25d2240428ce5ed488bafbed1f).
269
286
  * [Travis Tilley (ttilley)][] for this awesome work on [fssm][] & [rb-fsevent][].
270
- * [Nathan Weizenbaum (nex3)][] for [rb-inotify][], a thorough inotify wrapper.
287
+ * [Natalie Weizenbaum (nex3)][] for [rb-inotify][], a thorough inotify wrapper.
271
288
  * [Mathieu Arnold (mat813)][] for [rb-kqueue][], a simple kqueue wrapper.
272
289
  * [Maher Sallam][] for [wdm][], windows support wouldn't exist without him.
273
290
  * [Yehuda Katz (wycats)][] for [vigilo][], that has been a great source of inspiration.
@@ -287,7 +304,7 @@ For questions please join us in our [Google group](http://groups.google.com/grou
287
304
  [fssm]: https://github.com/ttilley/fssm
288
305
  [rb-fsevent]: https://github.com/thibaudgg/rb-fsevent
289
306
  [Mathieu Arnold (mat813)]: https://github.com/mat813
290
- [Nathan Weizenbaum (nex3)]: https://github.com/nex3
307
+ [Natalie Weizenbaum (nex3)]: https://github.com/nex3
291
308
  [rb-inotify]: https://github.com/nex3/rb-inotify
292
309
  [stereobooster]: https://github.com/stereobooster
293
310
  [rb-fchange]: https://github.com/stereobooster/rb-fchange
@@ -4,11 +4,6 @@ require 'listen/listener'
4
4
 
5
5
  require 'listen/internals/thread_pool'
6
6
 
7
- # Show warnings about vulnerabilities, bugs and outdated Rubies, since previous
8
- # versions aren't tested or officially supported.
9
- require 'ruby_dep/warning'
10
- RubyDep::Warning.new.show_warnings
11
-
12
7
  # Always set up logging by default first time file is required
13
8
  #
14
9
  # NOTE: If you need to clear the logger completely, do so *after*
@@ -22,11 +22,11 @@ module Listen
22
22
  EOS
23
23
 
24
24
  def self.usable?
25
- require 'rb-fsevent'
26
25
  version = RbConfig::CONFIG['target_os'][OS_REGEXP, :major_version]
27
26
  return false unless version
28
27
  return true if version.to_i >= 13 # darwin13 is OS X 10.9
29
28
 
29
+ require 'rb-fsevent'
30
30
  fsevent_version = Gem::Version.new(FSEvent::VERSION)
31
31
  return true if fsevent_version <= Gem::Version.new('0.9.4')
32
32
  Kernel.warn INCOMPATIBLE_GEM_VERSION
@@ -35,58 +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
- opts = { latency: options.latency }
41
-
42
- @workers ||= ::Queue.new
43
- @workers << FSEvent.new.tap do |worker|
44
- _log :debug, "fsevent: watching: #{dir.to_s.inspect}"
45
- worker.watch(dir.to_s, opts, &callback)
46
- end
39
+ @callbacks[dir] = callback
47
40
  end
48
41
 
49
42
  def _run
50
- first = @workers.pop
51
-
52
- # NOTE: _run is called within a thread, so run every other
53
- # worker in it's own thread
54
- _run_workers_in_background(_to_array(@workers))
55
- _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) }
56
49
  end
57
50
 
58
- def _process_event(dir, event)
59
- _log :debug, "fsevent: processing event: #{event.inspect}"
60
- event.each do |path|
61
- new_path = Pathname.new(path.sub(%r{\/$}, ''))
62
- _log :debug, "fsevent: #{new_path}"
63
- # TODO: does this preserve symlinks?
64
- rel_path = new_path.relative_path_from(dir).to_s
65
- _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
66
60
  end
67
61
  end
68
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
+
69
70
  def _run_worker(worker)
70
- _log :debug, "fsevent: running worker: #{worker.inspect}"
71
+ _log(:debug) { "fsevent: running worker: #{worker.inspect}" }
71
72
  worker.run
72
73
  rescue
73
74
  format_string = 'fsevent: running worker failed: %s:%s called from: %s'
74
75
  _log_exception format_string, caller
75
76
  end
76
-
77
- def _run_workers_in_background(workers)
78
- workers.each do |worker|
79
- # NOTE: while passing local variables to the block below is not
80
- # thread safe, using 'worker' from the enumerator above is ok
81
- Listen::Internals::ThreadPool.add { _run_worker(worker) }
82
- end
83
- end
84
-
85
- def _to_array(queue)
86
- workers = []
87
- workers << queue.pop until queue.empty?
88
- workers
89
- end
90
77
  end
91
78
  end
92
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|
@@ -107,15 +107,15 @@ module Listen
107
107
  def _detect_possible_editor_save(changes)
108
108
  return unless changes.size == 2
109
109
 
110
- from_type = from_change = from = nil
111
- to_type = to_change = to_dir = to = nil
110
+ from_type = from = nil
111
+ to_type = to_dir = to = nil
112
112
 
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
@@ -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.1.5'.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.1.5
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: 2016-05-18 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
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: '0.10'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.9.4
22
+ version: 0.10.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.9'
29
+ version: '0.10'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.9.4
32
+ version: 0.10.3
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rb-inotify
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '0.9'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.9.7
42
+ version: 0.9.10
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,35 +49,21 @@ dependencies:
49
49
  version: '0.9'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 0.9.7
53
- - !ruby/object:Gem::Dependency
54
- name: ruby_dep
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '1.2'
60
- type: :runtime
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - "~>"
65
- - !ruby/object:Gem::Version
66
- version: '1.2'
52
+ version: 0.9.10
67
53
  - !ruby/object:Gem::Dependency
68
54
  name: bundler
69
55
  requirement: !ruby/object:Gem::Requirement
70
56
  requirements:
71
- - - "~>"
57
+ - - ">="
72
58
  - !ruby/object:Gem::Version
73
- version: '1.12'
59
+ version: '0'
74
60
  type: :development
75
61
  prerelease: false
76
62
  version_requirements: !ruby/object:Gem::Requirement
77
63
  requirements:
78
- - - "~>"
64
+ - - ">="
79
65
  - !ruby/object:Gem::Version
80
- version: '1.12'
66
+ version: '0'
81
67
  description: The Listen gem listens to file modifications and notifies you about the
82
68
  changes. Works everywhere!
83
69
  email: thibaud@thibaud.gg
@@ -137,17 +123,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
123
  version: '2.2'
138
124
  - - ">="
139
125
  - !ruby/object:Gem::Version
140
- version: 2.2.3
126
+ version: 2.2.7
141
127
  required_rubygems_version: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
144
130
  - !ruby/object:Gem::Version
145
131
  version: '0'
146
132
  requirements: []
147
- rubyforge_project:
148
- rubygems_version: 2.5.1
133
+ rubygems_version: 3.0.6
149
134
  signing_key:
150
135
  specification_version: 4
151
136
  summary: Listen to file modifications
152
137
  test_files: []
153
- has_rdoc: