From cc219fe644a9ff667e664c32811b4b13439675fd Mon Sep 17 00:00:00 2001 From: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:48:03 -0400 Subject: [PATCH] Rename `MasAppLibrary` as `SoftwareMapAppLibrary`. Rename `AppLibraryMock` as `MockAppLibrary`. Partial #585 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> --- Sources/mas/Commands/Install.swift | 2 +- Sources/mas/Commands/List.swift | 2 +- Sources/mas/Commands/Lucky.swift | 2 +- Sources/mas/Commands/Outdated.swift | 2 +- Sources/mas/Commands/Purchase.swift | 2 +- Sources/mas/Commands/Uninstall.swift | 2 +- Sources/mas/Commands/Upgrade.swift | 2 +- .../{MasAppLibrary.swift => SoftwareMapAppLibrary.swift} | 4 ++-- Tests/masTests/Commands/InstallSpec.swift | 2 +- Tests/masTests/Commands/ListSpec.swift | 2 +- Tests/masTests/Commands/LuckySpec.swift | 2 +- Tests/masTests/Commands/OutdatedSpec.swift | 2 +- Tests/masTests/Commands/PurchaseSpec.swift | 2 +- Tests/masTests/Commands/UninstallSpec.swift | 2 +- Tests/masTests/Commands/UpgradeSpec.swift | 2 +- .../{AppLibraryMock.swift => MockAppLibrary.swift} | 6 +++--- ...AppLibrarySpec.swift => SoftwareMapAppLibrarySpec.swift} | 6 +++--- 17 files changed, 22 insertions(+), 22 deletions(-) rename Sources/mas/Controllers/{MasAppLibrary.swift => SoftwareMapAppLibrary.swift} (98%) rename Tests/masTests/Controllers/{AppLibraryMock.swift => MockAppLibrary.swift} (87%) rename Tests/masTests/Controllers/{MasAppLibrarySpec.swift => SoftwareMapAppLibrarySpec.swift} (88%) diff --git a/Sources/mas/Commands/Install.swift b/Sources/mas/Commands/Install.swift index 2b13081..9b051e7 100644 --- a/Sources/mas/Commands/Install.swift +++ b/Sources/mas/Commands/Install.swift @@ -23,7 +23,7 @@ extension MAS { /// Runs the command. func run() throws { - try run(appLibrary: MasAppLibrary()) + try run(appLibrary: SoftwareMapAppLibrary()) } func run(appLibrary: AppLibrary) throws { diff --git a/Sources/mas/Commands/List.swift b/Sources/mas/Commands/List.swift index eb782e2..94544c9 100644 --- a/Sources/mas/Commands/List.swift +++ b/Sources/mas/Commands/List.swift @@ -17,7 +17,7 @@ extension MAS { /// Runs the command. func run() throws { - try run(appLibrary: MasAppLibrary()) + try run(appLibrary: SoftwareMapAppLibrary()) } func run(appLibrary: AppLibrary) throws { diff --git a/Sources/mas/Commands/Lucky.swift b/Sources/mas/Commands/Lucky.swift index eba32b1..781f55f 100644 --- a/Sources/mas/Commands/Lucky.swift +++ b/Sources/mas/Commands/Lucky.swift @@ -25,7 +25,7 @@ extension MAS { /// Runs the command. func run() throws { - try run(appLibrary: MasAppLibrary(), searcher: ITunesSearchAppStoreSearcher()) + try run(appLibrary: SoftwareMapAppLibrary(), searcher: ITunesSearchAppStoreSearcher()) } func run(appLibrary: AppLibrary, searcher: AppStoreSearcher) throws { diff --git a/Sources/mas/Commands/Outdated.swift b/Sources/mas/Commands/Outdated.swift index 94f5039..a495c1b 100644 --- a/Sources/mas/Commands/Outdated.swift +++ b/Sources/mas/Commands/Outdated.swift @@ -23,7 +23,7 @@ extension MAS { /// Runs the command. func run() throws { - try run(appLibrary: MasAppLibrary(), searcher: ITunesSearchAppStoreSearcher()) + try run(appLibrary: SoftwareMapAppLibrary(), searcher: ITunesSearchAppStoreSearcher()) } func run(appLibrary: AppLibrary, searcher: AppStoreSearcher) throws { diff --git a/Sources/mas/Commands/Purchase.swift b/Sources/mas/Commands/Purchase.swift index 66f4c92..d775c64 100644 --- a/Sources/mas/Commands/Purchase.swift +++ b/Sources/mas/Commands/Purchase.swift @@ -20,7 +20,7 @@ extension MAS { /// Runs the command. func run() throws { - try run(appLibrary: MasAppLibrary()) + try run(appLibrary: SoftwareMapAppLibrary()) } func run(appLibrary: AppLibrary) throws { diff --git a/Sources/mas/Commands/Uninstall.swift b/Sources/mas/Commands/Uninstall.swift index 68561c7..d9997a7 100644 --- a/Sources/mas/Commands/Uninstall.swift +++ b/Sources/mas/Commands/Uninstall.swift @@ -24,7 +24,7 @@ extension MAS { /// Runs the uninstall command. func run() throws { - try run(appLibrary: MasAppLibrary()) + try run(appLibrary: SoftwareMapAppLibrary()) } func run(appLibrary: AppLibrary) throws { diff --git a/Sources/mas/Commands/Upgrade.swift b/Sources/mas/Commands/Upgrade.swift index a0db6f8..1c1630d 100644 --- a/Sources/mas/Commands/Upgrade.swift +++ b/Sources/mas/Commands/Upgrade.swift @@ -22,7 +22,7 @@ extension MAS { /// Runs the command. func run() throws { - try run(appLibrary: MasAppLibrary(), searcher: ITunesSearchAppStoreSearcher()) + try run(appLibrary: SoftwareMapAppLibrary(), searcher: ITunesSearchAppStoreSearcher()) } func run(appLibrary: AppLibrary, searcher: AppStoreSearcher) throws { diff --git a/Sources/mas/Controllers/MasAppLibrary.swift b/Sources/mas/Controllers/SoftwareMapAppLibrary.swift similarity index 98% rename from Sources/mas/Controllers/MasAppLibrary.swift rename to Sources/mas/Controllers/SoftwareMapAppLibrary.swift index d9e2f7d..7fc48e7 100644 --- a/Sources/mas/Controllers/MasAppLibrary.swift +++ b/Sources/mas/Controllers/SoftwareMapAppLibrary.swift @@ -1,5 +1,5 @@ // -// MasAppLibrary.swift +// SoftwareMapAppLibrary.swift // mas // // Created by Ben Chatelain on 12/27/18. @@ -10,7 +10,7 @@ import CommerceKit import ScriptingBridge /// Utility for managing installed apps. -class MasAppLibrary: AppLibrary { +class SoftwareMapAppLibrary: AppLibrary { /// CommerceKit's singleton manager of installed software. private let softwareMap: SoftwareMap diff --git a/Tests/masTests/Commands/InstallSpec.swift b/Tests/masTests/Commands/InstallSpec.swift index 88ad308..e2074c6 100644 --- a/Tests/masTests/Commands/InstallSpec.swift +++ b/Tests/masTests/Commands/InstallSpec.swift @@ -19,7 +19,7 @@ public class InstallSpec: QuickSpec { xdescribe("install command") { xit("installs apps") { expect { - try MAS.Install.parse([]).run(appLibrary: AppLibraryMock()) + try MAS.Install.parse([]).run(appLibrary: MockAppLibrary()) } .toNot(throwError()) } diff --git a/Tests/masTests/Commands/ListSpec.swift b/Tests/masTests/Commands/ListSpec.swift index c72bdf6..e9c02d6 100644 --- a/Tests/masTests/Commands/ListSpec.swift +++ b/Tests/masTests/Commands/ListSpec.swift @@ -21,7 +21,7 @@ public class ListSpec: QuickSpec { it("lists apps") { expect { try captureStream(stderr) { - try MAS.List.parse([]).run(appLibrary: AppLibraryMock()) + try MAS.List.parse([]).run(appLibrary: MockAppLibrary()) } } == "Error: No installed apps found\n" diff --git a/Tests/masTests/Commands/LuckySpec.swift b/Tests/masTests/Commands/LuckySpec.swift index 26eff44..cf35504 100644 --- a/Tests/masTests/Commands/LuckySpec.swift +++ b/Tests/masTests/Commands/LuckySpec.swift @@ -22,7 +22,7 @@ public class LuckySpec: QuickSpec { xdescribe("lucky command") { xit("installs the first app matching a search") { expect { - try MAS.Lucky.parse(["Slack"]).run(appLibrary: AppLibraryMock(), searcher: searcher) + try MAS.Lucky.parse(["Slack"]).run(appLibrary: MockAppLibrary(), searcher: searcher) } .toNot(throwError()) } diff --git a/Tests/masTests/Commands/OutdatedSpec.swift b/Tests/masTests/Commands/OutdatedSpec.swift index 6ca3d01..5831c56 100644 --- a/Tests/masTests/Commands/OutdatedSpec.swift +++ b/Tests/masTests/Commands/OutdatedSpec.swift @@ -36,7 +36,7 @@ public class OutdatedSpec: QuickSpec { let searcher = MockAppStoreSearcher() searcher.apps[mockSearchResult.trackId] = mockSearchResult - let mockAppLibrary = AppLibraryMock() + let mockAppLibrary = MockAppLibrary() mockAppLibrary.installedApps.append( SoftwareProductMock( appName: mockSearchResult.trackName, diff --git a/Tests/masTests/Commands/PurchaseSpec.swift b/Tests/masTests/Commands/PurchaseSpec.swift index 798a5e8..ac9db18 100644 --- a/Tests/masTests/Commands/PurchaseSpec.swift +++ b/Tests/masTests/Commands/PurchaseSpec.swift @@ -19,7 +19,7 @@ public class PurchaseSpec: QuickSpec { xdescribe("purchase command") { xit("purchases apps") { expect { - try MAS.Purchase.parse(["999"]).run(appLibrary: AppLibraryMock()) + try MAS.Purchase.parse(["999"]).run(appLibrary: MockAppLibrary()) } .toNot(throwError()) } diff --git a/Tests/masTests/Commands/UninstallSpec.swift b/Tests/masTests/Commands/UninstallSpec.swift index fbc3c1a..bfd68d0 100644 --- a/Tests/masTests/Commands/UninstallSpec.swift +++ b/Tests/masTests/Commands/UninstallSpec.swift @@ -26,7 +26,7 @@ public class UninstallSpec: QuickSpec { bundleVersion: "1.0", itemIdentifier: NSNumber(value: appID) ) - let mockLibrary = AppLibraryMock() + let mockLibrary = MockAppLibrary() context("dry run") { let uninstall = try! MAS.Uninstall.parse(["--dry-run", String(appID)]) diff --git a/Tests/masTests/Commands/UpgradeSpec.swift b/Tests/masTests/Commands/UpgradeSpec.swift index e2d42f6..6630777 100644 --- a/Tests/masTests/Commands/UpgradeSpec.swift +++ b/Tests/masTests/Commands/UpgradeSpec.swift @@ -22,7 +22,7 @@ public class UpgradeSpec: QuickSpec { expect { try captureStream(stderr) { try MAS.Upgrade.parse([]) - .run(appLibrary: AppLibraryMock(), searcher: MockAppStoreSearcher()) + .run(appLibrary: MockAppLibrary(), searcher: MockAppStoreSearcher()) } } == "Warning: Nothing found to upgrade\n" diff --git a/Tests/masTests/Controllers/AppLibraryMock.swift b/Tests/masTests/Controllers/MockAppLibrary.swift similarity index 87% rename from Tests/masTests/Controllers/AppLibraryMock.swift rename to Tests/masTests/Controllers/MockAppLibrary.swift index 96ac534..c992abc 100644 --- a/Tests/masTests/Controllers/AppLibraryMock.swift +++ b/Tests/masTests/Controllers/MockAppLibrary.swift @@ -1,5 +1,5 @@ // -// AppLibraryMock.swift +// MockAppLibrary.swift // masTests // // Created by Ben Chatelain on 12/27/18. @@ -8,7 +8,7 @@ @testable import mas -class AppLibraryMock: AppLibrary { +class MockAppLibrary: AppLibrary { var installedApps: [SoftwareProduct] = [] func uninstallApps(atPaths appPaths: [String]) throws { @@ -20,7 +20,7 @@ class AppLibraryMock: AppLibrary { } /// Members not part of the AppLibrary protocol that are only for test state management. -extension AppLibraryMock { +extension MockAppLibrary { /// Clears out the list of installed apps. func reset() { installedApps = [] diff --git a/Tests/masTests/Controllers/MasAppLibrarySpec.swift b/Tests/masTests/Controllers/SoftwareMapAppLibrarySpec.swift similarity index 88% rename from Tests/masTests/Controllers/MasAppLibrarySpec.swift rename to Tests/masTests/Controllers/SoftwareMapAppLibrarySpec.swift index f484eb5..47b29f4 100644 --- a/Tests/masTests/Controllers/MasAppLibrarySpec.swift +++ b/Tests/masTests/Controllers/SoftwareMapAppLibrarySpec.swift @@ -1,5 +1,5 @@ // -// MasAppLibrarySpec.swift +// SoftwareMapAppLibrarySpec.swift // masTests // // Created by Ben Chatelain on 3/1/20. @@ -11,9 +11,9 @@ import Quick @testable import mas -public class MasAppLibrarySpec: QuickSpec { +public class SoftwareMapAppLibrarySpec: QuickSpec { override public func spec() { - let library = MasAppLibrary(softwareMap: SoftwareMapMock(products: apps)) + let library = SoftwareMapAppLibrary(softwareMap: SoftwareMapMock(products: apps)) beforeSuite { MAS.initialize()