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 Stack's snapshots without selecting them

Țugui Dragoș750a905479f8
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index 212bbf97..6a5909eb 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -569,6 +569,7 @@ public enum DeveloperCaches {
Definition(id: "stack", name: "Haskell Stack", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
Folder(".stack/pantry/hackage", .downloads, source: "https://github.com/commercialhaskell/stack/blob/master/doc/topics/stack_root.md#L228-L232"),
Folder(".stack/setup-exe-cache", .buildData, source: "https://github.com/commercialhaskell/stack/blob/master/doc/topics/stack_root.md#L279-L285"),
+ Folder(".stack/snapshots", .environments, source: "https://github.com/commercialhaskell/stack/blob/master/doc/topics/stack_root.md#L312-L318"),
]),
Definition(id: "opam", name: "opam", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
Folder(".opam/download-cache", .downloads, source: "https://github.com/ocaml/opam/blob/master/doc/pages/Manual.md#L41"),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index e04aeb61..762f0d6f 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -792,6 +792,17 @@ struct DeveloperCachesTests {
#expect(locations.map(\.url.lastPathComponent) == ["build"])
}
+ @Test func listsStacksSnapshotsWithoutEverSelectingThem() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file(".stack/snapshots/aarch64-osx/2f1c/9.8.4/lib/package.conf", bytes: 400_000)
+ let stack = DeveloperCaches.definitions.filter { $0.id == "stack" }
+
+ let locations = await DeveloperCaches.scan(stack, homeDirectory: directory.url).flatMap(\.locations)
+
+ #expect(locations.map(\.url.lastPathComponent) == ["snapshots"])
+ #expect(locations.first?.isRecommended == false)
+ }
+
/// 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 {