Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/checkout-4
Browse files Browse the repository at this point in the history
  • Loading branch information
rgoldberg committed Feb 18, 2024
2 parents c509e01 + 85a31ed commit 00c9c7e
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 30 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ jobs:

name: Build, Test, and Lint

# GitHub provided runners (in case we need to switch back)
# https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
# runs-on: macos-latest

# https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow
# https://github.com/mas-cli/mas/settings/actions/runners
runs-on: [self-hosted, macOS]
# https://github.com/mas-cli/mas/actions/runners
runs-on: macos-14

steps:
# https://github.com/actions/checkout#usage
Expand Down
6 changes: 5 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ let package = Package(
)

// https://github.com/apple/swift-format#matching-swift-format-to-your-swift-version-swift-57-and-earlier
#if compiler(>=5.7)
#if compiler(>=5.8)
package.dependencies += [
.package(url: "https://github.com/apple/swift-format", .branch("release/5.9"))
]
#elseif compiler(>=5.7)
package.dependencies += [
.package(url: "https://github.com/apple/swift-format", .branch("release/5.7"))
]
Expand Down
4 changes: 2 additions & 2 deletions Sources/MasKit/AppStore/Downloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ private func download(_ appID: UInt64, purchase: Bool = false) -> Promise<Void>
return Promise<SSPurchase> { seal in
let purchase = SSPurchase(adamId: appID, account: storeAccount, purchase: purchase)
purchase.perform { purchase, _, error, response in
if let error = error {
if let error {
seal.reject(MASError.purchaseFailed(error: error as NSError?))
return
}

guard response?.downloads.isEmpty == false, let purchase = purchase else {
guard response?.downloads.isEmpty == false, let purchase else {
print("No downloads")
seal.reject(MASError.noDownloads)
return
Expand Down
2 changes: 1 addition & 1 deletion Sources/MasKit/AppStore/SSPurchase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extension SSPurchase {

itemIdentifier = adamId

if let account = account {
if let account {
accountIdentifier = account.dsID
appleID = account.identifier
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/MasKit/Commands/Outdated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public struct OutdatedCommand: CommandProtocol {
firstly {
storeSearch.lookup(app: installedApp.itemIdentifier.intValue)
}.done { storeApp in
guard let storeApp = storeApp else {
guard let storeApp else {
if options.verbose {
printWarning(
"""
Expand Down
2 changes: 1 addition & 1 deletion Sources/MasKit/Commands/Uninstall.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Upgrade.swift
// Uninstall.swift
// mas-cli
//
// Created by Ben Chatelain on 2018-12-27.
Expand Down
2 changes: 1 addition & 1 deletion Sources/MasKit/Controllers/MasStoreSearch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class MasStoreSearch: StoreSearch {
return firstly {
self.scrapeVersionFromPage(pageUrl)
}.done { pageVersion in
if let pageVersion = pageVersion, pageVersion > searchVersion {
if let pageVersion, pageVersion > searchVersion {
results[index].version = pageVersion.description
}
}
Expand Down
9 changes: 6 additions & 3 deletions Sources/MasKit/Controllers/StoreSearch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension StoreSearch {
URLQueryItem(name: "term", value: appName),
]

if let country = country {
if let country {
components.queryItems!.append(country)
}

Expand All @@ -48,9 +48,12 @@ extension StoreSearch {
return nil
}

components.queryItems = [URLQueryItem(name: "id", value: "\(appId)")]
components.queryItems = [
URLQueryItem(name: "id", value: "\(appId)"),
URLQueryItem(name: "entity", value: "desktopSoftware"),
]

if let country = country {
if let country {
components.queryItems!.append(country)
}

Expand Down
8 changes: 4 additions & 4 deletions Sources/MasKit/Errors/MASError.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// MAError.swift
// MASError.swift
// mas-cli
//
// Created by Andrew Naylor on 21/08/2015.
Expand Down Expand Up @@ -47,7 +47,7 @@ extension MASError: CustomStringConvertible {
"""

case .signInFailed(let error):
if let error = error {
if let error {
return "Sign in failed: \(error.localizedDescription)"
} else {
return "Sign in failed"
Expand All @@ -57,14 +57,14 @@ extension MASError: CustomStringConvertible {
return "Already signed in"

case .purchaseFailed(let error):
if let error = error {
if let error {
return "Download request failed: \(error.localizedDescription)"
} else {
return "Download request failed"
}

case .downloadFailed(let error):
if let error = error {
if let error {
return "Download failed: \(error.localizedDescription)"
} else {
return "Download failed"
Expand Down
2 changes: 1 addition & 1 deletion Sources/MasKit/Formatters/AppInfoFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

/// Formats text output for the info command.
struct AppInfoFormatter {
enum AppInfoFormatter {
/// Formats text output with app info.
///
/// - Parameter app: Search result with app data.
Expand Down
2 changes: 1 addition & 1 deletion Sources/MasKit/Formatters/AppListFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

/// Formats text output for the search command.
struct AppListFormatter {
enum AppListFormatter {
static let idColumnMinWidth = 10
static let nameColumnMinWidth = 50

Expand Down
2 changes: 1 addition & 1 deletion Sources/MasKit/Formatters/SearchResultFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

/// Formats text output for the search command.
struct SearchResultFormatter {
enum SearchResultFormatter {
/// Formats text output with search results.
///
/// - Parameter results: Search results with app data
Expand Down
6 changes: 3 additions & 3 deletions Sources/MasKit/Formatters/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ let csi = "\u{001B}["
Swift.print(terminator, terminator: "")
}

func print<Target>(
func print(
_ items: Any...,
separator: String = " ",
terminator: String = "\n",
to output: inout Target
) where Target: TextOutputStream {
to output: inout some TextOutputStream
) {
if let observer = printObserver {
let output =
items
Expand Down
4 changes: 2 additions & 2 deletions Sources/MasKit/Network/URLSession+NetworkSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ extension URLSession: NetworkSession {
public func loadData(from url: URL) -> Promise<Data> {
Promise { seal in
dataTask(with: url) { data, _, error in
if let data = data {
if let data {
seal.fulfill(data)
} else if let error = error {
} else if let error {
seal.reject(error)
} else {
seal.reject(MASError.noData)
Expand Down
2 changes: 1 addition & 1 deletion Tests/MasKitTests/Network/NetworkSessionMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class NetworkSessionMock: NetworkSession {
/// - url: unused
/// - completionHandler: Closure which is delivered either data or an error.
func loadData(from _: URL) -> Promise<Data> {
guard let data = data else {
guard let data else {
return Promise(error: error ?? MASError.noData)
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/MasKitTests/Nimble/ResultPredicates.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ResultPreticates.swift
// ResultPredicates.swift
// MasKitTests
//
// Created by Ben Chatelain on 12/27/18.
Expand Down

0 comments on commit 00c9c7e

Please sign in to comment.