mirror of
https://github.com/mas-cli/mas
synced 2024-11-23 03:53:09 +00:00
commit
69844b55d1
42 changed files with 495 additions and 100 deletions
|
@ -1,36 +0,0 @@
|
||||||
//
|
|
||||||
// mas-cli-Bridging-Header.h
|
|
||||||
// mas-cli
|
|
||||||
//
|
|
||||||
// Created by Andrew Naylor on 11/07/2015.
|
|
||||||
// Copyright © 2015 Andrew Naylor. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef mas_cli_Bridging_Header_h
|
|
||||||
#define mas_cli_Bridging_Header_h
|
|
||||||
|
|
||||||
@import Foundation;
|
|
||||||
|
|
||||||
//#import <StoreFoundation/ISStoreAccount.h>
|
|
||||||
//
|
|
||||||
//#import <CommerceKit/CKAccountStore.h>
|
|
||||||
//#import <CommerceKit/CKDownloadQueue.h>
|
|
||||||
//#import <CommerceKit/CKPurchaseController.h>
|
|
||||||
//#import <CommerceKit/CKSoftwareMap.h>
|
|
||||||
//#import <CommerceKit/CKUpdateController.h>
|
|
||||||
//
|
|
||||||
//#import <StoreFoundation/CKUpdate.h>
|
|
||||||
//#import <StoreFoundation/SSDownload.h>
|
|
||||||
//#import <StoreFoundation/SSDownloadMetadata.h>
|
|
||||||
//#import <StoreFoundation/SSDownloadPhase.h>
|
|
||||||
//#import <StoreFoundation/SSDownloadStatus.h>
|
|
||||||
//#import <StoreFoundation/SSPurchaseResponse.h>
|
|
||||||
//#import <StoreFoundation/ISStoreClient.h>
|
|
||||||
//#import <StoreFoundation/ISAuthenticationContext.h>
|
|
||||||
//#import <StoreFoundation/ISAuthenticationResponse.h>
|
|
||||||
//#import <StoreFoundation/ISServiceRemoteObject-Protocol.h>
|
|
||||||
//#import <StoreFoundation/ISAccountService-Protocol.h>
|
|
||||||
//#import "ISAccountService-Protocol.h"
|
|
||||||
//#import <StoreFoundation/ISServiceProxy.h>
|
|
||||||
|
|
||||||
#endif /* mas_cli_Bridging_Header_h */
|
|
|
@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- ✨🗑 `uninstall` command #81, #191
|
||||||
|
|
||||||
## [v1.4.4] 🧹 Cleanup - 2018-12-19
|
## [v1.4.4] 🧹 Cleanup - 2018-12-19
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,9 @@ class Mas < Formula
|
||||||
sha256 "237fd7270cb8f0d68a33e7ce05671a2e5c269d05d736abb0f66b50215439084e" => :high_sierra
|
sha256 "237fd7270cb8f0d68a33e7ce05671a2e5c269d05d736abb0f66b50215439084e" => :high_sierra
|
||||||
sha256 "237fd7270cb8f0d68a33e7ce05671a2e5c269d05d736abb0f66b50215439084e" => :sierra
|
sha256 "237fd7270cb8f0d68a33e7ce05671a2e5c269d05d736abb0f66b50215439084e" => :sierra
|
||||||
sha256 "237fd7270cb8f0d68a33e7ce05671a2e5c269d05d736abb0f66b50215439084e" => :el_capitan
|
sha256 "237fd7270cb8f0d68a33e7ce05671a2e5c269d05d736abb0f66b50215439084e" => :el_capitan
|
||||||
sha256 "237fd7270cb8f0d68a33e7ce05671a2e5c269d05d736abb0f66b50215439084e" => :yosemite
|
|
||||||
sha256 "237fd7270cb8f0d68a33e7ce05671a2e5c269d05d736abb0f66b50215439084e" => :mavericks
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
depends_on "trash"
|
||||||
depends_on "carthage" => :build
|
depends_on "carthage" => :build
|
||||||
depends_on :xcode => ["10.1", :build]
|
depends_on :xcode => ["10.1", :build]
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ class Mas < Formula
|
||||||
sha256 "fc6658113d785a660e3f4d2e4e134ad02fe003ffa7d69271a2c53f503aaae726" => :high_sierra
|
sha256 "fc6658113d785a660e3f4d2e4e134ad02fe003ffa7d69271a2c53f503aaae726" => :high_sierra
|
||||||
end
|
end
|
||||||
|
|
||||||
|
depends_on "trash"
|
||||||
depends_on "carthage" => :build
|
depends_on "carthage" => :build
|
||||||
depends_on :xcode => ["10.1", :build]
|
depends_on :xcode => ["10.1", :build]
|
||||||
|
|
||||||
|
|
22
MasKit/AppLibrary.swift
Normal file
22
MasKit/AppLibrary.swift
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
//
|
||||||
|
// AppLibrary.swift
|
||||||
|
// MasKit
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 12/27/18.
|
||||||
|
// Copyright © 2018 mas-cli. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
/// Utility for managing installed apps.
|
||||||
|
public protocol AppLibrary {
|
||||||
|
/// Finds an app by ID from the set of installed apps
|
||||||
|
///
|
||||||
|
/// - Parameter appId: MAS ID for app.
|
||||||
|
/// - Returns: Software Product of app if found; nil otherwise.
|
||||||
|
func installedApp(appId: UInt64) -> SoftwareProduct?
|
||||||
|
|
||||||
|
/// Uninstalls an app.
|
||||||
|
///
|
||||||
|
/// - Parameter app: App to be removed.
|
||||||
|
/// - Throws: Error if there is a problem.
|
||||||
|
func uninstallApp(app: SoftwareProduct) throws
|
||||||
|
}
|
12
MasKit/AppStore/CKSoftwareProduct+SoftwareProduct.swift
Normal file
12
MasKit/AppStore/CKSoftwareProduct+SoftwareProduct.swift
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
//
|
||||||
|
// File.swift
|
||||||
|
// MasKit
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 12/27/18.
|
||||||
|
// Copyright © 2018 mas-cli. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import StoreFoundation
|
||||||
|
|
||||||
|
// MARK: - SoftwareProduct
|
||||||
|
extension CKSoftwareProduct: SoftwareProduct {}
|
|
@ -16,15 +16,15 @@ public struct InstallCommand: CommandProtocol {
|
||||||
public let function = "Install from the Mac App Store"
|
public let function = "Install from the Mac App Store"
|
||||||
|
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
public func run(_ options: Options) -> Result<(), MASError> {
|
public func run(_ options: Options) -> Result<(), MASError> {
|
||||||
// Try to download applications with given identifiers and collect results
|
// Try to download applications with given identifiers and collect results
|
||||||
let downloadResults = options.appIds.compactMap { (appId) -> MASError? in
|
let downloadResults = options.appIds.compactMap { (appId) -> MASError? in
|
||||||
if let product = installedApp(appId) , !options.forceInstall {
|
if let product = installedApp(appId), !options.forceInstall {
|
||||||
printWarning("\(product.appName) is already installed")
|
printWarning("\(product.appName) is already installed")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return download(appId)
|
return download(appId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ public struct InstallCommand: CommandProtocol {
|
||||||
return .failure(.downloadFailed(error: nil))
|
return .failure(.downloadFailed(error: nil))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func installedApp(_ appId: UInt64) -> CKSoftwareProduct? {
|
fileprivate func installedApp(_ appId: UInt64) -> CKSoftwareProduct? {
|
||||||
let appId = NSNumber(value: appId)
|
let appId = NSNumber(value: appId)
|
||||||
|
|
||||||
let softwareMap = CKSoftwareMap.shared()
|
let softwareMap = CKSoftwareMap.shared()
|
||||||
return softwareMap.allProducts()?.first { $0.itemIdentifier == appId }
|
return softwareMap.allProducts()?.first { $0.itemIdentifier == appId }
|
||||||
}
|
}
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
import Commandant
|
import Commandant
|
||||||
import Result
|
import Result
|
||||||
|
|
||||||
import CommerceKit
|
import CommerceKit
|
||||||
|
|
||||||
public struct LuckyCommand: CommandProtocol {
|
public struct LuckyCommand: CommandProtocol {
|
|
@ -16,7 +16,7 @@ public struct ResetCommand: CommandProtocol {
|
||||||
public let function = "Resets the Mac App Store"
|
public let function = "Resets the Mac App Store"
|
||||||
|
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
public func run(_ options: Options) -> Result<(), MASError> {
|
public func run(_ options: Options) -> Result<(), MASError> {
|
||||||
/*
|
/*
|
||||||
The "Reset Application" command in the Mac App Store debug menu performs
|
The "Reset Application" command in the Mac App Store debug menu performs
|
||||||
|
@ -26,7 +26,7 @@ public struct ResetCommand: CommandProtocol {
|
||||||
- killall storeagent (storeagent no longer exists)
|
- killall storeagent (storeagent no longer exists)
|
||||||
- rm com.apple.appstore download directory
|
- rm com.apple.appstore download directory
|
||||||
- clear cookies (appears to be a no-op)
|
- clear cookies (appears to be a no-op)
|
||||||
|
|
||||||
As storeagent no longer exists we will implement a slight variant and kill all
|
As storeagent no longer exists we will implement a slight variant and kill all
|
||||||
App Store-associated processes
|
App Store-associated processes
|
||||||
- storeaccountd
|
- storeaccountd
|
||||||
|
@ -35,7 +35,7 @@ public struct ResetCommand: CommandProtocol {
|
||||||
- storeinstalld
|
- storeinstalld
|
||||||
- storelegacy
|
- storelegacy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Kill processes
|
// Kill processes
|
||||||
let killProcs = [
|
let killProcs = [
|
||||||
"Dock",
|
"Dock",
|
||||||
|
@ -45,24 +45,24 @@ public struct ResetCommand: CommandProtocol {
|
||||||
"storeinstalld",
|
"storeinstalld",
|
||||||
"storelegacy",
|
"storelegacy",
|
||||||
]
|
]
|
||||||
|
|
||||||
let kill = Process()
|
let kill = Process()
|
||||||
let stdout = Pipe()
|
let stdout = Pipe()
|
||||||
let stderr = Pipe()
|
let stderr = Pipe()
|
||||||
|
|
||||||
kill.launchPath = "/usr/bin/killall"
|
kill.launchPath = "/usr/bin/killall"
|
||||||
kill.arguments = killProcs
|
kill.arguments = killProcs
|
||||||
kill.standardOutput = stdout
|
kill.standardOutput = stdout
|
||||||
kill.standardError = stderr
|
kill.standardError = stderr
|
||||||
|
|
||||||
kill.launch()
|
kill.launch()
|
||||||
kill.waitUntilExit()
|
kill.waitUntilExit()
|
||||||
|
|
||||||
if kill.terminationStatus != 0 && options.debug {
|
if kill.terminationStatus != 0 && options.debug {
|
||||||
let output = stderr.fileHandleForReading.readDataToEndOfFile()
|
let output = stderr.fileHandleForReading.readDataToEndOfFile()
|
||||||
printInfo("killall failed:\r\n\(String(data: output, encoding: String.Encoding.utf8)!)")
|
printInfo("killall failed:\r\n\(String(data: output, encoding: String.Encoding.utf8)!)")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wipe Download Directory
|
// Wipe Download Directory
|
||||||
if let directory = CKDownloadDirectory(nil) {
|
if let directory = CKDownloadDirectory(nil) {
|
||||||
do {
|
do {
|
|
@ -18,6 +18,8 @@ struct ResultKeys {
|
||||||
static let Price = "price"
|
static let Price = "price"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Search the Mac App Store using the iTunes Search API:
|
||||||
|
/// https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/
|
||||||
public struct SearchCommand: CommandProtocol {
|
public struct SearchCommand: CommandProtocol {
|
||||||
public typealias Options = SearchOptions
|
public typealias Options = SearchOptions
|
||||||
public let verb = "search"
|
public let verb = "search"
|
77
MasKit/Commands/Uninstall.swift
Normal file
77
MasKit/Commands/Uninstall.swift
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
//
|
||||||
|
// Upgrade.swift
|
||||||
|
// mas-cli
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 2018-12-27.
|
||||||
|
// Copyright © 2015 Andrew Naylor. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Commandant
|
||||||
|
import Result
|
||||||
|
import CommerceKit
|
||||||
|
import StoreFoundation
|
||||||
|
|
||||||
|
/// Command which uninstalls apps managed by the Mac App Store.
|
||||||
|
public struct UninstallCommand: CommandProtocol {
|
||||||
|
public typealias Options = UninstallOptions
|
||||||
|
public let verb = "uninstall"
|
||||||
|
public let function = "Uninstall app installed from the Mac App Store"
|
||||||
|
|
||||||
|
private let appLibrary: AppLibrary
|
||||||
|
|
||||||
|
/// Designated initializer.
|
||||||
|
///
|
||||||
|
/// - Parameter appLibrary: <#appLibrary description#>
|
||||||
|
public init(appLibrary: AppLibrary = MasAppLibrary()) {
|
||||||
|
self.appLibrary = appLibrary
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Runs the uninstall command.
|
||||||
|
///
|
||||||
|
/// - Parameter options: UninstallOptions (arguments) for this command
|
||||||
|
/// - Returns: Success or an error.
|
||||||
|
public func run(_ options: Options) -> Result<(), MASError> {
|
||||||
|
let appId = UInt64(options.appId)
|
||||||
|
|
||||||
|
guard let product = appLibrary.installedApp(appId: appId) else {
|
||||||
|
return .failure(.notInstalled)
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.dryRun {
|
||||||
|
printInfo("\(product.appName) \(product.bundlePath)")
|
||||||
|
printInfo("(not removed, dry run)")
|
||||||
|
|
||||||
|
return .success(())
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
try appLibrary.uninstallApp(app: product)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return .failure(.uninstallFailed)
|
||||||
|
}
|
||||||
|
|
||||||
|
return .success(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Options for the uninstall command.
|
||||||
|
public struct UninstallOptions: OptionsProtocol {
|
||||||
|
/// Numeric app ID
|
||||||
|
let appId: Int
|
||||||
|
|
||||||
|
/// Flag indicating that removal shouldn't be performed
|
||||||
|
let dryRun: Bool
|
||||||
|
|
||||||
|
static func create(_ appId: Int) -> (_ dryRun: Bool) -> UninstallOptions {
|
||||||
|
return { dryRun in
|
||||||
|
return UninstallOptions(appId: appId, dryRun: dryRun)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func evaluate(_ m: CommandMode) -> Result<UninstallOptions, CommandantError<MASError>> {
|
||||||
|
return create
|
||||||
|
<*> m <| Argument(usage: "ID of app to uninstall")
|
||||||
|
<*> m <| Switch(flag: nil, key: "dry-run", usage: "dry run")
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,6 +22,9 @@ public enum MASError: Error, CustomStringConvertible, Equatable {
|
||||||
case searchFailed
|
case searchFailed
|
||||||
case noSearchResultsFound
|
case noSearchResultsFound
|
||||||
|
|
||||||
|
case notInstalled
|
||||||
|
case uninstallFailed
|
||||||
|
|
||||||
public var description: String {
|
public var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .notSignedIn:
|
case .notSignedIn:
|
||||||
|
@ -67,7 +70,13 @@ public enum MASError: Error, CustomStringConvertible, Equatable {
|
||||||
return "Search failed"
|
return "Search failed"
|
||||||
|
|
||||||
case .noSearchResultsFound:
|
case .noSearchResultsFound:
|
||||||
return "No results found"
|
return "No results found"
|
||||||
|
|
||||||
|
case .notInstalled:
|
||||||
|
return "Not installed"
|
||||||
|
|
||||||
|
case .uninstallFailed:
|
||||||
|
return "Uninstall failed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
78
MasKit/MasAppLibrary.swift
Normal file
78
MasKit/MasAppLibrary.swift
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
//
|
||||||
|
// MasAppLibrary.swift
|
||||||
|
// MasKit
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 12/27/18.
|
||||||
|
// Copyright © 2018 mas-cli. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import CommerceKit
|
||||||
|
|
||||||
|
/// Utility for managing installed apps.
|
||||||
|
public class MasAppLibrary: AppLibrary {
|
||||||
|
/// CommerceKit's singleton manager of installed software.
|
||||||
|
private let softwareMap = CKSoftwareMap.shared()
|
||||||
|
|
||||||
|
public init() {}
|
||||||
|
|
||||||
|
/// Finds an app by ID from the set of installed apps
|
||||||
|
///
|
||||||
|
/// - Parameter appId: MAS ID for app.
|
||||||
|
/// - Returns: Software Product of app if found; nil otherwise.
|
||||||
|
public func installedApp(appId: UInt64) -> SoftwareProduct? {
|
||||||
|
let appId = NSNumber(value: appId)
|
||||||
|
return softwareMap.allProducts()?.first { $0.itemIdentifier == appId }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Uninstalls an app.
|
||||||
|
///
|
||||||
|
/// - Parameter app: App to be removed.
|
||||||
|
/// - Throws: Error if there is a problem.
|
||||||
|
public func uninstallApp(app: SoftwareProduct) throws {
|
||||||
|
let status = trash(path: app.bundlePath)
|
||||||
|
if !status {
|
||||||
|
throw MASError.uninstallFailed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Runs the trash command in another process. Relies on the "trash" command
|
||||||
|
/// from Homebrew. Trash requires el_capitan or higher for core bottles:
|
||||||
|
/// https://github.com/Homebrew/homebrew-core/blob/master/Formula/trash.rb
|
||||||
|
///
|
||||||
|
/// - Parameter path: Absolute path to the application bundle to uninstall.
|
||||||
|
/// - Returns: true on success; fail on error
|
||||||
|
func trash(path: String) -> Bool {
|
||||||
|
let binaryPath = "/usr/local/bin/trash"
|
||||||
|
let process = Process()
|
||||||
|
let stdout = Pipe()
|
||||||
|
let stderr = Pipe()
|
||||||
|
|
||||||
|
process.standardOutput = stdout
|
||||||
|
process.standardError = stderr
|
||||||
|
process.arguments = [path]
|
||||||
|
|
||||||
|
if #available(OSX 10.13, *) {
|
||||||
|
process.executableURL = URL(fileURLWithPath: binaryPath)
|
||||||
|
do {
|
||||||
|
try process.run()
|
||||||
|
} catch {
|
||||||
|
printError("Unable to launch trash command")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
process.launchPath = binaryPath
|
||||||
|
process.launch()
|
||||||
|
}
|
||||||
|
|
||||||
|
process.waitUntilExit()
|
||||||
|
|
||||||
|
if process.terminationStatus == 0 {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
let reason = process.terminationReason
|
||||||
|
let output = stderr.fileHandleForReading.readDataToEndOfFile()
|
||||||
|
printError("Uninstall failed: \(reason)\n\(String(data: output, encoding: .utf8)!)")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,8 +6,6 @@
|
||||||
// Copyright © 2018 Andrew Naylor. All rights reserved.
|
// Copyright © 2018 Andrew Naylor. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
@import CommerceKit;
|
|
||||||
@import StoreFoundation;
|
|
||||||
@import Cocoa;
|
@import Cocoa;
|
||||||
|
|
||||||
//! Project version number for MasKit.
|
//! Project version number for MasKit.
|
||||||
|
|
14
MasKit/SoftwareProduct.swift
Normal file
14
MasKit/SoftwareProduct.swift
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
//
|
||||||
|
// SoftwareProduct.swift
|
||||||
|
// MasKit
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 12/27/18.
|
||||||
|
// Copyright © 2018 mas-cli. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
/// Protocol describing the members of CKSoftwareProduct used throughout MasKit.
|
||||||
|
public protocol SoftwareProduct {
|
||||||
|
var appName: String { get }
|
||||||
|
var bundlePath: String { get set }
|
||||||
|
var itemIdentifier: NSNumber { get set }
|
||||||
|
}
|
25
MasKitTests/Commands/ListCommandSpec.swift
Normal file
25
MasKitTests/Commands/ListCommandSpec.swift
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// ListCommandSpec.swift
|
||||||
|
// MasKitTests
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 2018-12-27.
|
||||||
|
// Copyright © 2018 mas-cli. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
@testable import MasKit
|
||||||
|
import Result
|
||||||
|
import Quick
|
||||||
|
import Nimble
|
||||||
|
|
||||||
|
class ListCommandSpec: QuickSpec {
|
||||||
|
override func spec() {
|
||||||
|
describe("list command") {
|
||||||
|
it("lists stuff") {
|
||||||
|
let list = ListCommand()
|
||||||
|
let result = list.run(ListCommand.Options())
|
||||||
|
print(result)
|
||||||
|
// expect(result).to(beSuccess())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -60,26 +60,3 @@ class SearchSpec: QuickSpec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Nimble predicate for result enum success case, no associated value
|
|
||||||
private func beSuccess() -> Predicate<Result<(), MASError>> {
|
|
||||||
return Predicate.define("be <success>") { expression, message in
|
|
||||||
if let actual = try expression.evaluate(),
|
|
||||||
case .success = actual {
|
|
||||||
return PredicateResult(status: .matches, message: message)
|
|
||||||
}
|
|
||||||
return PredicateResult(status: .fail, message: message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Nimble predicate for result enum failure with associated error
|
|
||||||
private func beFailure(test: @escaping (MASError) -> Void = { _ in }) -> Predicate<Result<(), MASError>> {
|
|
||||||
return Predicate.define("be <failure>") { expression, message in
|
|
||||||
if let actual = try expression.evaluate(),
|
|
||||||
case let .failure(error) = actual {
|
|
||||||
test(error)
|
|
||||||
return PredicateResult(status: .matches, message: message)
|
|
||||||
}
|
|
||||||
return PredicateResult(status: .fail, message: message)
|
|
||||||
}
|
|
||||||
}
|
|
75
MasKitTests/Commands/UninstallCommandSpec.swift
Normal file
75
MasKitTests/Commands/UninstallCommandSpec.swift
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
//
|
||||||
|
// UninstallCommandSpec.swift
|
||||||
|
// MasKitTests
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 2018-12-27.
|
||||||
|
// Copyright © 2018 mas-cli. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
@testable import MasKit
|
||||||
|
import Result
|
||||||
|
import Quick
|
||||||
|
import Nimble
|
||||||
|
|
||||||
|
class UninstallCommandSpec: QuickSpec {
|
||||||
|
override func spec() {
|
||||||
|
describe("uninstall command") {
|
||||||
|
let appId = 12345
|
||||||
|
let app = MockSoftwareProduct(
|
||||||
|
appName: "Some App",
|
||||||
|
bundlePath: "/tmp/Some.app",
|
||||||
|
itemIdentifier: NSNumber(value: appId)
|
||||||
|
)
|
||||||
|
let mockLibrary = MockAppLibrary()
|
||||||
|
let uninstall = UninstallCommand(appLibrary: mockLibrary)
|
||||||
|
|
||||||
|
context("dry run") {
|
||||||
|
let options = UninstallCommand.Options(appId: appId, dryRun: true)
|
||||||
|
|
||||||
|
it("can't remove a missing app") {
|
||||||
|
mockLibrary.apps = []
|
||||||
|
|
||||||
|
let result = uninstall.run(options)
|
||||||
|
expect(result).to(beFailure { error in
|
||||||
|
expect(error) == .notInstalled
|
||||||
|
})
|
||||||
|
}
|
||||||
|
it("finds an app") {
|
||||||
|
mockLibrary.apps.append(app)
|
||||||
|
|
||||||
|
let result = uninstall.run(options)
|
||||||
|
expect(result).to(beSuccess())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
context("wet run") {
|
||||||
|
let options = UninstallCommand.Options(appId: appId, dryRun: false)
|
||||||
|
|
||||||
|
it("can't remove a missing app") {
|
||||||
|
mockLibrary.apps = []
|
||||||
|
|
||||||
|
let result = uninstall.run(options)
|
||||||
|
expect(result).to(beFailure { error in
|
||||||
|
expect(error) == .notInstalled
|
||||||
|
})
|
||||||
|
}
|
||||||
|
it("removes an app") {
|
||||||
|
mockLibrary.apps.append(app)
|
||||||
|
|
||||||
|
let result = uninstall.run(options)
|
||||||
|
expect(result).to(beSuccess())
|
||||||
|
}
|
||||||
|
it("fails if there is a problem with the trash command") {
|
||||||
|
mockLibrary.apps = []
|
||||||
|
var brokenUninstall = app // make mutable copy
|
||||||
|
brokenUninstall.bundlePath = "/dev/null"
|
||||||
|
mockLibrary.apps.append(brokenUninstall)
|
||||||
|
|
||||||
|
let result = uninstall.run(options)
|
||||||
|
expect(result).to(beFailure { error in
|
||||||
|
expect(error) == .uninstallFailed
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -98,4 +98,14 @@ class MASErrorTestCase: XCTestCase {
|
||||||
error = .noSearchResultsFound
|
error = .noSearchResultsFound
|
||||||
XCTAssertEqual(error.description, "No results found")
|
XCTAssertEqual(error.description, "No results found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testNotInstalled() {
|
||||||
|
error = .notInstalled
|
||||||
|
XCTAssertEqual(error.description, "Not installed")
|
||||||
|
}
|
||||||
|
|
||||||
|
func testUninstallFailed() {
|
||||||
|
error = .uninstallFailed
|
||||||
|
XCTAssertEqual(error.description, "Uninstall failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
30
MasKitTests/Mocks/MockAppLibrary.swift
Normal file
30
MasKitTests/Mocks/MockAppLibrary.swift
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// MockAppLibrary.swift
|
||||||
|
// MasKitTests
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 12/27/18.
|
||||||
|
// Copyright © 2018 mas-cli. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
@testable import MasKit
|
||||||
|
|
||||||
|
class MockAppLibrary: AppLibrary {
|
||||||
|
var apps = [SoftwareProduct]()
|
||||||
|
|
||||||
|
func installedApp(appId: UInt64) -> SoftwareProduct? {
|
||||||
|
return apps.first { $0.itemIdentifier == NSNumber(value: appId) }
|
||||||
|
}
|
||||||
|
|
||||||
|
func uninstallApp(app: SoftwareProduct) throws {
|
||||||
|
if !apps.contains(where: { (product) -> Bool in
|
||||||
|
return app.itemIdentifier == product.itemIdentifier
|
||||||
|
}) { throw MASError.notInstalled }
|
||||||
|
|
||||||
|
// Special case for testing where we pretend the trash command failed
|
||||||
|
if app.bundlePath == "/dev/null" {
|
||||||
|
throw MASError.uninstallFailed
|
||||||
|
}
|
||||||
|
|
||||||
|
// Success is the default, watch out for false positives!
|
||||||
|
}
|
||||||
|
}
|
15
MasKitTests/Mocks/MockSoftwareProduct.swift
Normal file
15
MasKitTests/Mocks/MockSoftwareProduct.swift
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
//
|
||||||
|
// MockSoftwareProduct.swift
|
||||||
|
// MasKitTests
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 12/27/18.
|
||||||
|
// Copyright © 2018 mas-cli. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
@testable import MasKit
|
||||||
|
|
||||||
|
struct MockSoftwareProduct: SoftwareProduct {
|
||||||
|
var appName: String
|
||||||
|
var bundlePath: String
|
||||||
|
var itemIdentifier: NSNumber
|
||||||
|
}
|
34
MasKitTests/ResultPredicates.swift
Normal file
34
MasKitTests/ResultPredicates.swift
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
//
|
||||||
|
// ResultPreticates.swift
|
||||||
|
// MasKitTests
|
||||||
|
//
|
||||||
|
// Created by Ben Chatelain on 12/27/18.
|
||||||
|
// Copyright © 2018 mas-cli. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
@testable import MasKit
|
||||||
|
import Result
|
||||||
|
import Nimble
|
||||||
|
|
||||||
|
/// Nimble predicate for result enum success case, no associated value
|
||||||
|
func beSuccess() -> Predicate<Result<(), MASError>> {
|
||||||
|
return Predicate.define("be <success>") { expression, message in
|
||||||
|
if let actual = try expression.evaluate(),
|
||||||
|
case .success = actual {
|
||||||
|
return PredicateResult(status: .matches, message: message)
|
||||||
|
}
|
||||||
|
return PredicateResult(status: .fail, message: message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Nimble predicate for result enum failure with associated error
|
||||||
|
func beFailure(test: @escaping (MASError) -> Void = { _ in }) -> Predicate<Result<(), MASError>> {
|
||||||
|
return Predicate.define("be <failure>") { expression, message in
|
||||||
|
if let actual = try expression.evaluate(),
|
||||||
|
case let .failure(error) = actual {
|
||||||
|
test(error)
|
||||||
|
return PredicateResult(status: .matches, message: message)
|
||||||
|
}
|
||||||
|
return PredicateResult(status: .fail, message: message)
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,16 @@
|
||||||
B5552937219A23FF00ACB4CA /* Quick.framework in Copy Carthage Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB406A213F4DDD0044E445 /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
B5552937219A23FF00ACB4CA /* Quick.framework in Copy Carthage Frameworks */ = {isa = PBXBuildFile; fileRef = 90CB406A213F4DDD0044E445 /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
B5793E29219BDD4800135B39 /* JSON in Resources */ = {isa = PBXBuildFile; fileRef = B5793E28219BDD4800135B39 /* JSON */; };
|
B5793E29219BDD4800135B39 /* JSON in Resources */ = {isa = PBXBuildFile; fileRef = B5793E28219BDD4800135B39 /* JSON */; };
|
||||||
B5793E2B219BE0CD00135B39 /* MockURLSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5793E2A219BE0CD00135B39 /* MockURLSession.swift */; };
|
B5793E2B219BE0CD00135B39 /* MockURLSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5793E2A219BE0CD00135B39 /* MockURLSession.swift */; };
|
||||||
|
B594B12021D53A8200F3AC59 /* Uninstall.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B11F21D53A8200F3AC59 /* Uninstall.swift */; };
|
||||||
|
B594B12221D5416100F3AC59 /* ListCommandSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B12121D5416100F3AC59 /* ListCommandSpec.swift */; };
|
||||||
|
B594B12521D580BB00F3AC59 /* UninstallCommandSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B12421D580BB00F3AC59 /* UninstallCommandSpec.swift */; };
|
||||||
|
B594B12721D5825800F3AC59 /* AppLibrary.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B12621D5825800F3AC59 /* AppLibrary.swift */; };
|
||||||
|
B594B12921D5831D00F3AC59 /* SoftwareProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B12821D5831D00F3AC59 /* SoftwareProduct.swift */; };
|
||||||
|
B594B12B21D5837200F3AC59 /* CKSoftwareProduct+SoftwareProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B12A21D5837200F3AC59 /* CKSoftwareProduct+SoftwareProduct.swift */; };
|
||||||
|
B594B12E21D5850700F3AC59 /* MockAppLibrary.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B12D21D5850700F3AC59 /* MockAppLibrary.swift */; };
|
||||||
|
B594B13021D5855D00F3AC59 /* MasAppLibrary.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B12F21D5855D00F3AC59 /* MasAppLibrary.swift */; };
|
||||||
|
B594B13221D5876200F3AC59 /* ResultPredicates.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B13121D5876200F3AC59 /* ResultPredicates.swift */; };
|
||||||
|
B594B13421D5897100F3AC59 /* MockSoftwareProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = B594B13321D5897100F3AC59 /* MockSoftwareProduct.swift */; };
|
||||||
ED031A7C1B5127C00097692E /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED031A7B1B5127C00097692E /* main.swift */; };
|
ED031A7C1B5127C00097692E /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED031A7B1B5127C00097692E /* main.swift */; };
|
||||||
F83213892173D3E1008BA8A0 /* CKAccountStore.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB719B20F2EC4500F56FDC /* CKAccountStore.h */; };
|
F83213892173D3E1008BA8A0 /* CKAccountStore.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB719B20F2EC4500F56FDC /* CKAccountStore.h */; };
|
||||||
F832138A2173D3E1008BA8A0 /* CKDownloadQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB719C20F2EC4500F56FDC /* CKDownloadQueue.h */; };
|
F832138A2173D3E1008BA8A0 /* CKDownloadQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F8FB719C20F2EC4500F56FDC /* CKDownloadQueue.h */; };
|
||||||
|
@ -156,6 +166,16 @@
|
||||||
B555292C219A1FE700ACB4CA /* SearchSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchSpec.swift; sourceTree = "<group>"; };
|
B555292C219A1FE700ACB4CA /* SearchSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchSpec.swift; sourceTree = "<group>"; };
|
||||||
B5793E28219BDD4800135B39 /* JSON */ = {isa = PBXFileReference; lastKnownFileType = folder; path = JSON; sourceTree = "<group>"; };
|
B5793E28219BDD4800135B39 /* JSON */ = {isa = PBXFileReference; lastKnownFileType = folder; path = JSON; sourceTree = "<group>"; };
|
||||||
B5793E2A219BE0CD00135B39 /* MockURLSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockURLSession.swift; sourceTree = "<group>"; };
|
B5793E2A219BE0CD00135B39 /* MockURLSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockURLSession.swift; sourceTree = "<group>"; };
|
||||||
|
B594B11F21D53A8200F3AC59 /* Uninstall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Uninstall.swift; sourceTree = "<group>"; };
|
||||||
|
B594B12121D5416100F3AC59 /* ListCommandSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListCommandSpec.swift; sourceTree = "<group>"; };
|
||||||
|
B594B12421D580BB00F3AC59 /* UninstallCommandSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UninstallCommandSpec.swift; sourceTree = "<group>"; };
|
||||||
|
B594B12621D5825800F3AC59 /* AppLibrary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLibrary.swift; sourceTree = "<group>"; };
|
||||||
|
B594B12821D5831D00F3AC59 /* SoftwareProduct.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoftwareProduct.swift; sourceTree = "<group>"; };
|
||||||
|
B594B12A21D5837200F3AC59 /* CKSoftwareProduct+SoftwareProduct.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CKSoftwareProduct+SoftwareProduct.swift"; sourceTree = "<group>"; };
|
||||||
|
B594B12D21D5850700F3AC59 /* MockAppLibrary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAppLibrary.swift; sourceTree = "<group>"; };
|
||||||
|
B594B12F21D5855D00F3AC59 /* MasAppLibrary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasAppLibrary.swift; sourceTree = "<group>"; };
|
||||||
|
B594B13121D5876200F3AC59 /* ResultPredicates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResultPredicates.swift; sourceTree = "<group>"; };
|
||||||
|
B594B13321D5897100F3AC59 /* MockSoftwareProduct.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockSoftwareProduct.swift; sourceTree = "<group>"; };
|
||||||
ED031A781B5127C00097692E /* mas */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mas; sourceTree = BUILT_PRODUCTS_DIR; };
|
ED031A781B5127C00097692E /* mas */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mas; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
ED031A7B1B5127C00097692E /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
ED031A7B1B5127C00097692E /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||||
ED0F237E1B87522400AE40CD /* Install.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Install.swift; sourceTree = "<group>"; };
|
ED0F237E1B87522400AE40CD /* Install.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Install.swift; sourceTree = "<group>"; };
|
||||||
|
@ -167,14 +187,13 @@
|
||||||
ED0F238C1B8756E600AE40CD /* MASError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MASError.swift; sourceTree = "<group>"; };
|
ED0F238C1B8756E600AE40CD /* MASError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MASError.swift; sourceTree = "<group>"; };
|
||||||
ED0F238F1B87A56F00AE40CD /* ISStoreAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ISStoreAccount.swift; sourceTree = "<group>"; };
|
ED0F238F1B87A56F00AE40CD /* ISStoreAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ISStoreAccount.swift; sourceTree = "<group>"; };
|
||||||
EDA3BE511B8B84AF00C18D70 /* SSPurchase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SSPurchase.swift; sourceTree = "<group>"; };
|
EDA3BE511B8B84AF00C18D70 /* SSPurchase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SSPurchase.swift; sourceTree = "<group>"; };
|
||||||
EDB6CE8A1BAEB95100648B4D /* mas-cli-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "mas-cli-Info.plist"; sourceTree = "<group>"; };
|
EDB6CE8A1BAEB95100648B4D /* mas-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "mas-Info.plist"; sourceTree = "<group>"; };
|
||||||
EDB6CE8B1BAEC3D400648B4D /* Version.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Version.swift; sourceTree = "<group>"; };
|
EDB6CE8B1BAEC3D400648B4D /* Version.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Version.swift; sourceTree = "<group>"; };
|
||||||
EDC90B641C70045E0019E396 /* SignIn.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignIn.swift; sourceTree = "<group>"; };
|
EDC90B641C70045E0019E396 /* SignIn.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignIn.swift; sourceTree = "<group>"; };
|
||||||
EDCBF9521D89AC6F000039C6 /* Reset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reset.swift; sourceTree = "<group>"; };
|
EDCBF9521D89AC6F000039C6 /* Reset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reset.swift; sourceTree = "<group>"; };
|
||||||
EDCBF9541D89CFC7000039C6 /* Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = "<group>"; };
|
EDCBF9541D89CFC7000039C6 /* Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = "<group>"; };
|
||||||
EDD3B3621C34709400B56B88 /* Upgrade.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Upgrade.swift; sourceTree = "<group>"; };
|
EDD3B3621C34709400B56B88 /* Upgrade.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Upgrade.swift; sourceTree = "<group>"; };
|
||||||
EDE296521C700F4300554778 /* SignOut.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignOut.swift; sourceTree = "<group>"; };
|
EDE296521C700F4300554778 /* SignOut.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignOut.swift; sourceTree = "<group>"; };
|
||||||
EDEAA12C1B51CF8000F2FC3F /* mas-cli-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "mas-cli-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
||||||
F8242D8020746A510026DF35 /* StoreAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoreAccount.swift; sourceTree = "<group>"; };
|
F8242D8020746A510026DF35 /* StoreAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoreAccount.swift; sourceTree = "<group>"; };
|
||||||
F83213A42173EF75008BA8A0 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
F83213A42173EF75008BA8A0 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||||
F83213A52173EF75008BA8A0 /* StoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreFoundation.framework; path = ../../../../../../../System/Library/PrivateFrameworks/StoreFoundation.framework; sourceTree = "<group>"; };
|
F83213A52173EF75008BA8A0 /* StoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreFoundation.framework; path = ../../../../../../../System/Library/PrivateFrameworks/StoreFoundation.framework; sourceTree = "<group>"; };
|
||||||
|
@ -260,12 +279,32 @@
|
||||||
path = Carthage/Build/Mac;
|
path = Carthage/Build/Mac;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
B594B12321D57FF300F3AC59 /* Commands */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
B594B12121D5416100F3AC59 /* ListCommandSpec.swift */,
|
||||||
|
B594B12421D580BB00F3AC59 /* UninstallCommandSpec.swift */,
|
||||||
|
B555292C219A1FE700ACB4CA /* SearchSpec.swift */,
|
||||||
|
);
|
||||||
|
path = Commands;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
B594B12C21D584E800F3AC59 /* Mocks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
B594B12D21D5850700F3AC59 /* MockAppLibrary.swift */,
|
||||||
|
B594B13321D5897100F3AC59 /* MockSoftwareProduct.swift */,
|
||||||
|
B5793E2A219BE0CD00135B39 /* MockURLSession.swift */,
|
||||||
|
);
|
||||||
|
path = Mocks;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
ED031A6F1B5127C00097692E = {
|
ED031A6F1B5127C00097692E = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
ED031A7A1B5127C00097692E /* App */,
|
|
||||||
90CB4068213F4DDD0044E445 /* Carthage */,
|
90CB4068213F4DDD0044E445 /* Carthage */,
|
||||||
EDFC76381B642A2E00D0DBD7 /* Frameworks */,
|
EDFC76381B642A2E00D0DBD7 /* Frameworks */,
|
||||||
|
ED031A7A1B5127C00097692E /* mas */,
|
||||||
F8FB715320F2B41400F56FDC /* MasKit */,
|
F8FB715320F2B41400F56FDC /* MasKit */,
|
||||||
F8FB715E20F2B41400F56FDC /* MasKitTests */,
|
F8FB715E20F2B41400F56FDC /* MasKitTests */,
|
||||||
F8FB719920F2EC4500F56FDC /* PrivateFrameworks */,
|
F8FB719920F2EC4500F56FDC /* PrivateFrameworks */,
|
||||||
|
@ -283,19 +322,13 @@
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
ED031A7A1B5127C00097692E /* App */ = {
|
ED031A7A1B5127C00097692E /* mas */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
ED0F238E1B87A54700AE40CD /* AppStore */,
|
|
||||||
ED0F23801B87524700AE40CD /* Commands */,
|
|
||||||
ED031A7B1B5127C00097692E /* main.swift */,
|
ED031A7B1B5127C00097692E /* main.swift */,
|
||||||
EDEAA12C1B51CF8000F2FC3F /* mas-cli-Bridging-Header.h */,
|
EDB6CE8A1BAEB95100648B4D /* mas-Info.plist */,
|
||||||
EDB6CE8A1BAEB95100648B4D /* mas-cli-Info.plist */,
|
|
||||||
ED0F238C1B8756E600AE40CD /* MASError.swift */,
|
|
||||||
693A989A1CBFFAAA0004D3B4 /* NSURLSession+Synchronous.swift */,
|
|
||||||
EDCBF9541D89CFC7000039C6 /* Utilities.swift */,
|
|
||||||
);
|
);
|
||||||
path = App;
|
path = mas;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
ED0F23801B87524700AE40CD /* Commands */ = {
|
ED0F23801B87524700AE40CD /* Commands */ = {
|
||||||
|
@ -311,17 +344,18 @@
|
||||||
693A98981CBFFA760004D3B4 /* Search.swift */,
|
693A98981CBFFA760004D3B4 /* Search.swift */,
|
||||||
EDC90B641C70045E0019E396 /* SignIn.swift */,
|
EDC90B641C70045E0019E396 /* SignIn.swift */,
|
||||||
EDE296521C700F4300554778 /* SignOut.swift */,
|
EDE296521C700F4300554778 /* SignOut.swift */,
|
||||||
|
B594B11F21D53A8200F3AC59 /* Uninstall.swift */,
|
||||||
EDD3B3621C34709400B56B88 /* Upgrade.swift */,
|
EDD3B3621C34709400B56B88 /* Upgrade.swift */,
|
||||||
EDB6CE8B1BAEC3D400648B4D /* Version.swift */,
|
EDB6CE8B1BAEC3D400648B4D /* Version.swift */,
|
||||||
);
|
);
|
||||||
name = Commands;
|
path = Commands;
|
||||||
path = App/Commands;
|
sourceTree = "<group>";
|
||||||
sourceTree = SOURCE_ROOT;
|
|
||||||
};
|
};
|
||||||
ED0F238E1B87A54700AE40CD /* AppStore */ = {
|
ED0F238E1B87A54700AE40CD /* AppStore */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
4913269A1F48921D0010EB86 /* CKSoftwareMap+AppLookup.swift */,
|
4913269A1F48921D0010EB86 /* CKSoftwareMap+AppLookup.swift */,
|
||||||
|
B594B12A21D5837200F3AC59 /* CKSoftwareProduct+SoftwareProduct.swift */,
|
||||||
ED0F238A1B87569C00AE40CD /* Downloader.swift */,
|
ED0F238A1B87569C00AE40CD /* Downloader.swift */,
|
||||||
ED0F238F1B87A56F00AE40CD /* ISStoreAccount.swift */,
|
ED0F238F1B87A56F00AE40CD /* ISStoreAccount.swift */,
|
||||||
ED0F23881B87543D00AE40CD /* PurchaseDownloadObserver.swift */,
|
ED0F23881B87543D00AE40CD /* PurchaseDownloadObserver.swift */,
|
||||||
|
@ -344,8 +378,16 @@
|
||||||
F8FB715320F2B41400F56FDC /* MasKit */ = {
|
F8FB715320F2B41400F56FDC /* MasKit */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
B594B12621D5825800F3AC59 /* AppLibrary.swift */,
|
||||||
|
ED0F238E1B87A54700AE40CD /* AppStore */,
|
||||||
|
ED0F23801B87524700AE40CD /* Commands */,
|
||||||
F8FB715520F2B41400F56FDC /* Info.plist */,
|
F8FB715520F2B41400F56FDC /* Info.plist */,
|
||||||
|
B594B12F21D5855D00F3AC59 /* MasAppLibrary.swift */,
|
||||||
|
ED0F238C1B8756E600AE40CD /* MASError.swift */,
|
||||||
F8FB715420F2B41400F56FDC /* MasKit.h */,
|
F8FB715420F2B41400F56FDC /* MasKit.h */,
|
||||||
|
693A989A1CBFFAAA0004D3B4 /* NSURLSession+Synchronous.swift */,
|
||||||
|
B594B12821D5831D00F3AC59 /* SoftwareProduct.swift */,
|
||||||
|
EDCBF9541D89CFC7000039C6 /* Utilities.swift */,
|
||||||
);
|
);
|
||||||
path = MasKit;
|
path = MasKit;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -353,11 +395,12 @@
|
||||||
F8FB715E20F2B41400F56FDC /* MasKitTests */ = {
|
F8FB715E20F2B41400F56FDC /* MasKitTests */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
B594B12321D57FF300F3AC59 /* Commands */,
|
||||||
F8FB716120F2B41400F56FDC /* Info.plist */,
|
F8FB716120F2B41400F56FDC /* Info.plist */,
|
||||||
B5793E28219BDD4800135B39 /* JSON */,
|
B5793E28219BDD4800135B39 /* JSON */,
|
||||||
B555292A219A1CB200ACB4CA /* MASErrorTestCase.swift */,
|
B555292A219A1CB200ACB4CA /* MASErrorTestCase.swift */,
|
||||||
B5793E2A219BE0CD00135B39 /* MockURLSession.swift */,
|
B594B12C21D584E800F3AC59 /* Mocks */,
|
||||||
B555292C219A1FE700ACB4CA /* SearchSpec.swift */,
|
B594B13121D5876200F3AC59 /* ResultPredicates.swift */,
|
||||||
);
|
);
|
||||||
path = MasKitTests;
|
path = MasKitTests;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -592,6 +635,7 @@
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
B594B12B21D5837200F3AC59 /* CKSoftwareProduct+SoftwareProduct.swift in Sources */,
|
||||||
F8FB716F20F2B4DD00F56FDC /* Account.swift in Sources */,
|
F8FB716F20F2B4DD00F56FDC /* Account.swift in Sources */,
|
||||||
F8FB716920F2B4DD00F56FDC /* CKSoftwareMap+AppLookup.swift in Sources */,
|
F8FB716920F2B4DD00F56FDC /* CKSoftwareMap+AppLookup.swift in Sources */,
|
||||||
F8FB716A20F2B4DD00F56FDC /* Downloader.swift in Sources */,
|
F8FB716A20F2B4DD00F56FDC /* Downloader.swift in Sources */,
|
||||||
|
@ -600,12 +644,16 @@
|
||||||
F8FB716B20F2B4DD00F56FDC /* ISStoreAccount.swift in Sources */,
|
F8FB716B20F2B4DD00F56FDC /* ISStoreAccount.swift in Sources */,
|
||||||
F8FB717220F2B4DD00F56FDC /* List.swift in Sources */,
|
F8FB717220F2B4DD00F56FDC /* List.swift in Sources */,
|
||||||
F8FB717320F2B4DD00F56FDC /* Lucky.swift in Sources */,
|
F8FB717320F2B4DD00F56FDC /* Lucky.swift in Sources */,
|
||||||
|
B594B12721D5825800F3AC59 /* AppLibrary.swift in Sources */,
|
||||||
F8FB717B20F2B4DD00F56FDC /* MASError.swift in Sources */,
|
F8FB717B20F2B4DD00F56FDC /* MASError.swift in Sources */,
|
||||||
F8FB717C20F2B4DD00F56FDC /* NSURLSession+Synchronous.swift in Sources */,
|
F8FB717C20F2B4DD00F56FDC /* NSURLSession+Synchronous.swift in Sources */,
|
||||||
F8FB717420F2B4DD00F56FDC /* Outdated.swift in Sources */,
|
F8FB717420F2B4DD00F56FDC /* Outdated.swift in Sources */,
|
||||||
|
B594B12921D5831D00F3AC59 /* SoftwareProduct.swift in Sources */,
|
||||||
F8FB716C20F2B4DD00F56FDC /* PurchaseDownloadObserver.swift in Sources */,
|
F8FB716C20F2B4DD00F56FDC /* PurchaseDownloadObserver.swift in Sources */,
|
||||||
F8FB717520F2B4DD00F56FDC /* Reset.swift in Sources */,
|
F8FB717520F2B4DD00F56FDC /* Reset.swift in Sources */,
|
||||||
F8FB717620F2B4DD00F56FDC /* Search.swift in Sources */,
|
F8FB717620F2B4DD00F56FDC /* Search.swift in Sources */,
|
||||||
|
B594B13021D5855D00F3AC59 /* MasAppLibrary.swift in Sources */,
|
||||||
|
B594B12021D53A8200F3AC59 /* Uninstall.swift in Sources */,
|
||||||
F8FB717720F2B4DD00F56FDC /* SignIn.swift in Sources */,
|
F8FB717720F2B4DD00F56FDC /* SignIn.swift in Sources */,
|
||||||
F8FB717820F2B4DD00F56FDC /* SignOut.swift in Sources */,
|
F8FB717820F2B4DD00F56FDC /* SignOut.swift in Sources */,
|
||||||
F8FB716D20F2B4DD00F56FDC /* SSPurchase.swift in Sources */,
|
F8FB716D20F2B4DD00F56FDC /* SSPurchase.swift in Sources */,
|
||||||
|
@ -622,7 +670,12 @@
|
||||||
files = (
|
files = (
|
||||||
B5793E2B219BE0CD00135B39 /* MockURLSession.swift in Sources */,
|
B5793E2B219BE0CD00135B39 /* MockURLSession.swift in Sources */,
|
||||||
B555292B219A1CB200ACB4CA /* MASErrorTestCase.swift in Sources */,
|
B555292B219A1CB200ACB4CA /* MASErrorTestCase.swift in Sources */,
|
||||||
|
B594B13421D5897100F3AC59 /* MockSoftwareProduct.swift in Sources */,
|
||||||
|
B594B12221D5416100F3AC59 /* ListCommandSpec.swift in Sources */,
|
||||||
|
B594B12521D580BB00F3AC59 /* UninstallCommandSpec.swift in Sources */,
|
||||||
B555292D219A1FE700ACB4CA /* SearchSpec.swift in Sources */,
|
B555292D219A1FE700ACB4CA /* SearchSpec.swift in Sources */,
|
||||||
|
B594B12E21D5850700F3AC59 /* MockAppLibrary.swift in Sources */,
|
||||||
|
B594B13221D5876200F3AC59 /* ResultPredicates.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -696,7 +749,6 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(SRCROOT)/App/PrivateHeaders",
|
"$(SRCROOT)/App/PrivateHeaders",
|
||||||
);
|
);
|
||||||
INFOPLIST_FILE = "App/mas-cli-Info.plist";
|
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
@ -756,7 +808,6 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(SRCROOT)/App/PrivateHeaders",
|
"$(SRCROOT)/App/PrivateHeaders",
|
||||||
);
|
);
|
||||||
INFOPLIST_FILE = "App/mas-cli-Info.plist";
|
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli";
|
||||||
|
@ -775,13 +826,14 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||||
);
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||||
|
INFOPLIST_FILE = "mas/mas-Info.plist";
|
||||||
INSTALL_PATH = /bin;
|
INSTALL_PATH = /bin;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/. @executable_path/MasKit.framework/Versions/Current/Frameworks /usr/local/Frameworks /usr/local/Frameworks/MasKit.framework/Versions/Current/Frameworks $(inherited)";
|
LD_RUNPATH_SEARCH_PATHS = "@executable_path/. @executable_path/MasKit.framework/Versions/Current/Frameworks /usr/local/Frameworks /usr/local/Frameworks/MasKit.framework/Versions/Current/Frameworks $(inherited)";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
|
SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
|
||||||
SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
|
SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "App/mas-cli-Bridging-Header.h";
|
|
||||||
SWIFT_VERSION = 4.2;
|
SWIFT_VERSION = 4.2;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
|
@ -796,13 +848,14 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||||
);
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||||
|
INFOPLIST_FILE = "mas/mas-Info.plist";
|
||||||
INSTALL_PATH = /bin;
|
INSTALL_PATH = /bin;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/. @executable_path/MasKit.framework/Versions/Current/Frameworks /usr/local/Frameworks /usr/local/Frameworks/MasKit.framework/Versions/Current/Frameworks $(inherited)";
|
LD_RUNPATH_SEARCH_PATHS = "@executable_path/. @executable_path/MasKit.framework/Versions/Current/Frameworks /usr/local/Frameworks /usr/local/Frameworks/MasKit.framework/Versions/Current/Frameworks $(inherited)";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.mphys.mas-cli";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
|
SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES;
|
||||||
SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
|
SWIFT_FORCE_STATIC_LINK_STDLIB = NO;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "App/mas-cli-Bridging-Header.h";
|
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
SWIFT_VERSION = 4.2;
|
SWIFT_VERSION = 4.2;
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,6 +28,7 @@ registry.register(ResetCommand())
|
||||||
registry.register(SearchCommand())
|
registry.register(SearchCommand())
|
||||||
registry.register(SignInCommand())
|
registry.register(SignInCommand())
|
||||||
registry.register(SignOutCommand())
|
registry.register(SignOutCommand())
|
||||||
|
registry.register(UninstallCommand())
|
||||||
registry.register(UpgradeCommand())
|
registry.register(UpgradeCommand())
|
||||||
registry.register(VersionCommand())
|
registry.register(VersionCommand())
|
||||||
registry.register(helpCommand)
|
registry.register(helpCommand)
|
Loading…
Reference in a new issue