This PR contains the work done to create a new *Hummingbird* project with very basic configuration from the _colibri_ executable, just like the project you could create with the [Hummingbird template](https://github.com/hummingbird-project/template) project in Github. Reviewed-on: #3 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
25 lines
793 B
Swift
25 lines
793 B
Swift
import Foundation
|
|
|
|
public struct InitGitInFolderTask {
|
|
|
|
// MARK: Initialisers
|
|
|
|
public init() {}
|
|
|
|
// MARK: Functions
|
|
|
|
public func callAsFunction(at rootFolder: URL) async throws (RunProcessError) {
|
|
let pathCommand = "/usr/bin/git"
|
|
let pathFolder = rootFolder.pathString
|
|
|
|
var gitInit = RunProcessTask(process: Process())
|
|
var gitAdd = RunProcessTask(process: Process())
|
|
var gitCommit = RunProcessTask(process: Process())
|
|
|
|
try await gitInit(path: pathCommand, arguments: ["init", pathFolder])
|
|
try await gitAdd(path: pathCommand, arguments: ["-C", pathFolder, "add", "."])
|
|
try await gitCommit(path: pathCommand, arguments: ["-C", pathFolder, "commit", "-m", "Initial commit"])
|
|
}
|
|
|
|
}
|