【问题标题】:How to pause execution using guard and pry?如何使用警卫和撬动暂停执行?
【发布时间】:2011-10-19 08:32:38
【问题描述】:

我有带有这个保护文件的 Rails 3.1.1 应用程序:

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

guard 'rails' do
  watch('Gemfile.lock')
  watch(%r{^(config|lib)/.*})
end

当我的应用程序在保护下运行时,对 binding.pry 的调用不会暂停执行。我该如何做到这一点?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3.1 guard pry


    【解决方案1】:

    我以前没用过 Guard,但也许你想要的是Remote sessions

    【讨论】:

    • 还有 pry-remote 可以与例如 Pow 一起使用,但这是不同的场景。
    【解决方案2】:

    这是来自他们的 GitHub 页面:

    pause: pause|p + return - 切换文件修改监听。有用 切换 git 分支时。

    不确定这是否是您需要的。

    【讨论】:

    • 这会手动暂停执行,但是当它在代码中看到binding.pry 时如何防止执行中断?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多