ruby-on-rails - rails 、叉叉和防护罩 : how to run many spork servers in parallel?

标签 ruby-on-rails guard rails-engines spork

我正在开发一个引擎(部署为 gem),我直接在我的主机应用程序中使用它。当我加载它时

gem 'my_gem', path: 'some/local/path'

引擎中的所有更改都会直接反射(reflect)在我的主机应用程序中,无需重新启动服务器。到目前为止,一切顺利。

我使用众所周知的 Spork&Guard 组合来开发和测试我的 Rails 应用程序。到目前为止,我从来不需要运行多个保护进程,因为我以前没有开发过引擎。但现在,我有一个主机应用程序和一个引擎,它们都是并行开发的,所以我需要每个 Spork&Guard 组契约(Contract)时运行。

遗憾的是,这似乎不起作用,因为 Guard 使用 Spork 的标准端口。有没有办法告诉 Guard 在启动 Spork 时应该使用哪些端口?

最佳答案

在你的守卫文件中:

guard 'spork', :rspec_port => 12345 do
   # ...
   watch('spec/spec_helper.rb') { :rspec }
end

guard 'rspec', :cli => "--drb --drb-port 12345" do
   # ...
end

关于ruby-on-rails - rails 、叉叉和防护罩 : how to run many spork servers in parallel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12676767/

相关文章:

ruby-on-rails - View可以在Rails中调用某些Model方法吗?

ruby-on-rails - Ruby:多行条件

ruby-on-rails - Rails rspec 问题(无法加载此类文件 --b (LoadError))

swift - 在 init() 中使用 guard let 安全解包可选

php - Laravel 7 : Redirect to different logins on different guards

ruby-on-rails - 在对象空间 object_id 中复制类

ruby-on-rails - rails 3 : Permalink public profile

ruby-on-rails - 你可以使用设计 :timeoutable and :rememberable at the same time?

ruby - HABTM 链接表未在可安装引擎中采用 isolate_namespace 值