Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Homebrew's build caches and logs, SwiftLint, Tuist, and CocoaPods' index copy

Țugui Dragoșc562223a206c
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index 71e3eef6..bd98de02 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -127,6 +127,8 @@ public enum DeveloperCaches {
]),
Definition(id: "cocoapods", name: "CocoaPods", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
Folder("Library/Caches/CocoaPods", .downloads, source: "https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/config.rb#L23"),
+ // The CDN copy of the public spec index. The spec repositories a person added sit beside it and stay.
+ Folder(".cocoapods/repos/trunk", .cache, source: "https://github.com/CocoaPods/Core/blob/master/lib/cocoapods-core/trunk_source.rb#L2-L7"),
]),
Definition(id: "carthage", name: "Carthage", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
Folder("Library/Caches/org.carthage.CarthageKit", .downloads, source: "https://github.com/Carthage/Carthage/blob/master/Source/CarthageKit/Constants.swift#L31"),
@@ -135,6 +137,14 @@ public enum DeveloperCaches {
Folder("Library/Caches/Homebrew/downloads", .downloads, source: "https://github.com/Homebrew/brew/blob/main/Library/Homebrew/download_strategy/abstract_file_download_strategy.rb#L42"),
Folder("Library/Caches/Homebrew/Cask", .downloads, source: "https://github.com/Homebrew/brew/blob/main/Library/Homebrew/cask/cache.rb#L9"),
Folder("Library/Caches/Homebrew/bootsnap", .cache, source: "https://github.com/Homebrew/brew/blob/main/Library/Homebrew/startup/bootsnap.rb#L45"),
+ Folder("Library/Caches/Homebrew/*_cache", .cache, source: "https://github.com/Homebrew/brew/blob/main/Library/Homebrew/package_manager_cache.rb#L5-L27"),
+ Folder("Library/Logs/Homebrew", .logs, source: "https://github.com/Homebrew/brew/blob/main/Library/Homebrew/utils/os.sh#L55-L56"),
+ ]),
+ Definition(id: "swiftlint", name: "SwiftLint", systemImage: "swift", appBundleIdentifiers: [], folders: [
+ Folder("Library/Caches/SwiftLint", .cache, source: "https://github.com/realm/SwiftLint/blob/main/Source/SwiftLintFramework/Configuration/Configuration+Cache.swift#L80-L85"),
+ ]),
+ Definition(id: "tuist", name: "Tuist", systemImage: "hammer", appBundleIdentifiers: [], folders: [
+ Folder(".cache/tuist", .buildData, source: "https://github.com/tuist/tuist/blob/main/server/priv/docs/en/cli/directories.md"),
]),
// JavaScript
Definition(id: "npm", name: "npm", systemImage: "cube", appBundleIdentifiers: [], folders: [
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 8cb7d471..afe6ac26 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -1,5 +1,6 @@
import Foundation
@testable import PeelCore
+import PeelPrivileged
import Testing
struct DeveloperCachesTests {
@@ -143,7 +144,7 @@ struct DeveloperCachesTests {
let forbidden = [
".rustup", ".pyenv", ".nvm", ".sdkman", ".rbenv", ".jenv", "nix/store", ".nix-profile", ".asdf", ".volta",
"conda/envs", "miniconda3/envs", "anaconda3/envs", ".local/pipx",
- "Library/Android/sdk", "flutter/bin", ".cocoapods/repos",
+ "Library/Android/sdk", "flutter/bin",
".aws", ".ssh", ".gnupg", ".netrc", ".docker/config", ".kube/config", ".npmrc",
"qiskit-ibm.json", "qiskitrc", "dwave.conf", ".qcs", "xanadu-cloud", "pytket", ".qnx", "qbraidrc",
"credentials", "token",
@@ -157,12 +158,18 @@ struct DeveloperCachesTests {
// Coursier keeps the JVMs `cs java` installs beside its cache; a legacy `~/.ccache` holds `ccache.conf`.
"Library/Caches/Coursier", ".ccache",
]
+ // CocoaPods' spec repositories hold the ones a person added, which can carry unpushed work: only the CDN copy
+ // of the public index, `trunk`, is a cache.
+ let onlyThisPart = [".cocoapods/repos": ".cocoapods/repos/trunk"]
for definition in DeveloperCaches.definitions {
for path in definition.folders.map(\.path) {
for pattern in forbidden {
#expect(!path.lowercased().contains(pattern.lowercased()), "\(definition.id) lists \(path)")
}
#expect(!onlyInParts.contains(path), "\(definition.id) lists the whole of \(path)")
+ for (folder, part) in onlyThisPart where PathComponents.isPath(path, atOrInside: folder) {
+ #expect(path == part, "\(definition.id) lists \(path)")
+ }
}
}
}