首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >Rails Spring配置类似于宙斯吗?

Rails Spring配置类似于宙斯吗?
EN

Stack Overflow用户
提问于 2017-07-19 13:55:04
回答 1查看 156关注 0票数 0

我在宙斯定制计划中有这样的东西,我执行一些rake任务:

代码语言:javascript
代码运行次数:0
运行
复制
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

宙斯配置:

代码语言:javascript
代码运行次数:0
运行
复制
{
    "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任务。

我试过这样的方法:

代码语言:javascript
代码运行次数:0
运行
复制
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 stop停止spring时,stripe-mock-server并没有关闭。

这是一个聪明的解决方案运行和停止自定义耙在春季?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-25 07:55:03

我现在想出的最好的解决方案:

代码语言:javascript
代码运行次数:0
运行
复制
# config/spring.rb
Spring.after_fork do
  `killall -v -9 rots & bundle exec rots 1> log/rots.log &`
  `killall -v -9 stripe-mock-server & bundle exec stripe-mock-server 1> log/stripe-mock-server.log &`
end

首先,如果存在,我会杀死所有的rotsstripe-mock-server,然后再次运行。如果你找到更好的解决办法,让我知道评论。谢谢。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45192734

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档