1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

friendly error message if missing listen

This commit is contained in:
Jerry Cheung 2016-03-04 14:38:04 -08:00
parent 6ef5c64ab8
commit 78dd3f6f96

View file

@ -21,7 +21,13 @@ module ActiveSupport
# Loading listen triggers warnings. These are originated by a legit # Loading listen triggers warnings. These are originated by a legit
# usage of attr_* macros for private attributes, but adds a lot of noise # 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. # to our test suite. Thus, we lazy load it and disable warnings locally.
silence_warnings { require 'listen' } silence_warnings do
begin
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
Listen.to(*dtw, &method(:changed)).start Listen.to(*dtw, &method(:changed)).start
end end
end end