提交 78dd3f6f 编写于 作者: J Jerry Cheung

friendly error message if missing listen

上级 6ef5c64a
......@@ -21,7 +21,13 @@ def initialize(files, dirs = {}, &block)
# 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册