feat: Adds createProject and createJson tests for playbook-client.
This commit is contained in:
@@ -43,7 +43,11 @@ public extension PlaybookClient {
|
||||
@DependencyClient
|
||||
struct RunPlaybook: Sendable {
|
||||
public var buildProject: @Sendable (BuildOptions) async throws -> Void
|
||||
public var createProject: @Sendable (CreateOptions) async throws -> Void
|
||||
public var createProject: @Sendable (CreateOptions, JSONEncoder?) async throws -> Void
|
||||
|
||||
public func createProject(_ options: CreateOptions) async throws {
|
||||
try await createProject(options, nil)
|
||||
}
|
||||
|
||||
public struct SharedRunOptions: Equatable, Sendable {
|
||||
public let extraOptions: [String]?
|
||||
@@ -53,11 +57,11 @@ public extension PlaybookClient {
|
||||
public let shell: String?
|
||||
|
||||
public init(
|
||||
extraOptions: [String]?,
|
||||
inventoryFilePath: String?,
|
||||
extraOptions: [String]? = nil,
|
||||
inventoryFilePath: String? = nil,
|
||||
loggingOptions: LoggingOptions,
|
||||
quiet: Bool,
|
||||
shell: String?
|
||||
quiet: Bool = false,
|
||||
shell: String? = nil
|
||||
) {
|
||||
self.extraOptions = extraOptions
|
||||
self.inventoryFilePath = inventoryFilePath
|
||||
@@ -73,12 +77,20 @@ public extension PlaybookClient {
|
||||
public let shared: SharedRunOptions
|
||||
|
||||
public init(
|
||||
extraOptions: [String]?,
|
||||
inventoryFilePath: String?,
|
||||
projectDirectory: String? = nil,
|
||||
shared: SharedRunOptions
|
||||
) {
|
||||
self.projectDirectory = projectDirectory
|
||||
self.shared = shared
|
||||
}
|
||||
|
||||
public init(
|
||||
extraOptions: [String]? = nil,
|
||||
inventoryFilePath: String? = nil,
|
||||
loggingOptions: LoggingOptions,
|
||||
quiet: Bool,
|
||||
shell: String?,
|
||||
projectDirectory: String
|
||||
quiet: Bool = false,
|
||||
shell: String? = nil,
|
||||
projectDirectory: String? = nil
|
||||
) {
|
||||
self.projectDirectory = projectDirectory
|
||||
self.shared = .init(
|
||||
@@ -99,18 +111,30 @@ public extension PlaybookClient {
|
||||
public struct CreateOptions: Equatable, Sendable {
|
||||
public let projectDirectory: String
|
||||
public let shared: SharedRunOptions
|
||||
public let template: Configuration.Template
|
||||
public let template: Configuration.Template?
|
||||
public let useLocalTemplateDirectory: Bool
|
||||
|
||||
public init(
|
||||
extraOptions: [String]?,
|
||||
inventoryFilePath: String?,
|
||||
projectDirectory: String,
|
||||
shared: SharedRunOptions,
|
||||
template: Configuration.Template? = nil,
|
||||
useLocalTemplateDirectory: Bool
|
||||
) {
|
||||
self.projectDirectory = projectDirectory
|
||||
self.shared = shared
|
||||
self.template = template
|
||||
self.useLocalTemplateDirectory = useLocalTemplateDirectory
|
||||
}
|
||||
|
||||
public init(
|
||||
extraOptions: [String]? = nil,
|
||||
inventoryFilePath: String? = nil,
|
||||
loggingOptions: LoggingOptions,
|
||||
projectDirectory: String,
|
||||
quiet: Bool,
|
||||
shell: String?,
|
||||
template: Configuration.Template,
|
||||
useLocalTemplateDirectory: Bool
|
||||
quiet: Bool = false,
|
||||
shell: String? = nil,
|
||||
template: Configuration.Template? = nil,
|
||||
useLocalTemplateDirectory: Bool = false
|
||||
) {
|
||||
self.projectDirectory = projectDirectory
|
||||
self.template = template
|
||||
@@ -145,7 +169,7 @@ extension PlaybookClient.RunPlaybook: DependencyKey {
|
||||
public static var liveValue: PlaybookClient.RunPlaybook {
|
||||
.init(
|
||||
buildProject: { try await $0.run() },
|
||||
createProject: { try await $0.run() }
|
||||
createProject: { try await $0.run(encoder: $1) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user