开发者

How do I make 'bundle install' always download a gem privately hosted (on Github)?

开发者 https://www.devze.com 2023-04-11 21:52 出处:网络
We have a gem that contains shared code for multiple apps. It is hosted on a pr开发者_如何学编程ivate github repo.

We have a gem that contains shared code for multiple apps. It is hosted on a pr开发者_如何学编程ivate github repo.

I want each app to automatically grab the latest version of that gem every time bundle install is run, so it is easy for the other members of my team to always be up to date, as well as having a simple deployment on Heroku and our Jenkins CI server.

It is my understanding that when bundle install is run, if some version of the gem has already been successfully installed, it will be used instead of any newer version.

Is there any way to force bundler to always get the latest version of the gem?

Do we just need to make bundle update a regular part of our workflow when we deploy or push to master (triggering a Jenkins run)?


As you said, I believe the update command seems like a better fit for what you are trying to achieve, since you can force the private gem update without affecting unrelated gems.

bundle update mygem

Per the bundle-update man page:

Update the gems specified ... ignoring the previously installed gems specified in the Gemfile.lock.

In your dev environment you could create a bash or other script for running this in tandem with a standard bundle install.

As far as Heroku deploys, once you have updated and committed your Gemfile.lock changes to your git repo, Heroku should use that version, per their docs:

Gemfile.lock ensures that your deployed versions of gems on Heroku match the version installed locally on your development machine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号