mirror of https://github.com/rails/rails
lazy load listen in core
See the rationale in the comment present in this patch.
This commit is contained in:
parent
7223596259
commit
a94d404510
2
Gemfile
2
Gemfile
|
@ -45,7 +45,7 @@ end
|
||||||
|
|
||||||
# Active Support.
|
# Active Support.
|
||||||
gem 'dalli', '>= 2.2.1'
|
gem 'dalli', '>= 2.2.1'
|
||||||
gem 'listen', '~> 3.0.5'
|
gem 'listen', '~> 3.0.5', require: false
|
||||||
|
|
||||||
# Active Job.
|
# Active Job.
|
||||||
group :job do
|
group :job do
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
require 'listen'
|
|
||||||
require 'set'
|
require 'set'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'concurrent/atomic/atomic_boolean'
|
require 'concurrent/atomic/atomic_boolean'
|
||||||
|
@ -19,6 +18,10 @@ module ActiveSupport
|
||||||
@lcsp = @ph.longest_common_subpath(@dirs.keys)
|
@lcsp = @ph.longest_common_subpath(@dirs.keys)
|
||||||
|
|
||||||
if (dtw = directories_to_watch).any?
|
if (dtw = directories_to_watch).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 { require 'listen' }
|
||||||
Listen.to(*dtw, &method(:changed)).start
|
Listen.to(*dtw, &method(:changed)).start
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue