-
Notifications
You must be signed in to change notification settings - Fork 1
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
22 changed files
with
185 additions
and
52 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Foundation | ||
|
||
extension Data { | ||
/// Initialise a data buffer from an async sequence of UInt8. | ||
/// Consumes the entire sequence. | ||
public init<T: AsyncSequence>(_ sequence: T) async where T.Element == UInt8 { | ||
var data = Data() | ||
do { | ||
for try await byte in sequence { | ||
data.append(byte) | ||
} | ||
} catch { | ||
|
||
} | ||
|
||
self = data | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
// Created by Sam Deane on 11/10/2018. | ||
// All code (c) 2018 - present day, Elegant Chaos Limited. | ||
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
|
||
import Foundation | ||
import Logger | ||
import Runner | ||
|
||
import protocol ArgumentParser.AsyncMain | ||
import protocol ArgumentParser.AsyncParsableCommand | ||
|
||
// class Shell { | ||
// var semaphore: DispatchSemaphore? = nil | ||
// var error: Error? = nil | ||
// var showOutput: Bool = false | ||
|
||
// func log(_ message: String) { | ||
// print(message) | ||
// } | ||
|
||
// } | ||
|
||
// let sharedShell = Shell() | ||
|
||
@main | ||
struct Main: AsyncMain { | ||
typealias Command = RootCommand | ||
} | ||
|
||
struct RootCommand: AsyncParsableCommand { | ||
static var configuration: CommandConfiguration { | ||
CommandConfiguration( | ||
abstract: "Assorted tools for iOS/macOS releases.", | ||
subcommands: [ | ||
AppcastCommand.self, | ||
ArchiveCommand.self, | ||
BootstrapCommand.self, | ||
ChangesCommand.self, | ||
CompressCommand.self, | ||
ExportCommand.self, | ||
GetCommand.self, | ||
InstallCommand.self, | ||
NotarizeCommand.self, | ||
PublishCommand.self, | ||
SetCommand.self, | ||
SubmitCommand.self, | ||
UnsetCommand.self, | ||
UpdateBuildCommand.self, | ||
UploadCommand.self, | ||
WaitForNotarizationCommand.self, | ||
], | ||
defaultSubcommand: nil | ||
) | ||
} | ||
|
||
@Flag(help: "Show the version.") var version = false | ||
|
||
mutating func run() async throws { | ||
if version { | ||
print(VersionatorVersion.git) | ||
} else { | ||
throw CleanExit.helpRequest(self) | ||
} | ||
Logger.defaultManager.flush() | ||
} | ||
} | ||
|
||
// do { | ||
// var command = try Command.parseAsRoot() | ||
// try command.run() | ||
// Logger.defaultManager.flush() | ||
// Command.exit() | ||
// } catch { | ||
// Logger.defaultManager.flush() | ||
// Command.exit(withError: error) | ||
// } |
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,13 @@ | ||
import Runner | ||
|
||
// TODO: move into Runner | ||
extension Runner.RunningProcess { | ||
/// Check the state of the process and throw an error if it failed. | ||
func throwIfFailed(_ e: @autoclosure () async -> Error) async throws { | ||
for await state in self.state { | ||
if state != .succeeded { | ||
throw await e() | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.