diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 45999b9..e78fb75 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -11,10 +11,10 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - swift: ["5.9.0"] + swift: ["6.0.2"] steps: - - uses: actions/checkout@v2 - - uses: swift-actions/setup-swift@v1 + - uses: actions/checkout@v4 + - uses: swift-actions/setup-swift@v2 with: swift-version: ${{ matrix.swift }} - name: Resolve diff --git a/Sources/MintCLI/Commands/BootstrapCommand.swift b/Sources/MintCLI/Commands/BootstrapCommand.swift index 5b23eb3..78be8cb 100644 --- a/Sources/MintCLI/Commands/BootstrapCommand.swift +++ b/Sources/MintCLI/Commands/BootstrapCommand.swift @@ -1,13 +1,10 @@ - -import Foundation import MintKit -import PathKit import SwiftCLI -class BootstrapCommand: MintfileCommand { +final class BootstrapCommand: MintfileCommand { @Key("-o", "--overwrite", description: "Automatically overwrite a symlinked executable that is not installed by mint without asking. Either (y/n)") - var overwrite: Bool? + private var overwrite: Bool? init(mint: Mint) { super.init(mint: mint, diff --git a/Sources/MintCLI/Commands/InstallCommand.swift b/Sources/MintCLI/Commands/InstallCommand.swift index 463e6de..b6d2190 100644 --- a/Sources/MintCLI/Commands/InstallCommand.swift +++ b/Sources/MintCLI/Commands/InstallCommand.swift @@ -1,19 +1,19 @@ -import Foundation import MintKit import SwiftCLI -class InstallCommand: PackageCommand { +final class InstallCommand: PackageCommand { - @Param var executable: String? + @Param + private var executable: String? @Flag("-n", "--no-link", description: "Whether to prevent global linkage") - var noLink: Bool + private var noLink: Bool @Flag("-f", "--force", description: "Force a reinstall even if the package is already installed") - var force: Bool + private var force: Bool @Key("-o", "--overwrite", description: "Automatically overwrite a symlinked executable that is not installed by mint without asking. Either (y/n)") - var overwrite: Bool? + private var overwrite: Bool? init(mint: Mint) { super.init(mint: mint, diff --git a/Sources/MintCLI/Commands/ListCommand.swift b/Sources/MintCLI/Commands/ListCommand.swift index f4eb138..a3a5236 100644 --- a/Sources/MintCLI/Commands/ListCommand.swift +++ b/Sources/MintCLI/Commands/ListCommand.swift @@ -1,7 +1,6 @@ -import Foundation import MintKit -class ListCommand: MintCommand { +final class ListCommand: MintCommand { init(mint: Mint) { super.init(mint: mint, diff --git a/Sources/MintCLI/Commands/MintCommand.swift b/Sources/MintCLI/Commands/MintCommand.swift index cf71996..01cc495 100644 --- a/Sources/MintCLI/Commands/MintCommand.swift +++ b/Sources/MintCLI/Commands/MintCommand.swift @@ -1,6 +1,4 @@ -import Foundation import MintKit -import PathKit import SwiftCLI class MintCommand: Command { diff --git a/Sources/MintCLI/Commands/MintFileCommand.swift b/Sources/MintCLI/Commands/MintFileCommand.swift index bd02183..e9d3d80 100644 --- a/Sources/MintCLI/Commands/MintFileCommand.swift +++ b/Sources/MintCLI/Commands/MintFileCommand.swift @@ -1,19 +1,16 @@ - -import Foundation -import MintKit import PathKit import SwiftCLI class MintfileCommand: MintCommand { @Flag("-v", "--verbose", description: "Show verbose output") - var verbose: Bool + private var verbose: Bool @Flag("-l", "--link", description: "Install the packages of the Mintfile globally") var link: Bool @Key("-m", "--mintfile", description: "Custom path to a Mintfile. Defaults to Mintfile") - var mintFile: String? + private var mintFile: String? override func execute() throws { try super.execute() diff --git a/Sources/MintCLI/Commands/PackageCommand.swift b/Sources/MintCLI/Commands/PackageCommand.swift index 77b22e1..67fdb90 100644 --- a/Sources/MintCLI/Commands/PackageCommand.swift +++ b/Sources/MintCLI/Commands/PackageCommand.swift @@ -1,14 +1,13 @@ -import Foundation import MintKit -import PathKit import SwiftCLI class PackageCommand: MintfileCommand { - @Param var package: String + @Param + private var package: String @Flag("-s", "--silent", description: "Silences any output from Mint itself") - var silent: Bool + private var silent: Bool init(mint: Mint, name: String, description: String, parameterDescription: String? = nil) { var longDescription = """ diff --git a/Sources/MintCLI/Commands/RunCommand.swift b/Sources/MintCLI/Commands/RunCommand.swift index e31410b..ce11f69 100644 --- a/Sources/MintCLI/Commands/RunCommand.swift +++ b/Sources/MintCLI/Commands/RunCommand.swift @@ -1,8 +1,7 @@ -import Foundation import MintKit import SwiftCLI -class RunCommand: PackageCommand { +final class RunCommand: PackageCommand { @CollectedParam var arguments: [String] diff --git a/Sources/MintCLI/Commands/UninstallCommand.swift b/Sources/MintCLI/Commands/UninstallCommand.swift index 3d7cf7a..b3f2052 100644 --- a/Sources/MintCLI/Commands/UninstallCommand.swift +++ b/Sources/MintCLI/Commands/UninstallCommand.swift @@ -1,10 +1,10 @@ -import Foundation import MintKit import SwiftCLI -class UninstallCommand: MintCommand { +final class UninstallCommand: MintCommand { - @Param var package: String + @Param + private var package: String init(mint: Mint) { super.init(mint: mint, name: "uninstall", description: "Uninstall a package by name") diff --git a/Sources/MintCLI/Commands/WhichCommand.swift b/Sources/MintCLI/Commands/WhichCommand.swift index 19b2d61..140af1e 100644 --- a/Sources/MintCLI/Commands/WhichCommand.swift +++ b/Sources/MintCLI/Commands/WhichCommand.swift @@ -1,10 +1,10 @@ -import Foundation import MintKit import SwiftCLI -class WhichCommand: PackageCommand { +final class WhichCommand: PackageCommand { - @Param var executable: String? + @Param + private var executable: String? init(mint: Mint) { super.init(mint: mint, diff --git a/Sources/MintCLI/MintCLI.swift b/Sources/MintCLI/MintCLI.swift index 618ac0f..9d63d12 100644 --- a/Sources/MintCLI/MintCLI.swift +++ b/Sources/MintCLI/MintCLI.swift @@ -1,15 +1,14 @@ import Foundation import MintKit import PathKit -import Rainbow import SwiftCLI public class MintCLI { - public let version = "0.17.5" + private let version = "0.17.5" - let mint: Mint - let cli: CLI + private let mint: Mint + private let cli: CLI public init() { diff --git a/Sources/MintKit/Cache.swift b/Sources/MintKit/Cache.swift index e9b0359..e8e1a57 100644 --- a/Sources/MintKit/Cache.swift +++ b/Sources/MintKit/Cache.swift @@ -1,4 +1,3 @@ -import Foundation import PathKit /// A struct used as a representation of the cache diff --git a/Sources/MintKit/GitTag.swift b/Sources/MintKit/GitTag.swift index 111f7b5..0dab460 100644 --- a/Sources/MintKit/GitTag.swift +++ b/Sources/MintKit/GitTag.swift @@ -1,4 +1,3 @@ -import Foundation import Version func convertTagsToVersionMap(_ tags: [String]) -> [Version: String] { diff --git a/Sources/MintKit/InputReader.swift b/Sources/MintKit/InputReader.swift index 1df7948..399dc79 100644 --- a/Sources/MintKit/InputReader.swift +++ b/Sources/MintKit/InputReader.swift @@ -1,4 +1,3 @@ -import Foundation import SwiftCLI extension Input { diff --git a/Sources/MintKit/InstallStatus.swift b/Sources/MintKit/InstallStatus.swift index e5c49d2..ab7f676 100644 --- a/Sources/MintKit/InstallStatus.swift +++ b/Sources/MintKit/InstallStatus.swift @@ -1,10 +1,9 @@ -import Foundation import PathKit struct InstallStatus { let status: Status - let path: Path + private let path: Path init(path: Path, mintPackagesPath: Path) throws { self.path = path diff --git a/Sources/MintKit/Mint.swift b/Sources/MintKit/Mint.swift index c8c9772..383a58e 100644 --- a/Sources/MintKit/Mint.swift +++ b/Sources/MintKit/Mint.swift @@ -38,11 +38,11 @@ public class Mint { self.mintFilePath = mintFilePath } - func output(_ string: String) { + private func output(_ string: String) { standardOut.print("🌱 \(string)") } - func errorOutput(_ string: String) { + private func errorOutput(_ string: String) { standardError.print("🌱 \(string)") } @@ -55,7 +55,7 @@ public class Mint { var packages: [String: String] } - func writeMetadata(_ metadata: Metadata) throws { + private func writeMetadata(_ metadata: Metadata) throws { let data = try JSONEncoder().encode(metadata) try metadataPath.write(data) } @@ -68,13 +68,13 @@ public class Mint { return try JSONDecoder().decode(Metadata.self, from: data) } - func addPackage(git: String, path: Path) throws { + private func addPackage(git: String, path: Path) throws { var metadata = try readMetadata() metadata.packages[git] = path.lastComponent try writeMetadata(metadata) } - func getGitRepos(name: String) throws -> [String] { + private func getGitRepos(name: String) throws -> [String] { let metadata = try readMetadata() let gitRepos = metadata.packages @@ -118,7 +118,7 @@ public class Mint { /// return whether the version was resolved remotely @discardableResult - func resolvePackage(_ package: PackageReference) throws -> Bool { + private func resolvePackage(_ package: PackageReference) throws -> Bool { // resolve repo and version from MintFile if mintFilePath.exists, @@ -227,7 +227,7 @@ public class Mint { return packagePath.executablePath } - func getPackagePath(for package: PackageReference, with arguments: inout [String], executable: String?) throws -> PackagePath { + private func getPackagePath(for package: PackageReference, with arguments: inout [String], executable: String?) throws -> PackagePath { var packagePath = PackagePath(path: packagesPath, package: package) if let executable = executable { @@ -455,7 +455,7 @@ public class Mint { } } - func linkPackage(_ package: PackageReference, executable: String, overwrite: Bool?) throws { + private func linkPackage(_ package: PackageReference, executable: String, overwrite: Bool?) throws { let packagePath = PackagePath(path: packagesPath, package: package, executable: executable) let installPath = linkPath + packagePath.executable! diff --git a/Sources/MintKit/MintError.swift b/Sources/MintKit/MintError.swift index 56d6c99..07acd31 100644 --- a/Sources/MintKit/MintError.swift +++ b/Sources/MintKit/MintError.swift @@ -1,5 +1,4 @@ import Foundation -import SwiftCLI public enum MintError: Error, CustomStringConvertible, Equatable, LocalizedError { case packageNotFound(String) diff --git a/Sources/MintKit/Mintfile.swift b/Sources/MintKit/Mintfile.swift index 1cf1683..a9a7d3f 100644 --- a/Sources/MintKit/Mintfile.swift +++ b/Sources/MintKit/Mintfile.swift @@ -1,4 +1,3 @@ -import Foundation import PathKit public struct Mintfile { diff --git a/Sources/MintKit/PackagePath.swift b/Sources/MintKit/PackagePath.swift index b5061c8..4fcc506 100644 --- a/Sources/MintKit/PackagePath.swift +++ b/Sources/MintKit/PackagePath.swift @@ -1,4 +1,3 @@ -import Foundation import PathKit /// Contains all the paths for packages diff --git a/Sources/MintKit/PackageReference.swift b/Sources/MintKit/PackageReference.swift index 4054211..d17a3db 100644 --- a/Sources/MintKit/PackageReference.swift +++ b/Sources/MintKit/PackageReference.swift @@ -1,5 +1,4 @@ import Foundation -import PathKit public class PackageReference { public var repo: String diff --git a/Sources/MintKit/StringExtensions.swift b/Sources/MintKit/StringExtensions.swift index 1223190..dd792c9 100644 --- a/Sources/MintKit/StringExtensions.swift +++ b/Sources/MintKit/StringExtensions.swift @@ -1,5 +1,3 @@ -import Foundation - public extension String { var quoted: String { diff --git a/Tests/MintTests/Fixtures.swift b/Tests/MintTests/Fixtures.swift index ec688b2..7ddb90f 100644 --- a/Tests/MintTests/Fixtures.swift +++ b/Tests/MintTests/Fixtures.swift @@ -1,4 +1,3 @@ -import Foundation import PathKit let mintFileFixture = Path(#file) + "../../Fixtures/Mintfile" diff --git a/Tests/MintTests/MintfileTests.swift b/Tests/MintTests/MintfileTests.swift index b334d50..a99b49c 100644 --- a/Tests/MintTests/MintfileTests.swift +++ b/Tests/MintTests/MintfileTests.swift @@ -1,5 +1,4 @@ @testable import MintKit -import PathKit import XCTest class MintfileTests: XCTestCase { diff --git a/Tests/MintTests/PackageTests.swift b/Tests/MintTests/PackageTests.swift index b31dbd3..6c1ca4e 100644 --- a/Tests/MintTests/PackageTests.swift +++ b/Tests/MintTests/PackageTests.swift @@ -1,6 +1,4 @@ @testable import MintKit -import PathKit -import SwiftCLI import XCTest class PackageTests: XCTestCase { diff --git a/Tests/MintTests/TestHelpers.swift b/Tests/MintTests/TestHelpers.swift index 454e8e4..b38cabb 100644 --- a/Tests/MintTests/TestHelpers.swift +++ b/Tests/MintTests/TestHelpers.swift @@ -1,4 +1,3 @@ -import Foundation import XCTest func expectError(_ expectedError: T, file: StaticString = #file, line: UInt = #line, closure: () throws -> Void) where T: Error, T: Equatable {