【问题标题】:Atom causing Guard to run with every window changeAtom 导致 Guard 在每次窗口更改时运行
【发布时间】:2014-05-24 11:17:59
【问题描述】:

我在跑步

  • 导轨 4.1
  • 守卫 (2.6.0)
  • guard-livereload (2.1.2)
  • rspec-rails (2.14.2)

我希望守卫按预期运行 - 当监视的文件已被修改和保存时。 然而,目前它经常运行 - 当我改变我的窗口上的焦点时。 (我正在使用 Github 的 Atom)。当我切换回 textmate 时不会发生这种情况。有什么我可以在 atom 中更改以阻止它访问这些文件并在每个简单更改时触发警卫。

我的保护文件如下。

guard "bundler" do
  watch("Gemfile")
end

guard :rspec, cmd: 'bundle exec 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

有什么想法吗?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 rspec guard atom-editor


    【解决方案1】:

    您可能不小心激活了autosave

    • 打开设置⌘,
    • 数字自动保存过滤自动保存设置

    • 通过取消选中 Enabled 复选框来禁用它

    更多信息?

    • [打开自述文件]

    【讨论】:

    • 这太棒了,谢谢。所以我很菜鸟!谢谢,这太令人沮丧了。
    猜你喜欢
    • 2013-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-29
    • 2015-10-17
    • 1970-01-01
    • 2022-01-24
    相关资源
    最近更新 更多