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 package registry Hex caches

Țugui Dragoșf0f618a2c9a9
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index 6a5909eb..1b2cef16 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -556,6 +556,7 @@ public enum DeveloperCaches {
]),
Definition(id: "hex", name: "Hex", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
Folder(".hex/packages", .downloads, source: "https://github.com/hexpm/hex/blob/main/lib/hex/scm.ex#L8"),
+ Folder(".hex/cache.ets", .cache, source: "https://github.com/hexpm/hex/blob/main/lib/hex/registry/server.ex#L8"),
]),
Definition(id: "rebar3", name: "rebar3", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
Folder(".cache/rebar3/hex", .downloads, source: "https://github.com/erlang/rebar3/blob/main/apps/rebar/src/rebar_packages.erl#L159-L160"),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 762f0d6f..a939f3b4 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -803,6 +803,17 @@ struct DeveloperCachesTests {
#expect(locations.first?.isRecommended == false)
}
+ @Test func offersTheRegistryHexCachesAndNeverItsAccountKey() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file(".hex/cache.ets", bytes: 400_000)
+ try directory.file(".hex/hex.config", bytes: 64)
+ let hex = DeveloperCaches.definitions.filter { $0.folders.contains { $0.path.hasPrefix(".hex/") } }
+
+ let locations = await DeveloperCaches.scan(hex, homeDirectory: directory.url).flatMap(\.locations)
+
+ #expect(locations.map(\.url.lastPathComponent) == ["cache.ets"])
+ }
+
/// 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 {