Rails教程守卫和spork

时间:2014-09-18 09:23:35

标签: ruby-on-rails guard spork

我是rails的新手,并且遵循Michael Hartl的流行导轨教程。

D:\ Work \ Projects \ github \ rails_projects \ sample_app> ruby​​ -v ruby 1.9.3p545(2014-02-24)[i386-mingw32]

D:\ Work \ Projects \ github \ rails_projects \ sample_app> rails -v Rails 4.0.2

当我达到3.6.2(https://www.railstutorial.org/book/static_pages#sec-guard)时,我发现了一个问题:警卫根本不看文件。它只执行一次规范并退出。

当我添加spork并运行后卫时,它向我显示以下内容:

D:\Work\Projects\github\rails_projects\sample_app>bundle exec guard
13:07:02 - INFO - Guard is using Notifu to send notifications.
13:07:02 - INFO - Guard is using TerminalTitle to send notifications.
13:07:02 - INFO - Starting Spork for RSpec
Using RSpec, Rails
  -- Rinda Ring Server listening for connections...

  -- Starting to fill pool...
     Wait until at least one slave is provided before running tests...
  ** CTRL+BREAK to stop Spork and kill all ruby slave processes **
Spork is ready and listening on 8989!
   -- build slave 1...
   -- build slave 2...
Preloading Rails environment
Preloading Rails environment
Loading Spork.prefork block...
Loading Spork.prefork block...
  --> DRb magazine_slave_service: 1 provided...
  --> DRb magazine_slave_service: 2 provided...
13:07:24 - INFO - Spork server for RSpec successfully started
←]2;[Spork] RSpec successfully started
13:07:24 - INFO - Guard::RSpec is running
13:07:24 - INFO - Running all specs
Running tests with args ["--drb", "-f", "progress", "-r", "C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/gua
rd-rspec-2.5.0/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec"].
..
  <-- take tuple(2); slave.run...
........

Finished in 0.16201 seconds
8 examples, 0 failures
←]2;[RSpec results] 8 examples, 0 failures

Randomized with seed 18520

  <-- Slave(2) run done!
   -- (2);run done
Done.

13:07:32 - INFO - Guard is now watching at 'D:/Work/Projects/github/rails_projects/sample_app'

D:\Work\Projects\github\rails_projects\sample_app>   -- build slave 2...
Preloading Rails environment
Loading Spork.prefork block...
  --> DRb magazine_slave_service: 2 provided...

有人可以告诉我如何让这些东西在Windows 7上运行吗?

1 个答案:

答案 0 :(得分:3)

我找到了答案:https://stackoverflow.com/a/11773892/3999443

一旦Win不支持分叉,似乎spork将无法在Win平台上运行。 然后使用纯粹的守卫。