我在 Zeus 自定义计划中有类似的东西,我在其中运行一些 rake 任务:
require 'zeus/rails'
class CustomPlan < Zeus::Rails
def rots
`bundle exec rots 1> log/rots.log &`
end
def stripe_mock
`bundle exec stripe-mock-server 1> log/stripe-mock-server.log &`
end
end
Zeus.plan = CustomPlan.new
宙斯配置:
{
"command": "ruby -rubygems -r./custom_plan -eZeus.go",
"plan": {
"boot": {
"default_bundle": {
"development_environment": {
"prerake": {"rake": []},
"console": ["c"]
},
"test_environment": {
"test_helper": {"test": ["rspec"]}
}
},
"rots": {},
"stripe_mock": {}
}
}
}
我找到了这个链接:https ://github.com/rails/spring#configuration ,但我并不完全了解如何运行和停止我的自定义 rake 任务。
我尝试这样的事情:
class CustomPlan
def initialize
`bundle exec rots 1> log/rots.log &`
`bundle exec stripe-mock-server 1> log/stripe-mock-server.log &`
end
end
CustomPlan.new
这有效,但是当我停止 spring 时spring stop
,stripe-mock-server
并没有关闭。
这是在春季运行和停止自定义耙子的一些聪明的解决方案吗?
谢谢