简体   繁体   English

将Rails引擎构建为宝石的工作流程

[英]workflow for building rails engines as gems

We are looking into building a very large rails application and considering using engines for better separation of "modules" out of the main app. 我们正在研究构建一个非常大型的Rails应用程序,并考虑使用引擎来更好地将“模块”从主应用程序中分离出来。

we have started this process by creating a small engine using the gem motorhead (the idea of its active_if component is wanted). 我们通过使用gem motorhead创建一个小型引擎开始了此过程(需要使用active_if组件的想法)。 That engine was then removed from the main app and given a git init, then pushed to github. 然后将该引擎从主应用程序中删除,并进行了git init,然后推送至github。

the main app then was able to pull the gem in within the Gemfile. 然后,主应用程序便能够将Gemfile中的宝石插入。

During this proof of concept, it works, but not very efficient, and also updating the new engine/gem is a bit awkward in this way as it is kinda a submodule in a way. 在此概念验证期间,它虽然有效,但效率不是很高,而且更新新引擎/ gem有点麻烦,因为它在某种程度上还是一个子模块。 What is the proper workflow for building and maintaining engines/gems when building a modular app like this? 在构建这样的模块化应用程序时,用于构建和维护引擎/宝石的正确工作流程是什么?

Thanks in advance 提前致谢

The most akward part about deploying Gems or Engines as modules is the constant need to update. 关于将Gems或Engines部署为模块的最尴尬的部分是不断需要更新。 We had a lot of success with using: 使用以下方法,我们取得了许多成功:

bundle config local.my_gem ~/projects/my_gem/

It'll point to the Gem/Engine version on disk without modifying the Gemfile and Gemfile.lock. 它将指向磁盘上的Gem / Engine版本,而不修改Gemfile和Gemfile.lock。

To remove the local override run: 要删除本地替代运行:

bundle config --delete local.my_gem ~/projects/my_gem/

With this you should be able to restrict the times the Gemfile.lock has to be updated to deployment time. 有了它,您应该能够限制Gemfile.lock必须更新为部署时间的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM