mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix folders update watcher with no folders to watch (#36163)
* boot when there is folders to watch * raise argument error when paths are empty * add space between curly braces * Revert "add space between curly braces" This reverts commit90cff20c87
. * Revert "raise argument error when paths are empty" This reverts commit349adff0f5
. * stop lazy loading listem gem * back with any? * require listen gem at top of the file * improve * remove scope resolution operator
This commit is contained in:
parent
52a897aefa
commit
179a5b8770
1 changed files with 2 additions and 13 deletions
|
@ -3,6 +3,7 @@
|
|||
require "set"
|
||||
require "pathname"
|
||||
require "concurrent/atomic/atomic_boolean"
|
||||
require "listen"
|
||||
|
||||
module ActiveSupport
|
||||
# Allows you to "listen" to changes in a file system.
|
||||
|
@ -55,16 +56,6 @@ module ActiveSupport
|
|||
dtw = directories_to_watch
|
||||
@dtw, @missing = dtw.partition(&:exist?)
|
||||
|
||||
if @dtw.any?
|
||||
# Loading listen triggers warnings. These are originated by a legit
|
||||
# usage of attr_* macros for private attributes, but adds a lot of noise
|
||||
# to our test suite. Thus, we lazy load it and disable warnings locally.
|
||||
silence_warnings do
|
||||
require "listen"
|
||||
rescue LoadError => e
|
||||
raise LoadError, "Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile", e.backtrace
|
||||
end
|
||||
end
|
||||
boot!
|
||||
end
|
||||
|
||||
|
@ -109,9 +100,7 @@ module ActiveSupport
|
|||
def boot!
|
||||
normalize_dirs!
|
||||
|
||||
unless @dtw.empty?
|
||||
Listen.to(*@dtw, &method(:changed)).start
|
||||
end
|
||||
Listen.to(*@dtw, &method(:changed)).start if @dtw.any?
|
||||
end
|
||||
|
||||
def shutdown!
|
||||
|
|
Loading…
Reference in a new issue