Refactor and document Cleanup.
This commit is contained in:
parent
7d78949479
commit
5402500635
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user