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.

Only the copy Homebrew installed is listed as Homebrew's

Țugui Dragoș9e1d459e5bd7
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift b/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift
index d6609782..6e444aef 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift
@@ -65,7 +65,7 @@ public struct Inventory: Sendable {
}
static func entry(for app: InstalledApp, casks: [HomebrewPackage], origins: DownloadOrigins?) -> InventoryEntry {
- let cask = CaskEvidence.cask(for: app, in: casks)
+ let cask = CaskEvidence.installedCask(for: app, in: casks)
let (source, detail) = origin(of: app, cask: cask, origins: origins)
return InventoryEntry(
name: app.name,
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InventoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InventoryTests.swift
index b1d74103..753848ed 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/InventoryTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/InventoryTests.swift
@@ -24,7 +24,7 @@ struct InventoryTests {
/// An app's update feed says where Peel asks about new versions, not where the app came from. Only the
/// receipt inside the bundle says App Store.
@Test func namesWhereEachAppCameFrom() {
- let cask = HomebrewPackage(name: "bear", kind: .cask, appNames: ["Bear.app"])
+ let cask = HomebrewPackage(name: "bear", kind: .cask, installedVersion: "2.0", appNames: ["Bear.app"])
let inventory = Inventory.build(
apps: [
app("Bear", bundleIdentifier: "net.shinyfrog.bear"),
@@ -48,6 +48,25 @@ struct InventoryTests {
#expect(inventory.entries.first { $0.name == "AdGuard" }?.sourceDetail == "https://example.com/appcast.xml")
}
+ @Test func onlyTheCopyHomebrewInstalledIsHomebrews() {
+ let cask = HomebrewPackage(
+ name: "sample", kind: .cask, installedVersion: "1.0",
+ appNames: ["Sample.app"], appTargets: ["/Applications/Sample.app"]
+ )
+ let homebrews = app("Sample", bundleIdentifier: "org.example.Sample")
+ let copy = InstalledApp(
+ url: URL(filePath: "/Users/Shared/Applications/Sample.app", directoryHint: .isDirectory),
+ bundleIdentifier: "org.example.Sample",
+ name: "Sample",
+ updateFeed: .sparkle(URL(string: "https://example.org/appcast.xml")!)
+ )
+
+ let entries = Inventory.build(apps: [homebrews, copy], casks: [cask]).entries
+
+ #expect(entries.first { $0.path == "/Applications/Sample.app" }?.source == "Homebrew")
+ #expect(entries.first { $0.path == "/Users/Shared/Applications/Sample.app" }?.source == "Sparkle")
+ }
+
/// For an app with no receipt, cask, or feed, the source is the download macOS recorded: the address a
/// browser gives the file (`kMDItemWhereFroms`), or the download its quarantine record names in Launch
/// Services' own list. Only a web address is kept, without what follows the path: a signed download carries