Heroku bundler不删除旧的宝石版本 [英] Heroku bundler not deleting old gems versions
问题描述
我刚刚更新了几个宝石,但是当我推送到heroku时,旧的仍然被复制到vendor / bundler中,并且我有一条消息
使用bson(1.8.2)
$ p $但是,如果我创建一个新的雪松,那么我们就可以创建一个新的雪松。应用程序和我从头开始推到Heroku,旧的宝石不复制在供应商/包,它按预期工作。
[...]
会删除bson(1.5.2)
旧的宝石版本既不在Gemfile也不在Gemfile .lock,所以我不明白heroku捆绑器在哪里得到这个(过时的)信息。
任何提示?
感谢,
Marco解决方案这是Heroku部署配置中的一个错误。它写了一个文件.bundle / config,它有一行:
BUNDLE_DRY_RUN:false
当bundler加载这个全局配置文件时,它将它转换为
感谢@Roman在类似的线程中给出答案:dry_run => false
当它检查这个设置时,它检查设置[:dry_run],这是一个字符串,其值为真。
我的解决方案是(因为我有一个自定义的buildpack)来修补它
第408-409行
自 / p>
puts清理bundler缓存。
pipebundle clean
至
puts清理bundler缓存。
pipebundle config --delete dry_run
pipebundle clean
bundle config --delete删除配置(注意下划线),并且默认
dry-run
为false。
作为结果删除bson_ext(1.8.2)
I just updated few gems, but when I pushed to heroku, the old ones are still copied in vendor/bundler and I have a message
Using bson (1.8.2) [...] Would have removed bson (1.5.2)
and indeed, in vendor/bundler the old gems is still copied.
However, if I create a new cedar application and I push to Heroku from scratch, the old gem is not copied in vendor/bundle and it works as expected.
The old gem version is neither in Gemfile nor Gemfile.lock, so I do not understand where the heroku bundler is getting this (outdated) information.
Any hints? thanks, Marco
解决方案That's a bug in Heroku deployment configuration. It writes a file .bundle/config which has a line:
BUNDLE_DRY_RUN: false
When bundler loads this global config file, it translates this to
:dry_run => "false"
When it checks for this setting, it's checking settings[:dry_run], which is a string, which evaluates to true.Thanks to @Roman for the answer in a similar thread
My solution was (as I have a custom buildpack) to patch it
https://github.com/heroku/heroku-buildpack-ruby/blob/master/lib/language_pack/ruby.rb
line 408-409 from
puts "Cleaning up the bundler cache." pipe "bundle clean"
to
puts "Cleaning up the bundler cache." pipe "bundle config --delete dry_run" pipe "bundle clean"
bundle config --delete remove the config (note the underscore) and, by default
dry-run
is false. as a resultsRemoving bson_ext (1.8.2)
这篇关于Heroku bundler不删除旧的宝石版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!