listen 3.9.0 → 3.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b365e353c2a0dc2a64459faa2c30a9b472130637b5fb4f50977c07adb2c6fd0c
4
- data.tar.gz: 82d72d4f26f25a7fd1e285fbebe66fffcee246999696313a4f19997ce2017ef5
3
+ metadata.gz: 1e8eccc119beebe2f5153f7fdba4cd313d48c5c7e6334fa3dff5a44bcfbbb720
4
+ data.tar.gz: be423bbdfe20ba4908fc97f9f0ac78bf26060c23e40ed5adf8c07925174245f4
5
5
  SHA512:
6
- metadata.gz: f52228164dce447a048dea3e04268909004e17f0b40788495f58f9afc9a9a9f3a0207fd0acb541d0cffe0be78836a10f652acf6ff418cea9ea119708eaec0b83
7
- data.tar.gz: ee91854777075dc80f4cbcff3e507f4ca162aabe37fa11709b145184ada246efd0401ba89a50de8008c2ca7345d0dd08d20bbad7c6d9272004ad3581e74abca5
6
+ metadata.gz: 596b34d1eeb1d98519303cc0eaced3b4ba87e28b0311a1b96626519c9afd66d90a29b9cc95444d18cf2e42247ed99f9eda86a4d0fa09e19348b60f0f3f63af59
7
+ data.tar.gz: 6c89b5bddcc73b889d58dc7364f8ed2f7d0c395eb9125215fb890bdd2a11fca9fad3bffc6da47cd83a43453169b40f1a94057c8dd818ea6c448863e594ae98c4
data/README.md CHANGED
@@ -265,7 +265,7 @@ If you are on Windows, it's recommended to use the [`wdm`](https://github.com/Ma
265
265
  Please add the following to your Gemfile:
266
266
 
267
267
  ```ruby
268
- gem 'wdm', '>= 0.1.0', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
268
+ gem 'wdm', '>= 0.1.0'
269
269
  ```
270
270
 
271
271
  ### On \*BSD
@@ -275,11 +275,7 @@ If you are on \*BSD you can try to use the [`rb-kqueue`](https://github.com/mat8
275
275
  Please add the following to your Gemfile:
276
276
 
277
277
  ```ruby
278
- require 'rbconfig'
279
- if RbConfig::CONFIG['target_os'] =~ /bsd|dragonfly/i
280
- gem 'rb-kqueue', '>= 0.2'
281
- end
282
-
278
+ gem 'rb-kqueue', '>= 0.2'
283
279
  ```
284
280
 
285
281
  ### Getting the [polling fallback message](#options)?
@@ -357,6 +353,9 @@ $ sudo sysctl -p
357
353
  ```
358
354
  You may also need to pay attention to the values of `max_queued_events` and `max_user_instances` if Listen keeps on complaining.
359
355
 
356
+ While 524,288 is the maximum number of files that can be watched. Each file watch [takes up 1,080 bytes](https://stackoverflow.com/a/7091897/1156119) on a 64-bit system, so assuming that all 524,288 watches are consumed, that allocates around 540 MiB.
357
+ If you're in an environment that is particularly memory-constrained, consider to specify a lower number.
358
+
360
359
  #### More info
361
360
  Man page for [inotify(7)](https://linux.die.net/man/7/inotify).
362
361
  Blog post: [limit of inotify](https://blog.sorah.jp/2012/01/24/inotify-limitation).
@@ -431,7 +430,7 @@ When in doubt, `LISTEN_GEM_DEBUGGING=debug` can help discover the actual events
431
430
  Pull requests are very welcome! Please try to follow these simple rules if applicable:
432
431
 
433
432
  * Please create a topic branch for every separate change you make.
434
- * Make sure your patches are well tested. All specs must pass on [Travis CI](https://travis-ci.org/guard/listen).
433
+ * Make sure your patches are well tested. All specs must pass on [CI](https://github.com/guard/listen/actions?workflow=Development).
435
434
  * Update the [Yard](http://yardoc.org/) documentation.
436
435
  * Update the [README](https://github.com/guard/listen/blob/master/README.md).
437
436
  * Please **do not change** the version number.
@@ -7,7 +7,7 @@
7
7
  module Listen
8
8
  module Adapter
9
9
  class BSD < Base
10
- OS_REGEXP = /bsd|dragonfly/i.freeze
10
+ OS_REGEXP = /bsd|dragonfly/i
11
11
 
12
12
  DEFAULTS = {
13
13
  events: [
@@ -22,10 +22,7 @@ module Listen
22
22
 
23
23
  BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '')
24
24
  Please add the following to your Gemfile to avoid polling for changes:
25
- require 'rbconfig'
26
- if RbConfig::CONFIG['target_os'] =~ /#{OS_REGEXP}/
27
- gem 'rb-kqueue', '>= 0.2'
28
- end
25
+ gem 'rb-kqueue', '>= 0.2'
29
26
  EOS
30
27
 
31
28
  def self.usable?
@@ -7,7 +7,7 @@ module Listen
7
7
  # Adapter implementation for Mac OS X `FSEvents`.
8
8
  #
9
9
  class Darwin < Base
10
- OS_REGEXP = /darwin(?<major_version>(1|2)\d+)/i.freeze
10
+ OS_REGEXP = /darwin(?<major_version>(1|2)\d+)/i
11
11
 
12
12
  # The default delay between checking for changes.
13
13
  DEFAULTS = { latency: 0.1 }.freeze
@@ -4,7 +4,7 @@ module Listen
4
4
  module Adapter
5
5
  # @see https://github.com/nex3/rb-inotify
6
6
  class Linux < Base
7
- OS_REGEXP = /linux/i.freeze
7
+ OS_REGEXP = /linux/i
8
8
 
9
9
  DEFAULTS = {
10
10
  events: [
@@ -60,7 +60,7 @@ module Listen
60
60
 
61
61
  cookie_params = event.cookie.zero? ? {} : { cookie: event.cookie }
62
62
 
63
- # Note: don't pass options to force rescanning the directory, so we can
63
+ # NOTE: don't pass options to force rescanning the directory, so we can
64
64
  # detect moving/deleting a whole tree
65
65
  if _dir_event?(event)
66
66
  _queue_change(:dir, dir, rel_path, cookie_params)
@@ -8,7 +8,7 @@ module Listen
8
8
  # file IO than the other implementations.
9
9
  #
10
10
  class Polling < Base
11
- OS_REGEXP = //.freeze # match every OS
11
+ OS_REGEXP = // # match every OS
12
12
 
13
13
  DEFAULTS = { latency: 1.0, wait_for_delay: 0.05 }.freeze
14
14
 
@@ -5,11 +5,11 @@ module Listen
5
5
  # Adapter implementation for Windows `wdm`.
6
6
  #
7
7
  class Windows < Base
8
- OS_REGEXP = /mswin|mingw|cygwin/i.freeze
8
+ OS_REGEXP = /mswin|mingw|cygwin/i
9
9
 
10
10
  BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '')
11
11
  Please add the following to your Gemfile to avoid polling for changes:
12
- gem 'wdm', '>= 0.1.0' if Gem.win_platform?
12
+ gem 'wdm', '>= 0.1.0'
13
13
  EOS
14
14
 
15
15
  def self.usable?
@@ -12,7 +12,6 @@ module Listen
12
12
  wait_for_delay,
13
13
  &block
14
14
  )
15
-
16
15
  @listener = listener
17
16
  @event_queue = event_queue
18
17
  @queue_optimizer = queue_optimizer
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thread'
4
-
5
3
  require 'timeout'
6
4
  require 'listen/event/processor'
7
5
  require 'listen/thread'
@@ -85,11 +85,13 @@ module Listen
85
85
 
86
86
  # blocks until event is popped
87
87
  # returns the event or `nil` when the event_queue is closed
88
+ # rubocop:disable Naming/MemoizedInstanceVariableName
88
89
  def _wait_until_events
89
90
  config.event_queue.pop.tap do |_event|
90
91
  @_remember_time_of_first_unprocessed_event ||= MonotonicTime.now
91
92
  end
92
93
  end
94
+ # rubocop:enable Naming/MemoizedInstanceVariableName
93
95
 
94
96
  def _flush_wakeup_reasons
95
97
  until @reasons.empty?
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thread'
4
-
5
3
  require 'forwardable'
6
4
 
7
5
  module Listen
data/lib/listen/fsm.rb CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  # Code copied from https://github.com/celluloid/celluloid-fsm
4
4
 
5
- require 'thread'
6
-
7
5
  module Listen
8
6
  module FSM
9
7
  # Included hook to extend class methods
@@ -38,7 +36,7 @@ module Listen
38
36
  end
39
37
  end
40
38
 
41
- # Note: including classes must call initialize_fsm from their initialize method.
39
+ # NOTE: including classes must call initialize_fsm from their initialize method.
42
40
  def initialize_fsm
43
41
  @fsm_initialized = true
44
42
  @state = self.class.start_state
data/lib/listen/logger.rb CHANGED
@@ -46,7 +46,7 @@ module Listen
46
46
 
47
47
  ::Logger.new(STDERR, level: level)
48
48
  end
49
-
49
+
50
50
  def adapter_warn_behavior_callback(message)
51
51
  if adapter_warn_behavior.respond_to?(:call)
52
52
  case behavior = adapter_warn_behavior.call(message)
@@ -12,7 +12,6 @@ module Listen
12
12
  given_options.empty? or raise ArgumentError, "Unknown options: #{given_options.inspect}"
13
13
  end
14
14
 
15
- # rubocop:disable Lint/MissingSuper
16
15
  def respond_to_missing?(name, *_)
17
16
  @options.has_key?(name)
18
17
  end
@@ -21,6 +20,5 @@ module Listen
21
20
  respond_to_missing?(name) or raise NameError, "Bad option: #{name.inspect} (valid:#{@options.keys.inspect})"
22
21
  @options[name]
23
22
  end
24
- # rubocop:enable Lint/MissingSuper
25
23
  end
26
24
  end
@@ -9,7 +9,7 @@ module Listen
9
9
  class SymlinkDetector
10
10
  README_URL = 'https://github.com/guard/listen/blob/master/README.md'
11
11
 
12
- SYMLINK_LOOP_ERROR = <<-EOS
12
+ SYMLINK_LOOP_ERROR = <<-EOS.freeze
13
13
  ** ERROR: directory is already being watched! **
14
14
 
15
15
  Directory: %s
data/lib/listen/record.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thread'
4
3
  require 'listen/record/entry'
5
4
  require 'listen/record/symlink_detector'
6
5
 
@@ -73,7 +72,7 @@ module Listen
73
72
  private
74
73
 
75
74
  def empty_dirname?(dirname)
76
- dirname == '.' || dirname == ''
75
+ ['.', ''].include?(dirname)
77
76
  end
78
77
 
79
78
  def reset_tree
@@ -18,7 +18,7 @@ module Listen
18
18
  # emacs temp files
19
19
  | \#.+\#
20
20
  | \.\#.+
21
- )(/|\z)}x.freeze
21
+ )(/|\z)}x
22
22
 
23
23
  # The default list of files that get ignored.
24
24
  DEFAULT_IGNORED_EXTENSIONS = %r{(?:
@@ -59,7 +59,7 @@ module Listen
59
59
  | \.DS_Store
60
60
  | \.tmp
61
61
  | ~
62
- )\z}x.freeze
62
+ )\z}x
63
63
 
64
64
  # TODO: deprecate these mutators; use attr_reader instead
65
65
  attr_accessor :only_patterns, :ignore_patterns
@@ -75,7 +75,7 @@ module Listen
75
75
  end
76
76
 
77
77
  def silenced?(relative_path, type)
78
- path = relative_path.to_s # in case it is a Pathname
78
+ path = relative_path.to_s # in case it is a Pathname
79
79
 
80
80
  _ignore?(path) || (only_patterns && type == :file && !_only?(path))
81
81
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Listen
4
- VERSION = '3.9.0'
4
+ VERSION = '3.10.0'
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: listen
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0
4
+ version: 3.10.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: 2024-02-24 00:00:00.000000000 Z
11
+ date: 2026-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logger
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rb-fsevent
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -103,9 +117,9 @@ metadata:
103
117
  allowed_push_host: https://rubygems.org
104
118
  bug_tracker_uri: https://github.com/guard/listen/issues
105
119
  changelog_uri: https://github.com/guard/listen/releases
106
- documentation_uri: https://www.rubydoc.info/gems/listen/3.9.0
120
+ documentation_uri: https://www.rubydoc.info/gems/listen/3.10.0
107
121
  homepage_uri: https://github.com/guard/listen
108
- source_code_uri: https://github.com/guard/listen/tree/v3.9.0
122
+ source_code_uri: https://github.com/guard/listen/tree/v3.10.0
109
123
  post_install_message:
110
124
  rdoc_options: []
111
125
  require_paths:
@@ -121,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
135
  - !ruby/object:Gem::Version
122
136
  version: '0'
123
137
  requirements: []
124
- rubygems_version: 3.4.6
138
+ rubygems_version: 3.4.19
125
139
  signing_key:
126
140
  specification_version: 4
127
141
  summary: Listen to file modifications