加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Heroku bundler不删除旧宝石版本

发布时间:2020-12-16 22:15:50 所属栏目:百科 来源:网络整理
导读:参见英文答案 Cleaning up the bundler cache when deploying to heroku2 我只是更新了几个宝石,但是当我推送到heroku,旧的仍然被复制在供应商/捆绑商,我有一个消息 Using bson (1.8.2)[...]Would have removed bson (1.5.2) 事实上,在供应商/捆绑商中,旧的
参见英文答案 > Cleaning up the bundler cache when deploying to heroku2
我只是更新了几个宝石,但是当我推送到heroku,旧的仍然被复制在供应商/捆绑商,我有一个消息
Using bson (1.8.2)
[...]
Would have removed bson (1.5.2)

事实上,在供应商/捆绑商中,旧的宝石仍然被复制.

但是,如果我创建一个新的雪松应用程序,并从头开始推送到Heroku,旧的宝石不会被复制到供应商/捆绑包中,并且按预期工作.

旧的宝石版本既不在Gemfile中,也不是Gemfile.lock,所以我不明白heroku bundler在哪里得到这个(过时的)信息.

任何提示?
谢谢,
马尔科

解决方法

这是Heroku部署配置中的一个错误.它写一个文件.bundle / config有一行:
BUNDLE_DRY_RUN: false

当bundler加载这个全局配置文件时,它会将其转换为:dry_run => “false”当它检查此设置时,它将检查设置[:dry_run],它是一个字符串,其计算结果为true.

感谢@Roman在类似的线程中的答案

我的解决方案是(因为我有一个自定义构建包)来修补它

https://github.com/heroku/heroku-buildpack-ruby/blob/master/lib/language_pack/ruby.rb

线408-409

puts "Cleaning up the bundler cache."
    pipe "bundle clean"

puts "Cleaning up the bundler cache."
    pipe "bundle config --delete dry_run"
    pipe "bundle clean"

bundle config –delete删除配置(注意下划线),默认情况下,dry-run为false.
作为结果

Removing bson_ext (1.8.2)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读