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.

Developer lists the images Tart keeps

Țugui Dragoșb9a97d2f68c7
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index e449a022..16eac382 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -704,6 +704,9 @@ public enum DeveloperCaches {
Definition(id: "lima", name: "Lima", systemImage: "server.rack", appBundleIdentifiers: [], folders: [
Folder("Library/Caches/lima", .downloads, source: "https://github.com/lima-vm/lima/blob/master/website/content/en/docs/dev/internals.md#L137-L145"),
]),
+ Definition(id: "tart", name: "Tart", systemImage: "server.rack", appBundleIdentifiers: [], folders: [
+ Folder(".tart/cache", .downloads, source: "https://github.com/cirruslabs/tart/blob/main/Sources/tart/Config.swift#L21"),
+ ]),
Definition(id: "colima", name: "Colima", systemImage: "server.rack", appBundleIdentifiers: [], folders: [
Folder("Library/Caches/colima", .downloads, source: "https://github.com/abiosoft/colima/blob/main/cmd/prune.go#L25-L41"),
]),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 7f0dd967..56412186 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -730,6 +730,18 @@ struct DeveloperCachesTests {
#expect(Set(locations.map(\.url.lastPathComponent)) == ["cache", "build-cache"])
}
+ @Test func offersTheImagesTartKeepsAndNeverItsMachines() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file(".tart/cache/OCIs/ghcr.io/cirruslabs/macos/disk.img", bytes: 400_000)
+ try directory.file(".tart/vms/builder/disk.img", bytes: 400_000)
+ let tart = DeveloperCaches.definitions.filter { $0.id == "tart" }
+
+ let locations = await DeveloperCaches.scan(tart, homeDirectory: directory.url).flatMap(\.locations)
+
+ #expect(locations.map(\.url.lastPathComponent) == ["cache"])
+ #expect(locations.first?.kind == .downloads)
+ }
+
/// virtualenvwrapper keeps the user's hook scripts beside the environments in `~/.virtualenvs`, so only the
/// environments are offered, and a link among them is left where it is, never followed.
@Test func offersVirtualenvwrappersEnvironmentsAndNotItsHooks() async throws {