如何进行“捆绑安装”总是下载私人托管的 gem(在 Github 上)?

发布于 2024-12-09 06:52:35 字数 397 浏览 1 评论 0原文

我们有一个 gem,其中包含多个应用程序的共享代码。它托管在私人 github 存储库上。

我希望每个应用程序每次运行 bundle install 时都能自动获取该 gem 的最新版本,这样我团队的其他成员就可以轻松地始终保持最新状态,并且拥有一个在 Heroku 和我们的 Jenkins CI 服务器上进行简单部署。

据我了解,当运行 bundle install 时,如果已经成功安装了某个版本的 gem,则将使用它而不是任何较新的版本。

有没有办法强制捆绑器始终获取最新版本的 gem?

当我们部署或推送到 master(触发 Jenkins 运行)时,我们是否只需要使 bundle update 成为我们工作流程的常规部分?

We have a gem that contains shared code for multiple apps. It is hosted on a private 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)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

残花月 2024-12-16 06:52:35

正如您所说,我相信 update 命令似乎更适合您想要实现的目标,因为您可以强制私有 gem 更新而不影响不相关的 gem。

bundle update mygem

根据 bundle-update 手册页

更新指定的宝石...忽略
Gemfile.lock 中指定的先前安装的 gem。

在您的开发环境中,您可以创建一个 bash 或其他脚本,以便与标准捆绑安装一起运行它。

就 Heroku 部署而言,一旦您更新了 Gemfile.lock 更改并将其提交到 git 存储库,Heroku 就应该使用该版本,根据他们的文档

Gemfile.lock 确保您在 Heroku 上部署的 gems 版本与开发计算机上本地安装的版本匹配。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文