aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorJerry Cheung <jollyjerry@gmail.com>2016-03-04 14:38:04 -0800
committerJerry Cheung <jollyjerry@gmail.com>2016-03-08 08:42:44 -0800
commit78dd3f6f96d1daa6bb7a1ddf14b1a39b71b08319 (patch)
tree59b86e8c0f8a160114691326301edbc53226e859 /activesupport/lib/active_support
parent6ef5c64ab8353fd82fc13989e07cda86da5a1efa (diff)
downloadrails-78dd3f6f96d1daa6bb7a1ddf14b1a39b71b08319.tar.gz
rails-78dd3f6f96d1daa6bb7a1ddf14b1a39b71b08319.tar.bz2
rails-78dd3f6f96d1daa6bb7a1ddf14b1a39b71b08319.zip
friendly error message if missing listen
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/evented_file_update_checker.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/evented_file_update_checker.rb b/activesupport/lib/active_support/evented_file_update_checker.rb
index 63f4f7e277..6a02a838b7 100644
--- a/activesupport/lib/active_support/evented_file_update_checker.rb
+++ b/activesupport/lib/active_support/evented_file_update_checker.rb
@@ -21,7 +21,13 @@ module ActiveSupport
# 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' }
+ 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
end
end