0

Windows で wdm を Guard と組み合わせて使用​​しようとすると、guard がサイレント モードで終了します。ただし、ポーリングを強制すると、ガードは正しく機能します。おそらくこれを説明する最良の方法は、例を使用することです。wdm でガードを実行すると、次のようになります。

C:/path/to/code>bundle exec guard init rspec
11:47:02 - INFO - rspec guard added to Guardfile, feel free to edit it

C:/path/to/code>bundle exec guard
11:48:06 - INFO - Guard is using TerminalTitle to send notifications.
11:48:06 - INFO - Guard::RSpec is running
11:48:06 - INFO - Guard is now watching at 'C:/path/to/code'

C:/path/to/code>

ただし、guard に変更のポーリングを強制すると、guard コンソールで終了することで正しく動作します。

C:/path/to/code>bundle exec guard -p
11:50:03 - INFO - Guard is using TerminalTitle to send notifications.
11:50:03 - INFO - Guard::RSpec is running
11:50:03 - INFO - Guard is now watching at 'C:/path/to/code'
[1] guard(main)>

誰かがこの問題に光を当ててくれることを願っています。かなり調べてみましたが、この質問に対する答えを見つけることができませんでした。

私の Gemfile からの関連する抜粋:

source 'http://rubygems.org'
ruby '1.9.3'
require "rbconfig"
gem 'rails', '3.2.13'
gem "figaro", ">= 0.5.3"
gem "rspec-rails", ">= 2.12.2", :group => [:development, :test]
gem "factory_girl_rails", ">= 4.2.0", :group => [:development, :test]
group :test do
    gem "capybara", ">= 2.0.2"
    gem "database_cleaner", ">= 0.9.1"
    gem "email_spec", ">= 1.4.0"
    gem "guard-rspec"
    gem "wdm", ">= 0.1.0" if RbConfig::CONFIG["target_os"] =~ /mswin|mingw|cygwin/i
end

私のガードファイル:

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard :rspec do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('spec/spec_helper.rb')  { "spec" }

  # Rails example
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$})          { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }

  # Capybara features specs
  watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$})     { |m| "spec/features/#{m[1]}_spec.rb" }

  # Turnip features and steps
  watch(%r{^spec/acceptance/(.+)\.feature$})
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$})   { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end
4

1 に答える 1

0

私はこれに対する答えを持っていませんが、それに関連するいくつかの問題を収集することができると思いました.

主な問題は、gemのWindows の問題です。listen

関連する問題として、guardGuard 2.0.3 デーモンが閉じられたウィンドウで実行されたままにならないlistenという問題があります。

wdmgem には未解決の問題もあります: listen gem で失敗します

申し訳ありませんが、解決できませんが、少なくともこの問題には進行中の問題があります。Windows 用の Ruby に取り組んでいる少数の人々は、まさに宝石のような存在です。しゃれをお詫び申し上げます:)

于 2014-07-19T12:42:01.530 に答える