Refactor and document Cleanup.

This commit is contained in:
Markus Reiter 2020-08-17 03:52:17 +02:00
parent 7d78949479
commit 5402500635
2 changed files with 111 additions and 106 deletions

View File

@ -6,8 +6,15 @@ require "formula"
require "cask/cask_loader"
require "set"
module Homebrew
# Helper class for cleaning up the Homebrew cache.
#
# @api private
class Cleanup
CLEANUP_DEFAULT_DAYS = 30
private_constant :CLEANUP_DEFAULT_DAYS
# `Pathname` refinement with helper functions for cleaning up files.
module CleanupRefinement
refine Pathname do
def incomplete?
@ -124,8 +131,6 @@ end
using CleanupRefinement
module Homebrew
class Cleanup
extend Predicable
PERIODIC_CLEAN_FILE = (HOMEBREW_CACHE/".cleaned").freeze

View File

@ -5,9 +5,9 @@ require "cleanup"
require "cask/cache"
require "fileutils"
using CleanupRefinement
using Homebrew::Cleanup::CleanupRefinement
describe CleanupRefinement do
describe Homebrew::Cleanup::CleanupRefinement do
describe "::prune?" do
alias_matcher :be_pruned, :be_prune