Introduction
We have a Rails5 application, which is splittend in about 10+ engines and a core application, which mounts these engines.
A engine in our case is a plain old rails engine defined as a gem and located in a dedicated git repository. The Gemfile
in the core application refers all engines (see below).
Required Behavior
- For deployments a specific version of the gem/engine should be used (by the core).
- For local development the
HEAD
of a local cloned repository should be used (by the core).
Current Setup
We achieved that by doing following steps for each engine in the core app:
- Adding
gem 'nice_engine1', '~> 0.0.1', branch: :develop, git: '[...]', tag: 'v0.0.1'
- Setting a bundler config entry:
bundle config local.nice_engine1 ../nice_engine1
That seems to work, however we didn't try to run a deployment with that setup yet.
Issues with that Setup
Everytime one of the repositories is updated locally and we run a bundle install
in the core, bundler updates the Gemfile.lock
to the new HEAD
ref of the local engine repository. We used to commit that change of the Gemfile.lock
.
Unfortunately does that cause some issues:
- If someone updates the core app, without updating the engines, it may happen, that the core
Gemfile.lock
refers to a git commit of an engine, which doesn't exist locally. That leads to errors if one tries to use the rails app. - At deployment time (I think) the
Gemfile.lock
may referring to a commit id, which is newer then the commit of the tag/version that I want to deploy. I'm not sure what will happen in that case, but I fear, that this will just lead us to troubles. - We have a lot of commits in the core changing the
Gemfile.lock
(potentially for each change in one of the engines). - Using another engine branch locally then
master
forces the developer to change the branch name in the main appsGemfile
Question
What would be the correct/best way to manage the Gemfile
and the Gemfile.lock
in the given situation to avoid these issues?
For some hints about best practices, improvement suggestions and so on, how to use bundler and git in order to fulfill our requirements, I'd be thankful.