Heroku bundler不删除旧的宝石版本 [英] Heroku bundler not deleting old gems versions

查看:112
本文介绍了Heroku bundler不删除旧的宝石版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了几个宝石,但是当我推送到heroku时,旧的仍然被复制到vendor / bundler中,并且我有一条消息

 使用bson(1.8.2)
[...]
会删除bson(1.5.2)


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



任何提示?
感谢,
Marco

解决方案

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

  BUNDLE_DRY_RUN:false 

当bundler加载这个全局配置文件时,它将它转换为:dry_run => false当它检查这个设置时,它检查设置[:dry_run],这是一个字符串,其值为真。

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



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



https:// github。



第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 results

      Removing bson_ext (1.8.2)

这篇关于Heroku bundler不删除旧的宝石版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆