16

a few days ago I started to see

 Would have removed best_in_place (2.0.2)
 Would have removed thor (0.16.0)

in my heroku deploy output.

It used to say that it removed the gem.

anyone know what's up with that?

update

heroku updated to latest ruby 1.9.3 and bundler cache cleaned fine.

Nick Ginanto
  • 31,090
  • 47
  • 134
  • 244
  • Possible duplicate of http://stackoverflow.com/questions/14533676/heroku-bundler-not-deleting-old-gems-versions – Odi Jan 26 '13 at 22:15
  • possible duplicate of [Cleaning up the bundler cache when deploying to heroku](http://stackoverflow.com/questions/14539232/cleaning-up-the-bundler-cache-when-deploying-to-heroku) – wuputah Feb 20 '13 at 02:03

5 Answers5

13

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.

You can remove this line by some shell commands (heroku run bash):

mv -f .bundle/config .bundle/config.orig
sed '/BUNDLE_DRY_RUN/d' < .bundle/config.orig > .bundle/config

And then run

bundle clean
Roman
  • 13,100
  • 2
  • 47
  • 63
  • thank you, it is working fine and solving my issue (http://stackoverflow.com/questions/14533676/heroku-bundler-not-deleting-old-gems-versions) –  Feb 14 '13 at 11:47
10

This is a bug in the bundler gem – essentially extra debugging info is being dumped to the screen. It should be patched in the next release. The removal would be from a cache, most likely because a newer version is available (latest best_in_place is 2.0.3, Thor 0.17.0). These can be safely ignored.

catsby
  • 11,276
  • 3
  • 37
  • 37
6

After some research, it appears this isn't a bug, but a feature!

as you can see here https://github.com/carlhuda/bundler/pull/2237

a dry_run flag has been implmented to act as if gems would have been removed and instead of removing them it just prints that

the actual code is here

 if Bundler.settings[:dry_run]
          Bundler.ui.info "Would have removed #{output}"
        else
          Bundler.ui.info "Removing #{output}"
          FileUtils.rm_rf(gem_dir)
        end

as you can see, if dry_run it prints thats. else it removes the gem

so as this is a feature and not a bug, it is not going to be fixed any time soon. This leaves a question for heroku (which I am waiting for a reply) as to why they are using dry_run..

Note for those that aren't aware - This bloats slug size

Nick Ginanto
  • 31,090
  • 47
  • 134
  • 244
4

@Roman explication is correct.

If you have a custom buildpack (or you can easily fork it ans use it) it can be fixed in one line

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.

  • Cool, this I call team work and cross-polination :) I'm going to use a custom build pack now. – Roman Feb 17 '13 at 09:57
2

This issue has now been fixed with the release of Bundler 1.3.2, which is now in use on Heroku in the latest official Ruby buildpack.

wuputah
  • 11,285
  • 1
  • 43
  • 60