New Upstream Release - ruby-listen
Ready changes
Summary
Merged new upstream version: 3.8.0 (was: 3.7.0).
Resulting package
Built on 2023-05-19T21:05 (took 4m31s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases ruby-listen
Lintian Result
Diff
diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml
index b7eac70..25046ab 100644
--- a/.github/workflows/development.yml
+++ b/.github/workflows/development.yml
@@ -8,16 +8,18 @@ jobs:
continue-on-error: ${{matrix.experimental}}
strategy:
+ fail-fast: false
matrix:
os:
- ubuntu
- macos
ruby:
- - 2.4
- - 2.5
- 2.6
- 2.7
+ - "3.0" # quotes ensure this isn't misinterpreted as Integer 3: https://github.com/actions/runner/issues/849
+ - 3.1
+ - 3.2
experimental: [false]
env: [""]
diff --git a/.rubocop.yml b/.rubocop.yml
index a635918..8043ab3 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,5 +1,5 @@
AllCops:
- TargetRubyVersion: 2.7
+ TargetRubyVersion: 3.0.4
Exclude:
- Gemfile
- Guardfile
diff --git a/README.md b/README.md
index c63359b..552fce5 100644
--- a/README.md
+++ b/README.md
@@ -97,23 +97,23 @@ The callback receives **three** array parameters: `modified`, `added` and `remov
Each of these three is always an array with 0 or more entries.
Each array entry is an absolute path.
-### Pause / unpause / stop
+### Pause / start / stop
-Listeners can also be easily paused/unpaused:
+Listeners can also be easily paused and later un-paused with start:
``` ruby
listener = Listen.to('dir/path/to/listen') { |modified, added, removed| puts 'handle changes here...' }
listener.start
-listener.paused? # => false
+listener.paused? # => false
listener.processing? # => true
-listener.pause # stops processing changes (but keeps on collecting them)
-listener.paused? # => true
+listener.pause # stops processing changes (but keeps on collecting them)
+listener.paused? # => true
listener.processing? # => false
-listener.unpause # resumes processing changes ("start" would do the same)
-listener.stop # stop both listening to changes and processing them
+listener.start # resumes processing changes
+listener.stop # stop both listening to changes and processing them
```
Note: While paused, `listen` keeps on collecting changes in the background - to clear them, call `stop`.
@@ -122,7 +122,7 @@ listener.stop # stop both listening to changes and processing them
### Ignore / ignore!
-`Listen` ignores some directories and extensions by default (See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer).
+`Listen` ignores some directories and extensions by default (See DEFAULT_IGNORED_FILES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer).
You can add ignoring patterns with the `ignore` option/method or overwrite default with `ignore!` option/method.
``` ruby
@@ -157,7 +157,7 @@ All the following options can be set through the `Listen.to` after the directory
```ruby
ignore: [%r{/foo/bar}, /\.pid$/, /\.coffee$/] # Ignore a list of paths
- # default: See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer
+ # default: See DEFAULT_IGNORED_FILES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer
ignore!: %r{/foo/bar} # Same as ignore options, but overwrite default ignored paths.
diff --git a/debian/changelog b/debian/changelog
index a8ae07a..46bd5ef 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ruby-listen (3.8.0-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * Drop patch 0007-Fix-kwargs-matching-with-rspec-mock-3.12-and-Ruby-3+.patch,
+ present upstream.
+
+ -- Debian Janitor <janitor@jelmer.uk> Fri, 19 May 2023 21:01:43 -0000
+
ruby-listen (3.7.0-2) unstable; urgency=medium
* Team upload.
diff --git a/debian/patches/0001-Remove-OSX-specific-dependency.patch b/debian/patches/0001-Remove-OSX-specific-dependency.patch
index 9a36f8f..5369190 100644
--- a/debian/patches/0001-Remove-OSX-specific-dependency.patch
+++ b/debian/patches/0001-Remove-OSX-specific-dependency.patch
@@ -7,11 +7,11 @@ Forwarded: not-needed
listen.gemspec | 1 -
1 file changed, 1 deletion(-)
-diff --git a/listen.gemspec b/listen.gemspec
-index ba62b76..ce06eb5 100644
---- a/listen.gemspec
-+++ b/listen.gemspec
-@@ -34,6 +34,5 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
+Index: ruby-listen.git/listen.gemspec
+===================================================================
+--- ruby-listen.git.orig/listen.gemspec
++++ ruby-listen.git/listen.gemspec
+@@ -34,6 +34,5 @@ Gem::Specification.new do |gem| # ruboco
gem.required_ruby_version = '>= 2.4.0' # rubocop:disable Gemspec/RequiredRubyVersion
diff --git a/debian/patches/0002-gemspec-skip-git-usage.patch b/debian/patches/0002-gemspec-skip-git-usage.patch
index 424ee29..6ddc108 100644
--- a/debian/patches/0002-gemspec-skip-git-usage.patch
+++ b/debian/patches/0002-gemspec-skip-git-usage.patch
@@ -7,11 +7,11 @@ Forwarded: not-needed
listen.gemspec | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
-diff --git a/listen.gemspec b/listen.gemspec
-index ce06eb5..edf2dc9 100644
---- a/listen.gemspec
-+++ b/listen.gemspec
-@@ -24,9 +24,7 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
+Index: ruby-listen.git/listen.gemspec
+===================================================================
+--- ruby-listen.git.orig/listen.gemspec
++++ ruby-listen.git/listen.gemspec
+@@ -24,9 +24,7 @@ Gem::Specification.new do |gem| # ruboco
'source_code_uri' => "#{gem.homepage}/tree/v#{gem.version}"
}
diff --git a/debian/patches/0006-Disable-coveralls.patch b/debian/patches/0006-Disable-coveralls.patch
index d534627..26b7a5c 100644
--- a/debian/patches/0006-Disable-coveralls.patch
+++ b/debian/patches/0006-Disable-coveralls.patch
@@ -8,10 +8,10 @@ Disable coveralls. Otherwise we have another failure thrown by coveralls.
spec/spec_helper.rb | 5 -----
1 file changed, 5 deletions(-)
-diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
-index 676f51f..4650d09 100644
---- a/spec/spec_helper.rb
-+++ b/spec/spec_helper.rb
+Index: ruby-listen.git/spec/spec_helper.rb
+===================================================================
+--- ruby-listen.git.orig/spec/spec_helper.rb
++++ ruby-listen.git/spec/spec_helper.rb
@@ -9,11 +9,6 @@ def ci?
ENV['CI']
end
diff --git a/debian/patches/0007-Fix-kwargs-matching-with-rspec-mock-3.12-and-Ruby-3+.patch b/debian/patches/0007-Fix-kwargs-matching-with-rspec-mock-3.12-and-Ruby-3+.patch
deleted file mode 100644
index 49c31be..0000000
--- a/debian/patches/0007-Fix-kwargs-matching-with-rspec-mock-3.12-and-Ruby-3+.patch
+++ /dev/null
@@ -1,236 +0,0 @@
-From 2947373cd6325b273e3206b63d16ddbfc1118ecf Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
-Date: Thu, 3 Nov 2022 17:28:43 +0100
-Subject: [PATCH] Fix kwargs matching with rspec-mock 3.12 and Ruby 3+
-
-The test seems to be broken by:
-
-https://github.com/rspec/rspec-mocks/pull/1461
----
- spec/lib/listen/adapter/base_spec.rb | 2 +-
- spec/lib/listen/adapter/linux_spec.rb | 6 ++++--
- spec/lib/listen/adapter/polling_spec.rb | 2 +-
- spec/lib/listen/directory_spec.rb | 12 ++++++------
- spec/lib/listen/listener_spec.rb | 20 ++++++++++----------
- spec/lib/listen/silencer/controller_spec.rb | 12 ++++++------
- 6 files changed, 28 insertions(+), 26 deletions(-)
-
-diff --git a/spec/lib/listen/adapter/base_spec.rb b/spec/lib/listen/adapter/base_spec.rb
-index 6cf0cadf..2b531279 100644
---- a/spec/lib/listen/adapter/base_spec.rb
-+++ b/spec/lib/listen/adapter/base_spec.rb
-@@ -91,7 +91,7 @@ def _process_event(dir, event)
- it 'passes invalidates the snapshot based on the event' do
- subject.start
-
-- expect(snapshot).to receive(:invalidate).with(:file, 'bar', cookie: 3)
-+ expect(snapshot).to receive(:invalidate).with(:file, 'bar', { cookie: 3 })
-
- event = { dir: '/foo/dir1', file: 'bar', type: :moved, cookie: 3 }
- subject.fake_event(event)
-diff --git a/spec/lib/listen/adapter/linux_spec.rb b/spec/lib/listen/adapter/linux_spec.rb
-index e55bbf67..14f5d480 100644
---- a/spec/lib/listen/adapter/linux_spec.rb
-+++ b/spec/lib/listen/adapter/linux_spec.rb
-@@ -112,8 +112,10 @@
- expect(snapshot).to receive(:invalidate).with(
- :file,
- 'path/foo.txt',
-- cookie: 123,
-- change: change
-+ {
-+ cookie: 123,
-+ change: change
-+ }
- )
- end
- end
-diff --git a/spec/lib/listen/adapter/polling_spec.rb b/spec/lib/listen/adapter/polling_spec.rb
-index 925db745..fae546fb 100644
---- a/spec/lib/listen/adapter/polling_spec.rb
-+++ b/spec/lib/listen/adapter/polling_spec.rb
-@@ -56,7 +56,7 @@
-
- it 'notifies change on every listener directories path' do
- expect(snapshot).to receive(:invalidate).
-- with(:dir, '.', recursive: true)
-+ with(:dir, '.', { recursive: true })
-
- t = Thread.new { subject.start }
- sleep 0.25
-diff --git a/spec/lib/listen/directory_spec.rb b/spec/lib/listen/directory_spec.rb
-index 43ea5228..3340067e 100644
---- a/spec/lib/listen/directory_spec.rb
-+++ b/spec/lib/listen/directory_spec.rb
-@@ -76,7 +76,7 @@ def fake_children(exception, dir, *args, &block)
- expect(snapshot).to receive(:invalidate).with(:file, 'file.rb', {})
-
- expect(snapshot).to receive(:invalidate).
-- with(:dir, 'subdir', recursive: false)
-+ with(:dir, 'subdir', { recursive: false })
-
- described_class.scan(snapshot, '.', options)
- end
-@@ -91,7 +91,7 @@ def fake_children(exception, dir, *args, &block)
-
- it 'notices subdir does not exist' do
- expect(snapshot).to receive(:invalidate).
-- with(:dir, 'subdir', recursive: false)
-+ with(:dir, 'subdir', { recursive: false })
-
- described_class.scan(snapshot, '.', options)
- end
-@@ -219,7 +219,7 @@ def fake_children(exception, dir, *args, &block)
- expect(snapshot).to receive(:invalidate).with(:file, 'file.rb', {})
-
- expect(snapshot).to receive(:invalidate).
-- with(:dir, 'subdir', recursive: true)
-+ with(:dir, 'subdir', { recursive: true })
-
- described_class.scan(snapshot, '.', options)
- end
-@@ -240,10 +240,10 @@ def fake_children(exception, dir, *args, &block)
- expect(snapshot).to receive(:invalidate).with(:file, 'file.rb', {})
-
- expect(snapshot).to receive(:invalidate).
-- with(:dir, 'subdir', recursive: true)
-+ with(:dir, 'subdir', { recursive: true })
-
- expect(snapshot).to receive(:invalidate).
-- with(:dir, 'subdir2', recursive: true)
-+ with(:dir, 'subdir2', { recursive: true })
-
- described_class.scan(snapshot, '.', options)
- end
-@@ -274,7 +274,7 @@ def fake_children(exception, dir, *args, &block)
-
- it 'snapshots changes for subdir' do
- expect(snapshot).to receive(:invalidate).
-- with(:dir, 'subdir', recursive: true)
-+ with(:dir, 'subdir', { recursive: true })
-
- described_class.scan(snapshot, '.', options)
- end
-diff --git a/spec/lib/listen/listener_spec.rb b/spec/lib/listen/listener_spec.rb
-index 9b67e271..8dd9a7a6 100644
---- a/spec/lib/listen/listener_spec.rb
-+++ b/spec/lib/listen/listener_spec.rb
-@@ -245,12 +245,12 @@
- let(:options) { { ignore: /bar/ } }
-
- it 'adds up to existing ignore options' do
-- expect(silencer).to receive(:configure).once.with(ignore: [/bar/])
-+ expect(silencer).to receive(:configure).once.with({ ignore: [/bar/] })
-
- subject
-
- expect(silencer).to receive(:configure).once.
-- with(ignore: [/bar/, /foo/])
-+ with({ ignore: [/bar/, /foo/] })
-
- subject.ignore(/foo/)
- end
-@@ -260,12 +260,12 @@
- let(:options) { { ignore: [/bar/] } }
-
- it 'adds up to existing ignore options' do
-- expect(silencer).to receive(:configure).once.with(ignore: [/bar/])
-+ expect(silencer).to receive(:configure).once.with({ ignore: [/bar/] })
-
- subject
-
- expect(silencer).to receive(:configure).once.
-- with(ignore: [/bar/, /foo/])
-+ with({ ignore: [/bar/, /foo/] })
-
- subject.ignore(/foo/)
- end
-@@ -287,9 +287,9 @@
- let(:options) { { ignore!: /bar/ } }
-
- it 'overwrites existing ignore options' do
-- expect(silencer).to receive(:configure).once.with(ignore!: [/bar/])
-+ expect(silencer).to receive(:configure).once.with({ ignore!: [/bar/] })
- subject
-- expect(silencer).to receive(:configure).once.with(ignore!: [/foo/])
-+ expect(silencer).to receive(:configure).once.with({ ignore!: [/foo/] })
- subject.ignore!([/foo/])
- end
- end
-@@ -298,9 +298,9 @@
- let(:options) { { ignore: /bar/ } }
-
- it 'deletes ignore options' do
-- expect(silencer).to receive(:configure).once.with(ignore: [/bar/])
-+ expect(silencer).to receive(:configure).once.with({ ignore: [/bar/] })
- subject
-- expect(silencer).to receive(:configure).once.with(ignore!: [/foo/])
-+ expect(silencer).to receive(:configure).once.with({ ignore!: [/foo/] })
- subject.ignore!([/foo/])
- end
- end
-@@ -311,9 +311,9 @@
- let(:options) { { only: /bar/ } }
-
- it 'overwrites existing ignore options' do
-- expect(silencer).to receive(:configure).once.with(only: [/bar/])
-+ expect(silencer).to receive(:configure).once.with({ only: [/bar/] })
- subject
-- expect(silencer).to receive(:configure).once.with(only: [/foo/])
-+ expect(silencer).to receive(:configure).once.with({ only: [/foo/] })
- subject.only([/foo/])
- end
- end
-diff --git a/spec/lib/listen/silencer/controller_spec.rb b/spec/lib/listen/silencer/controller_spec.rb
-index 984630cc..5393a34f 100644
---- a/spec/lib/listen/silencer/controller_spec.rb
-+++ b/spec/lib/listen/silencer/controller_spec.rb
-@@ -26,7 +26,7 @@
- context 'when providing a single regexp as argument' do
- it 'sets the given :ignore rules as array' do
- subject
-- allow(silencer).to receive(:configure).with(ignore: [/foo/])
-+ allow(silencer).to receive(:configure).with({ ignore: [/foo/] })
- subject.append_ignores(/foo/)
- end
- end
-@@ -34,7 +34,7 @@
- context 'when providing multiple arguments' do
- it 'sets the given :ignore rules as a flat array' do
- subject
-- allow(silencer).to receive(:configure).with(ignore: [/foo/, /bar/])
-+ allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
- subject.append_ignores(/foo/, /bar/)
- end
- end
-@@ -42,7 +42,7 @@
- context 'when providing as array' do
- it 'sets the given :ignore rules' do
- subject
-- allow(silencer).to receive(:configure).with(ignore: [/foo/, /bar/])
-+ allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
- subject.append_ignores([/foo/, /bar/])
- end
- end
-@@ -50,18 +50,18 @@
-
- context 'with previous :ignore rules' do
- subject do
-- described_class.new(silencer, ignore: [/foo/, /bar/])
-+ described_class.new(silencer, { ignore: [/foo/, /bar/] })
- end
-
- before do
-- allow(silencer).to receive(:configure).with(ignore: [/foo/, /bar/])
-+ allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
- end
-
- context 'when providing a nil' do
- # TODO: should this invocation maybe reset the rules?
- it 'reconfigures with existing :ignore rules' do
- subject
-- allow(silencer).to receive(:configure).with(ignore: [/foo/, /bar/])
-+ allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
- subject.append_ignores(nil)
- end
- end
diff --git a/debian/patches/series b/debian/patches/series
index e6f912f..af7a326 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
0001-Remove-OSX-specific-dependency.patch
0002-gemspec-skip-git-usage.patch
0006-Disable-coveralls.patch
-0007-Fix-kwargs-matching-with-rspec-mock-3.12-and-Ruby-3+.patch
diff --git a/lib/listen/adapter/config.rb b/lib/listen/adapter/config.rb
index e33b13e..5a068a7 100644
--- a/lib/listen/adapter/config.rb
+++ b/lib/listen/adapter/config.rb
@@ -16,6 +16,12 @@ module Listen
Pathname.new(directory.to_s).realpath
end
+ @directories.each do |pathname|
+ unless pathname.directory?
+ fail ArgumentError, "must be a directory: #{pathname}"
+ end
+ end
+
@silencer = silencer
@queue = queue
@adapter_options = adapter_options
diff --git a/lib/listen/cli.rb b/lib/listen/cli.rb
index 6fcfbe4..e317313 100644
--- a/lib/listen/cli.rb
+++ b/lib/listen/cli.rb
@@ -18,9 +18,9 @@ module Listen
class_option :directory,
type: :array,
- default: '.',
+ default: ['.'],
aliases: '-d',
- banner: 'The directory to listen to'
+ banner: 'One or more directories to listen to'
class_option :relative,
type: :boolean,
@@ -55,7 +55,7 @@ module Listen
end
end
- listener = Listen.to(directory, relative: relative, &callback)
+ listener = Listen.to(*directory, relative: relative, &callback)
listener.start
diff --git a/lib/listen/directory.rb b/lib/listen/directory.rb
index 840c886..19178b3 100644
--- a/lib/listen/directory.rb
+++ b/lib/listen/directory.rb
@@ -36,7 +36,7 @@ module Listen
end
# TODO: this is not tested properly
- previous = previous.reject { |entry, _| current.include? path + entry }
+ previous = previous.reject { |entry, _| current.include?(path + entry) }
_async_changes(snapshot, Pathname.new(rel_path), previous, options)
rescue Errno::ENOENT, Errno::EHOSTDOWN
diff --git a/lib/listen/record.rb b/lib/listen/record.rb
index e34ae27..2218149 100644
--- a/lib/listen/record.rb
+++ b/lib/listen/record.rb
@@ -12,14 +12,14 @@ module Listen
attr_reader :root
def initialize(directory, silencer)
- @tree = _auto_hash
+ reset_tree
@root = directory.to_s
@silencer = silencer
end
def add_dir(rel_path)
- if ![nil, '', '.'].include?(rel_path)
- @tree[rel_path] ||= {}
+ if !empty_dirname?(rel_path.to_s)
+ @tree[rel_path.to_s]
end
end
@@ -35,32 +35,32 @@ module Listen
def file_data(rel_path)
dirname, basename = Pathname(rel_path).split.map(&:to_s)
- if [nil, '', '.'].include? dirname
- @tree[basename] ||= {}
+ if empty_dirname?(dirname)
@tree[basename].dup
else
- @tree[dirname] ||= {}
@tree[dirname][basename] ||= {}
@tree[dirname][basename].dup
end
end
def dir_entries(rel_path)
- subtree = if ['', '.'].include? rel_path.to_s
+ rel_path_s = rel_path.to_s
+ subtree = if empty_dirname?(rel_path_s)
@tree
else
- @tree[rel_path.to_s] ||= _auto_hash
- @tree[rel_path.to_s]
+ @tree[rel_path_s]
end
- subtree.transform_values do |values|
- # only get data for file entries
- values.key?(:mtime) ? values : {}
+ subtree.each_with_object({}) do |(key, values), result|
+ # only return data for file entries inside the dir (which will each be sub-hashes)
+ if values.is_a?(Hash)
+ result[key] = values.has_key?(:mtime) ? values : {}
+ end
end
end
def build
- @tree = _auto_hash
+ reset_tree
# TODO: test with a file name given
# TODO: test other permissions
# TODO: test with mixed encoding
@@ -72,15 +72,18 @@ module Listen
private
- def _auto_hash
- Hash.new { |h, k| h[k] = {} }
+ def empty_dirname?(dirname)
+ dirname == '.' || dirname == ''
+ end
+
+ def reset_tree
+ @tree = Hash.new { |h, k| h[k] = {} }
end
def _fast_update_file(dirname, basename, data)
- if [nil, '', '.'].include?(dirname)
- @tree[basename] = (@tree[basename] || {}).merge(data)
+ if empty_dirname?(dirname.to_s)
+ @tree[basename] = @tree[basename].merge(data)
else
- @tree[dirname] ||= {}
@tree[dirname][basename] = (@tree[dirname][basename] || {}).merge(data)
end
end
@@ -88,7 +91,7 @@ module Listen
def _fast_unset_path(dirname, basename)
# this may need to be reworked to properly remove
# entries from a tree, without adding non-existing dirs to the record
- if [nil, '', '.'].include?(dirname)
+ if empty_dirname?(dirname.to_s)
if @tree.key?(basename)
@tree.delete(basename)
end
diff --git a/lib/listen/silencer.rb b/lib/listen/silencer.rb
index b0156b9..7253a8b 100644
--- a/lib/listen/silencer.rb
+++ b/lib/listen/silencer.rb
@@ -3,8 +3,8 @@
module Listen
class Silencer
# The default list of directories that get ignored.
- DEFAULT_IGNORED_DIRECTORIES = %r{^(?:
- \.git
+ DEFAULT_IGNORED_FILES = %r{\A(?:
+ \.git
| \.svn
| \.hg
| \.rbx
@@ -13,8 +13,12 @@ module Listen
| vendor/bundle
| log
| tmp
- |vendor/ruby
- )(/|$)}x.freeze
+ | vendor/ruby
+
+ # emacs temp files
+ | \#.+\#
+ | \.\#.+
+ )(/|\z)}x.freeze
# The default list of files that get ignored.
DEFAULT_IGNORED_EXTENSIONS = %r{(?:
@@ -35,7 +39,7 @@ module Listen
| ^4913
# Sed temporary files - but without actual words, like 'sedatives'
- | (?:^
+ | (?:\A
sed
(?:
@@ -55,7 +59,7 @@ module Listen
| \.DS_Store
| \.tmp
| ~
- )$}x.freeze
+ )\z}x.freeze
# TODO: deprecate these mutators; use attr_reader instead
attr_accessor :only_patterns, :ignore_patterns
@@ -89,7 +93,7 @@ module Listen
def _init_ignores(ignores, overrides)
patterns = []
unless overrides
- patterns << DEFAULT_IGNORED_DIRECTORIES
+ patterns << DEFAULT_IGNORED_FILES
patterns << DEFAULT_IGNORED_EXTENSIONS
end
diff --git a/lib/listen/version.rb b/lib/listen/version.rb
index b7a6e71..06c30a8 100644
--- a/lib/listen/version.rb
+++ b/lib/listen/version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Listen
- VERSION = '3.7.0'
+ VERSION = '3.8.0'
end
diff --git a/spec/lib/listen/adapter/base_spec.rb b/spec/lib/listen/adapter/base_spec.rb
index 6cf0cad..2b53127 100644
--- a/spec/lib/listen/adapter/base_spec.rb
+++ b/spec/lib/listen/adapter/base_spec.rb
@@ -91,7 +91,7 @@ RSpec.describe Listen::Adapter::Base do
it 'passes invalidates the snapshot based on the event' do
subject.start
- expect(snapshot).to receive(:invalidate).with(:file, 'bar', cookie: 3)
+ expect(snapshot).to receive(:invalidate).with(:file, 'bar', { cookie: 3 })
event = { dir: '/foo/dir1', file: 'bar', type: :moved, cookie: 3 }
subject.fake_event(event)
diff --git a/spec/lib/listen/adapter/config_spec.rb b/spec/lib/listen/adapter/config_spec.rb
index 9cab26d..ff715a8 100644
--- a/spec/lib/listen/adapter/config_spec.rb
+++ b/spec/lib/listen/adapter/config_spec.rb
@@ -17,6 +17,7 @@ RSpec.describe Listen::Adapter::Config do
# Here's what may be passed to initializer
let(:path1) { fake_path('/real/path1', realpath: real_path1) }
let(:path2) { fake_path('/real/path2', realpath: real_path2) }
+ let(:path3) { fake_path('/real/path3', realpath: real_path3) }
let(:current_path) do
fake_path('/real/current_path', realpath: real_current_path)
@@ -29,6 +30,7 @@ RSpec.describe Listen::Adapter::Config do
# something useful)
let(:real_path1) { fake_path('/real/path1') }
let(:real_path2) { fake_path('/real/path2') }
+ let(:real_path3) { fake_path('/real/path3', directory?: false) }
let(:real_current_path) { fake_path('/real/current_path') }
before do
@@ -38,6 +40,7 @@ RSpec.describe Listen::Adapter::Config do
allow(Pathname).to receive(:new).with('/real/path1').and_return(path1)
allow(Pathname).to receive(:new).with('/real/path2').and_return(path2)
+ allow(Pathname).to receive(:new).with('/real/path3').and_return(path3)
allow(Pathname).to receive(:new).with(path1).and_return(path1)
allow(Pathname).to receive(:new).with(path2).and_return(path2)
@@ -90,6 +93,13 @@ RSpec.describe Listen::Adapter::Config do
expect(subject.directories).to eq([real_current_path])
end
end
+
+ context 'with file path' do
+ let(:directories) { ['/real/path3'] }
+ it 'raises argument error requesting a directory' do
+ expect { subject }.to raise_error(ArgumentError, /must be a directory/)
+ end
+ end
end
describe '#adapter_options' do
diff --git a/spec/lib/listen/adapter/linux_spec.rb b/spec/lib/listen/adapter/linux_spec.rb
index e55bbf6..14f5d48 100644
--- a/spec/lib/listen/adapter/linux_spec.rb
+++ b/spec/lib/listen/adapter/linux_spec.rb
@@ -112,8 +112,10 @@ RSpec.describe Listen::Adapter::Linux do
expect(snapshot).to receive(:invalidate).with(
:file,
'path/foo.txt',
- cookie: 123,
- change: change
+ {
+ cookie: 123,
+ change: change
+ }
)
end
end
diff --git a/spec/lib/listen/adapter/polling_spec.rb b/spec/lib/listen/adapter/polling_spec.rb
index 925db74..fae546f 100644
--- a/spec/lib/listen/adapter/polling_spec.rb
+++ b/spec/lib/listen/adapter/polling_spec.rb
@@ -56,7 +56,7 @@ RSpec.describe Adapter::Polling do
it 'notifies change on every listener directories path' do
expect(snapshot).to receive(:invalidate).
- with(:dir, '.', recursive: true)
+ with(:dir, '.', { recursive: true })
t = Thread.new { subject.start }
sleep 0.25
diff --git a/spec/lib/listen/cli_spec.rb b/spec/lib/listen/cli_spec.rb
index 80133a9..a85381f 100644
--- a/spec/lib/listen/cli_spec.rb
+++ b/spec/lib/listen/cli_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe Listen::CLI do
let(:options) { %w[] }
it 'is set to local directory' do
expect(Listen::Forwarder).to receive(:new) do |options|
- expect(options[:directory]).to eq('.')
+ expect(options[:directory]).to eq(['.'])
forwarder
end
described_class.start(options)
@@ -108,7 +108,7 @@ RSpec.describe Listen::Forwarder do
it 'passes relative option to Listen' do
value = double('value')
expect(Listen).to receive(:to).
- with(nil, hash_including(relative: value)).
+ with(hash_including(relative: value)).
and_return(listener)
described_class.new(relative: value).start
diff --git a/spec/lib/listen/directory_spec.rb b/spec/lib/listen/directory_spec.rb
index 43ea522..3340067 100644
--- a/spec/lib/listen/directory_spec.rb
+++ b/spec/lib/listen/directory_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe Directory do
expect(snapshot).to receive(:invalidate).with(:file, 'file.rb', {})
expect(snapshot).to receive(:invalidate).
- with(:dir, 'subdir', recursive: false)
+ with(:dir, 'subdir', { recursive: false })
described_class.scan(snapshot, '.', options)
end
@@ -91,7 +91,7 @@ RSpec.describe Directory do
it 'notices subdir does not exist' do
expect(snapshot).to receive(:invalidate).
- with(:dir, 'subdir', recursive: false)
+ with(:dir, 'subdir', { recursive: false })
described_class.scan(snapshot, '.', options)
end
@@ -219,7 +219,7 @@ RSpec.describe Directory do
expect(snapshot).to receive(:invalidate).with(:file, 'file.rb', {})
expect(snapshot).to receive(:invalidate).
- with(:dir, 'subdir', recursive: true)
+ with(:dir, 'subdir', { recursive: true })
described_class.scan(snapshot, '.', options)
end
@@ -240,10 +240,10 @@ RSpec.describe Directory do
expect(snapshot).to receive(:invalidate).with(:file, 'file.rb', {})
expect(snapshot).to receive(:invalidate).
- with(:dir, 'subdir', recursive: true)
+ with(:dir, 'subdir', { recursive: true })
expect(snapshot).to receive(:invalidate).
- with(:dir, 'subdir2', recursive: true)
+ with(:dir, 'subdir2', { recursive: true })
described_class.scan(snapshot, '.', options)
end
@@ -274,7 +274,7 @@ RSpec.describe Directory do
it 'snapshots changes for subdir' do
expect(snapshot).to receive(:invalidate).
- with(:dir, 'subdir', recursive: true)
+ with(:dir, 'subdir', { recursive: true })
described_class.scan(snapshot, '.', options)
end
diff --git a/spec/lib/listen/listener_spec.rb b/spec/lib/listen/listener_spec.rb
index 9b67e27..8dd9a7a 100644
--- a/spec/lib/listen/listener_spec.rb
+++ b/spec/lib/listen/listener_spec.rb
@@ -245,12 +245,12 @@ RSpec.describe Listener do
let(:options) { { ignore: /bar/ } }
it 'adds up to existing ignore options' do
- expect(silencer).to receive(:configure).once.with(ignore: [/bar/])
+ expect(silencer).to receive(:configure).once.with({ ignore: [/bar/] })
subject
expect(silencer).to receive(:configure).once.
- with(ignore: [/bar/, /foo/])
+ with({ ignore: [/bar/, /foo/] })
subject.ignore(/foo/)
end
@@ -260,12 +260,12 @@ RSpec.describe Listener do
let(:options) { { ignore: [/bar/] } }
it 'adds up to existing ignore options' do
- expect(silencer).to receive(:configure).once.with(ignore: [/bar/])
+ expect(silencer).to receive(:configure).once.with({ ignore: [/bar/] })
subject
expect(silencer).to receive(:configure).once.
- with(ignore: [/bar/, /foo/])
+ with({ ignore: [/bar/, /foo/] })
subject.ignore(/foo/)
end
@@ -287,9 +287,9 @@ RSpec.describe Listener do
let(:options) { { ignore!: /bar/ } }
it 'overwrites existing ignore options' do
- expect(silencer).to receive(:configure).once.with(ignore!: [/bar/])
+ expect(silencer).to receive(:configure).once.with({ ignore!: [/bar/] })
subject
- expect(silencer).to receive(:configure).once.with(ignore!: [/foo/])
+ expect(silencer).to receive(:configure).once.with({ ignore!: [/foo/] })
subject.ignore!([/foo/])
end
end
@@ -298,9 +298,9 @@ RSpec.describe Listener do
let(:options) { { ignore: /bar/ } }
it 'deletes ignore options' do
- expect(silencer).to receive(:configure).once.with(ignore: [/bar/])
+ expect(silencer).to receive(:configure).once.with({ ignore: [/bar/] })
subject
- expect(silencer).to receive(:configure).once.with(ignore!: [/foo/])
+ expect(silencer).to receive(:configure).once.with({ ignore!: [/foo/] })
subject.ignore!([/foo/])
end
end
@@ -311,9 +311,9 @@ RSpec.describe Listener do
let(:options) { { only: /bar/ } }
it 'overwrites existing ignore options' do
- expect(silencer).to receive(:configure).once.with(only: [/bar/])
+ expect(silencer).to receive(:configure).once.with({ only: [/bar/] })
subject
- expect(silencer).to receive(:configure).once.with(only: [/foo/])
+ expect(silencer).to receive(:configure).once.with({ only: [/foo/] })
subject.only([/foo/])
end
end
diff --git a/spec/lib/listen/record_spec.rb b/spec/lib/listen/record_spec.rb
index 919ad0d..b33362b 100644
--- a/spec/lib/listen/record_spec.rb
+++ b/spec/lib/listen/record_spec.rb
@@ -66,7 +66,7 @@ RSpec.describe Listen::Record do
end
context 'with subdir path' do
- it 'sets path by spliting dirname and basename' do
+ it 'sets path by splitting dirname and basename' do
record.update_file('path/file.rb', mtime: 1.1)
expect(record_tree(record)['path']).to eq('file.rb' => { mtime: 1.1 })
end
@@ -257,6 +257,14 @@ RSpec.describe Listen::Record do
end
it { should be_empty }
end
+
+ context 'with path renamed to file' do
+ before do
+ record.add_dir('path/subdir')
+ record.update_file('path', mtime: 1.1)
+ end
+ it { should be_empty }
+ end
end
end
diff --git a/spec/lib/listen/silencer/controller_spec.rb b/spec/lib/listen/silencer/controller_spec.rb
index 984630c..5393a34 100644
--- a/spec/lib/listen/silencer/controller_spec.rb
+++ b/spec/lib/listen/silencer/controller_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe Listen::Silencer::Controller do
context 'when providing a single regexp as argument' do
it 'sets the given :ignore rules as array' do
subject
- allow(silencer).to receive(:configure).with(ignore: [/foo/])
+ allow(silencer).to receive(:configure).with({ ignore: [/foo/] })
subject.append_ignores(/foo/)
end
end
@@ -34,7 +34,7 @@ RSpec.describe Listen::Silencer::Controller do
context 'when providing multiple arguments' do
it 'sets the given :ignore rules as a flat array' do
subject
- allow(silencer).to receive(:configure).with(ignore: [/foo/, /bar/])
+ allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
subject.append_ignores(/foo/, /bar/)
end
end
@@ -42,7 +42,7 @@ RSpec.describe Listen::Silencer::Controller do
context 'when providing as array' do
it 'sets the given :ignore rules' do
subject
- allow(silencer).to receive(:configure).with(ignore: [/foo/, /bar/])
+ allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
subject.append_ignores([/foo/, /bar/])
end
end
@@ -50,18 +50,18 @@ RSpec.describe Listen::Silencer::Controller do
context 'with previous :ignore rules' do
subject do
- described_class.new(silencer, ignore: [/foo/, /bar/])
+ described_class.new(silencer, { ignore: [/foo/, /bar/] })
end
before do
- allow(silencer).to receive(:configure).with(ignore: [/foo/, /bar/])
+ allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
end
context 'when providing a nil' do
# TODO: should this invocation maybe reset the rules?
it 'reconfigures with existing :ignore rules' do
subject
- allow(silencer).to receive(:configure).with(ignore: [/foo/, /bar/])
+ allow(silencer).to receive(:configure).with({ ignore: [/foo/, /bar/] })
subject.append_ignores(nil)
end
end
diff --git a/spec/lib/listen/silencer_spec.rb b/spec/lib/listen/silencer_spec.rb
index 8d4145f..aad4ae2 100644
--- a/spec/lib/listen/silencer_spec.rb
+++ b/spec/lib/listen/silencer_spec.rb
@@ -34,6 +34,9 @@ RSpec.describe Listen::Silencer do
# Vim swap files
ignored += %w[foo.swp foo.swx foo.swpx 4913]
+ # Emacs backup/swap files
+ ignored += %w[#hello.rb# .#hello.rb]
+
# sed temp files
ignored += %w[sedq7eVAR sed86w1kB]
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 676f51f..7d4799e 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -38,7 +38,7 @@ end
module SpecHelpers
def fake_path(str, options = {})
- instance_double(Pathname, str, { to_s: str }.merge(options))
+ instance_double(Pathname, str, { to_s: str, directory?: true }.merge(options))
end
end
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/adapter.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/adapter/base.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/adapter/bsd.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/adapter/config.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/adapter/darwin.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/adapter/linux.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/adapter/polling.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/adapter/windows.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/backend.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/change.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/cli.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/directory.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/error.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/event/config.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/event/loop.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/event/processor.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/event/queue.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/file.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/fsm.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/listener.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/listener/config.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/logger.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/monotonic_time.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/options.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/queue_optimizer.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/record.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/record/entry.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/silencer.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/silencer/controller.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/thread.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/lib/listen/version.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/specifications/listen-3.8.0.gemspec -rwxr-xr-x root/root /usr/share/rubygems-integration/all/gems/listen-3.8.0/bin/listen
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/adapter.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/adapter/base.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/adapter/bsd.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/adapter/config.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/adapter/darwin.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/adapter/linux.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/adapter/polling.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/adapter/windows.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/backend.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/change.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/cli.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/directory.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/error.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/event/config.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/event/loop.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/event/processor.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/event/queue.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/file.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/fsm.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/listener.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/listener/config.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/logger.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/monotonic_time.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/options.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/queue_optimizer.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/record.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/record/entry.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/record/symlink_detector.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/silencer.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/silencer/controller.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/thread.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/lib/listen/version.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/specifications/listen-3.7.0.gemspec -rwxr-xr-x root/root /usr/share/rubygems-integration/all/gems/listen-3.7.0/bin/listen
No differences were encountered in the control files