heroku/heroku-buildpack-ruby — pull request #314 by schneems (2014-11-05 18:21:03+00:00)
Title: Ensure cache doesn't grow unbounded

Right now when we copy files over we use `cp -a`. This can result in duplicate files as it does not clear the directory when we copy assets:

```
2.1.4 /tmp
$ touch foo/woo
2.1.4 /tmp
$ cp -a foo/. bar
2.1.4 /tmp
$ ls bar
woo
2.1.4 /tmp
$ touch foo/zoo
2.1.4 /tmp
$ cp -a foo/. bar
2.1.4 /tmp
$ ls bar
woo	zoo
```

This behavior is somewhat unintuitive when calling `LanguagePack::Cache#store`. You can see the existing behavior of `LanguagePack::BundlerCache#store` was to clear before storing.

This PR makes the default behavior of store clearing out the target directory before copying over files.

When you want to copy over files in a folder without deleting use `LanguagePack::BundlerCache#add` which does a slightly better job of letting the user know that what they're doing might cause unbounded cache growth.