我在我的新Rails项目上设置了Guard和Guar-Livereload,类似于我之前的一个:Gemfile:
group :development do
gem 'spork-rails', '4.0.0'
gem 'guard-spork', '1.5.0'
gem 'childprocess'
gem "rspec-rails"
gem 'guard-livereload', require: false
gem 'spring'
gem "guard-rspec"
end
在我的Guardfile中:
guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{app/assets/.+\.rb})
watch(%r{app/assets/.+\.(css|js|scss|jpg|png)})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
end
在发出命令guard init guard-livereload
后创建的。当我发出guard
时,我可以看到以下消息:
18:35:41 - INFO - Guard is using TerminalTitle to send notifications.
18:35:43 - INFO - Guard::RSpec is running
18:35:43 - INFO - LiveReload is waiting for a browser to connect.
18:35:43 - INFO - Guard is now watching at '/Volumes/volume/Users/myuser/Documents/RubyApps/myapp'
[1] guard(main)>
但服务器无法启动,但是如果我rails s
服务器将在前端启动并可见。这让我相信这个问题与Guard有关。有人能指出我正确的方向吗?
非常感谢
EDIT在运行guard -d
后添加了控制台:
18:31:56 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
18:31:56 - INFO - Guard is using TerminalTitle to send notifications.
18:31:57 - DEBUG - Command execution: hash stty
18:31:57 - DEBUG - Guard starts all plugins
18:31:57 - DEBUG - Hook :start_begin executed for Guard::RSpec
18:31:57 - INFO - Guard::RSpec is running
18:31:57 - DEBUG - Hook :start_end executed for Guard::RSpec
18:31:57 - DEBUG - Hook :start_begin executed for Guard::LiveReload
18:31:57 - DEBUG - Hook :start_end executed for Guard::LiveReload
18:31:57 - INFO - LiveReload is waiting for a browser to connect.
18:31:57 - INFO - Guard is now watching at '/Volumes/fenix/Users/wagner/Documents/htdocs/RubyApps/turing'
18:31:57 - DEBUG - Start interactor
18:31:57 - DEBUG - Command execution: stty -g 2>/dev/null`
答案 0 :(得分:0)
查看@ec2最近对此的评论:
对于livereload,使用' -d'守卫。选项(bundle exec guard -d)你应该看到为Guard :: LiveReload执行的Hook:run_on_modifications_begin。如果您收到该消息,请告诉我们(下一步取决于答案)。当然,确保在浏览器中实际启用livereload(我必须在每次启动项目时启用它) - 理想情况下,只需在浏览器中打开一个静态html文件,编辑该文件并检查 - 它应该可以正常工作。