-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
236 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "swift-argument-parser", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/apple/swift-argument-parser.git", | ||
"state" : { | ||
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531", | ||
"version" : "1.2.3" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// swift-tools-version: 5.7.1 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "iOSTemplateMaker", | ||
products: [ | ||
.executable( | ||
name: "iOSTemplateMaker", | ||
targets: ["iOSTemplateMaker"] | ||
), | ||
], | ||
dependencies: [ | ||
.package( | ||
url: "https://github.com/apple/swift-argument-parser.git", | ||
from: "1.0.0" | ||
), | ||
], | ||
targets: [ | ||
.executableTarget( | ||
name: "iOSTemplateMaker", | ||
dependencies: [ | ||
.product(name: "ArgumentParser", package: "swift-argument-parser") | ||
] | ||
), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# iOSTemplateMaker | ||
|
||
A description of this package. |
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/Extensions/Optional+Utils.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Foundation | ||
|
||
extension Optional { | ||
|
||
func unwrappedOr(_ defaultValue: Wrapped) -> Wrapped { | ||
switch self { | ||
case .none: | ||
return defaultValue | ||
case let .some(value): | ||
return value | ||
} | ||
} | ||
} | ||
|
||
extension Optional where Wrapped == String { | ||
|
||
var string: String { unwrappedOr("") } | ||
} |
3 changes: 3 additions & 0 deletions
3
Scripts/Swift/Extensions/String+Utils.swift → ...mplateMaker/Extensions/String+Utils.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
Scripts/Swift/SetUpInterface.swift → ...ces/iOSTemplateMaker/SetUpInterface.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import Foundation | ||
|
||
struct SetUpInterface { | ||
|
||
enum Interface { | ||
|
23 changes: 23 additions & 0 deletions
23
Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpTestFirebase.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Foundation | ||
|
||
struct SetUpTestFirebase { | ||
|
||
private let teamIdPlaceholder = "<#teamId#>" | ||
private let stagingFirebaseAppIdPlaceholder = "<#stagingFirebaseAppId#>" | ||
private let firebaseTesterGroupsPlaceholder = "<#group1#>, <#group2#>" | ||
private let matchRepoPlaceholder = "[email protected]:{organization}/{repo}.git" | ||
|
||
private let firebaseTesterGroup = "nimble" | ||
private let fileManager = FileManager.default | ||
|
||
let matchRepo: String | ||
let stagingFirebaseAppId: String | ||
let teamId: String | ||
|
||
func perform() { | ||
fileManager.replaceAllOccurrences(of: teamIdPlaceholder, to: teamId) | ||
fileManager.replaceAllOccurrences(of: stagingFirebaseAppIdPlaceholder, to: stagingFirebaseAppId) | ||
fileManager.replaceAllOccurrences(of: firebaseTesterGroupsPlaceholder, to: firebaseTesterGroup) | ||
fileManager.replaceAllOccurrences(of: matchRepoPlaceholder, to: matchRepo) | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/SetUpTestTestFlight.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Foundation | ||
|
||
struct SetUpTestTestFlight { | ||
|
||
private let teamIdPlaceholder = "<#teamId#>" | ||
private let apiKeyIdPlaceholder = "<#API_KEY_ID#>" | ||
private let issuerIdPlaceholder = "<#ISSUER_ID#>" | ||
private let matchRepoPlaceholder = "[email protected]:{organization}/{repo}.git" | ||
|
||
private let fileManager = FileManager.default | ||
|
||
let matchRepo: String | ||
let apiKey: String | ||
let issuerId: String | ||
let teamId: String | ||
|
||
func perform() { | ||
fileManager.replaceAllOccurrences(of: teamIdPlaceholder, to: teamId) | ||
fileManager.replaceAllOccurrences(of: apiKeyIdPlaceholder, to: apiKey) | ||
fileManager.replaceAllOccurrences(of: issuerIdPlaceholder, to: issuerId) | ||
fileManager.replaceAllOccurrences(of: matchRepoPlaceholder, to: matchRepo) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
Scripts/Swift/iOSTemplateMaker/Sources/iOSTemplateMaker/iOSTemplateMaker.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import ArgumentParser | ||
import Foundation | ||
|
||
@main | ||
struct iOSTemplateMaker: ParsableCommand { | ||
|
||
static let configuration: CommandConfiguration = CommandConfiguration( | ||
abstract: "Set up an iOS Project", | ||
subcommands: [Make.self, MakeTestFirebase.self, MakeTestTestFlight.self], | ||
defaultSubcommand: Make.self | ||
) | ||
} | ||
|
||
extension iOSTemplateMaker { | ||
|
||
struct Make: ParsableCommand { | ||
|
||
@Option(help: "The production id (i.e. com.example.package)") | ||
var bundleIdProduction: String? | ||
@Option(help: "The staging id (i.e. com.example.package.staging)") | ||
var bundleIdStaging: String? | ||
@Option(help: "The project name (i.e. MyApp)") | ||
var projectName: String? | ||
@Option(help: "The minimum iOS version (14.0)") | ||
var minimumVersion: String? | ||
@Option(help: "The user interface frameword (SwiftUI or UIKit)") | ||
var interface: String? | ||
|
||
mutating func run() { | ||
SetUpIOSProject( | ||
bundleIdProduction: bundleIdProduction.string, | ||
bundleIdStaging: bundleIdStaging.string, | ||
projectName: projectName.string, | ||
minimumVersion: minimumVersion.string, | ||
interface: interface.string | ||
).perform() | ||
} | ||
} | ||
} | ||
|
||
extension iOSTemplateMaker { | ||
|
||
struct MakeTestFirebase: ParsableCommand { | ||
|
||
mutating func run() { | ||
let envMatchRepo = ProcessInfo.processInfo.environment["MATCH_REPO"].string | ||
let envStagingFirebaseAppId = ProcessInfo.processInfo.environment["STAGING_FIREBASE_APP_ID"].string | ||
let envTeamId = ProcessInfo.processInfo.environment["TEAM_ID"].string | ||
|
||
SetUpTestFirebase( | ||
matchRepo: envMatchRepo, | ||
stagingFirebaseAppId: envStagingFirebaseAppId, | ||
teamId: envTeamId | ||
).perform() | ||
} | ||
} | ||
} | ||
|
||
|
||
extension iOSTemplateMaker { | ||
|
||
struct MakeTestTestFlight: ParsableCommand { | ||
|
||
mutating func run() { | ||
let envMatchRepo = ProcessInfo.processInfo.environment["MATCH_REPO"].string | ||
let envApiKey = ProcessInfo.processInfo.environment["API_KEY_ID"].string | ||
let envIssuerId = ProcessInfo.processInfo.environment["ISSUER_ID"].string | ||
let envTeamId = ProcessInfo.processInfo.environment["TEAM_ID"].string | ||
|
||
SetUpTestTestFlight( | ||
matchRepo: envMatchRepo, | ||
apiKey: envApiKey, | ||
issuerId: envIssuerId, | ||
teamId: envTeamId | ||
).perform() | ||
} | ||
} | ||
} |
Oops, something went wrong.