diff --git a/Package.swift b/Package.swift index 31e9dd8..fea85cd 100644 --- a/Package.swift +++ b/Package.swift @@ -5,9 +5,12 @@ import PackageDescription let package = Package( name: "BuildConfig.swift", - platforms: [ .macOS(.v12) ], + platforms: [.macOS(.v12)], products: [ - .executable(name: "buildconfigswift", targets: ["BuildConfig.swift"]) + .executable( + name: "buildconfigswift", + targets: ["buildconfigswift"] + ), ], dependencies: [ .package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.3"), @@ -19,7 +22,7 @@ let package = Package( ], targets: [ .executableTarget( - name: "BuildConfig.swift", + name: "buildconfigswift", dependencies: [ .product(name: "ArgumentParser", package: "swift-argument-parser"), "Core" @@ -55,9 +58,9 @@ let package = Package( ] ), .testTarget( - name: "BuildConfig.swiftTests", + name: "buildconfigswiftTests", dependencies: [ - "BuildConfig.swift", + "buildconfigswift", // "MirrorDiffKit" ], resources: [.copy("Resources")] @@ -77,7 +80,7 @@ let package = Package( "MirrorDiffKit" ], resources: [.copy("Resources")] - ) + ), ], swiftLanguageVersions: [.v5] ) diff --git a/Sources/BuildConfig.swift/BuildConfig.swift b/Sources/buildconfigswift/App.swift similarity index 87% rename from Sources/BuildConfig.swift/BuildConfig.swift rename to Sources/buildconfigswift/App.swift index 264799d..6cd8cd7 100644 --- a/Sources/BuildConfig.swift/BuildConfig.swift +++ b/Sources/buildconfigswift/App.swift @@ -5,7 +5,7 @@ import Foundation import PathKit @main -struct BuildConfigSwift: ParsableCommand { +struct App: ParsableCommand { @Option(name: .shortAndLong, help: "The directory to output BuildConfig.plist and BuildConfig.generated.swift.") var outputDirectory: String = "./" @@ -16,13 +16,16 @@ struct BuildConfigSwift: ParsableCommand { var srcDir: String } -extension BuildConfigSwift { +extension App { static var configuration: CommandConfiguration { - CommandConfiguration(version: ApplicationInfo.version) + CommandConfiguration( + commandName: "buildconfigswift", + version: ApplicationInfo.version + ) } } -extension BuildConfigSwift { +extension App { func run() throws { let outputDirectory = Path(outputDirectory) let environment = environment.flatMap { $0.isEmpty ? nil : $0 } diff --git a/Sources/BuildConfig.swift/Environment.swift b/Sources/buildconfigswift/Environment.swift similarity index 100% rename from Sources/BuildConfig.swift/Environment.swift rename to Sources/buildconfigswift/Environment.swift diff --git a/Tests/BuildConfig.swiftTests/BuildConfigswiftTests.swift b/Tests/buildconfigswiftTests/BuildConfigswiftTests.swift similarity index 96% rename from Tests/BuildConfig.swiftTests/BuildConfigswiftTests.swift rename to Tests/buildconfigswiftTests/BuildConfigswiftTests.swift index 5146193..8fb83c0 100644 --- a/Tests/BuildConfig.swiftTests/BuildConfigswiftTests.swift +++ b/Tests/buildconfigswiftTests/BuildConfigswiftTests.swift @@ -142,8 +142,8 @@ final class BuildConfigswiftTests: XCTestCase { XCTAssertEqual(process.exitCode, .validationFailure) XCTAssertEqual(stderr.outputString, """ Error: SCRIPT_INPUT_FILE_COUNT must be Int. Invalid value `foo` - Usage: build-config-swift [--output-directory ] [--environment ] - See 'build-config-swift --help' for more information. + Usage: buildconfigswift [--output-directory ] [--environment ] + See 'buildconfigswift --help' for more information. """) } try context("SCRIPT_OUTPUT_FILE_COUNT") { @@ -161,8 +161,8 @@ final class BuildConfigswiftTests: XCTestCase { XCTAssertEqual(process.exitCode, .validationFailure) XCTAssertEqual(stderr.outputString, """ Error: SCRIPT_OUTPUT_FILE_COUNT must be Int. Invalid value `bar` - Usage: build-config-swift [--output-directory ] [--environment ] - See 'build-config-swift --help' for more information. + Usage: buildconfigswift [--output-directory ] [--environment ] + See 'buildconfigswift --help' for more information. """) } } diff --git a/Tests/BuildConfig.swiftTests/ProcessExtension.swift b/Tests/buildconfigswiftTests/ProcessExtension.swift similarity index 100% rename from Tests/BuildConfig.swiftTests/ProcessExtension.swift rename to Tests/buildconfigswiftTests/ProcessExtension.swift diff --git a/Tests/BuildConfig.swiftTests/Resources/output/production/BuildConfig.plist b/Tests/buildconfigswiftTests/Resources/output/production/BuildConfig.plist similarity index 100% rename from Tests/BuildConfig.swiftTests/Resources/output/production/BuildConfig.plist rename to Tests/buildconfigswiftTests/Resources/output/production/BuildConfig.plist diff --git a/Tests/BuildConfig.swiftTests/Resources/output/staging/BuildConfig.plist b/Tests/buildconfigswiftTests/Resources/output/staging/BuildConfig.plist similarity index 100% rename from Tests/BuildConfig.swiftTests/Resources/output/staging/BuildConfig.plist rename to Tests/buildconfigswiftTests/Resources/output/staging/BuildConfig.plist diff --git a/Tests/BuildConfig.swiftTests/Resources/src/.env/production.yaml b/Tests/buildconfigswiftTests/Resources/src/.env/production.yaml similarity index 100% rename from Tests/BuildConfig.swiftTests/Resources/src/.env/production.yaml rename to Tests/buildconfigswiftTests/Resources/src/.env/production.yaml diff --git a/Tests/BuildConfig.swiftTests/Resources/src/.env/staging.json b/Tests/buildconfigswiftTests/Resources/src/.env/staging.json similarity index 100% rename from Tests/BuildConfig.swiftTests/Resources/src/.env/staging.json rename to Tests/buildconfigswiftTests/Resources/src/.env/staging.json diff --git a/Tests/BuildConfig.swiftTests/Resources/src/API.yaml b/Tests/buildconfigswiftTests/Resources/src/API.yaml similarity index 100% rename from Tests/BuildConfig.swiftTests/Resources/src/API.yaml rename to Tests/buildconfigswiftTests/Resources/src/API.yaml diff --git a/Tests/BuildConfig.swiftTests/Resources/src/keys.yml b/Tests/buildconfigswiftTests/Resources/src/keys.yml similarity index 100% rename from Tests/BuildConfig.swiftTests/Resources/src/keys.yml rename to Tests/buildconfigswiftTests/Resources/src/keys.yml diff --git a/Tests/BuildConfig.swiftTests/Util.swift b/Tests/buildconfigswiftTests/Util.swift similarity index 100% rename from Tests/BuildConfig.swiftTests/Util.swift rename to Tests/buildconfigswiftTests/Util.swift