如何进行“捆绑安装”总是下载私人托管的 gem(在 Github 上)?
我们有一个 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您所说,我相信 update 命令似乎更适合您想要实现的目标,因为您可以强制私有 gem 更新而不影响不相关的 gem。
根据 bundle-update 手册页:
在您的开发环境中,您可以创建一个 bash 或其他脚本,以便与标准
捆绑安装
一起运行它。就 Heroku 部署而言,一旦您更新了 Gemfile.lock 更改并将其提交到 git 存储库,Heroku 就应该使用该版本,根据他们的文档:
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.
Per the bundle-update man page:
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: