Rake task registers database path for rake-cleaning #412
+12
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rake ships with clean and clobber tasks out of the box. Now the audit Task can be (optionally) registered for cleaning.
It defaults to off so no change from current behavior. If opted-in, the audit-database path is added to rake's CLOBBER collection.
Clean is meant to remove temporary and generated files that are the result of "normal" application runs.
Clobber is intended to be a more exhaustive clean that returns the application's state to a "fresh cloned" state.
With these conventions, the ruby advisory db fits more cleanly (ha) into the "clobber" category.
prior art: Bundler's gem tasks itself:
https://github.com/ruby/rubygems/blob/master/bundler/lib/bundler/gem_tasks.rb#L3-L4
Bundler's tasks register the pkg path for clobbering unconditionally, but I think that makes sense given the limited scope of the pkg path. Since the ruby advisory db is written to a path outside of one's project, I believe the task should be more conservative in its deletion. Hence making it opt-in.
This PR does not yet have tests. If this enhancement is a viable candidate, I can add tests and documentation.