mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Replace the readMarketingVersion method with a cleaner Yams based one and extract it into the shared tools
This commit is contained in:
committed by
Stefan Ceriu
parent
aa423e3592
commit
1d8639a11a
@@ -1,6 +1,7 @@
|
||||
import ArgumentParser
|
||||
import Foundation
|
||||
import Subprocess
|
||||
import Yams
|
||||
|
||||
struct CI: ParsableCommand {
|
||||
static let configuration = CommandConfiguration(abstract: "CI workflow commands that can be run both locally and in CI environments.",
|
||||
@@ -13,6 +14,19 @@ struct CI: ParsableCommand {
|
||||
|
||||
static let testOutputDirectory = "test_output"
|
||||
|
||||
/// Reads the `MARKETING_VERSION` from `project.yml`.
|
||||
static func readMarketingVersion() throws -> String {
|
||||
let projectURL = URL.projectDirectory.appending(component: "project.yml")
|
||||
let projectString = try String(contentsOf: projectURL)
|
||||
|
||||
guard let projectConfig = try Yams.compose(yaml: projectString),
|
||||
let version = projectConfig["settings"]?["MARKETING_VERSION"]?.string else {
|
||||
throw ValidationError("Could not find MARKETING_VERSION in project.yml.")
|
||||
}
|
||||
|
||||
return version
|
||||
}
|
||||
|
||||
// MARK: - Linting
|
||||
|
||||
/// Runs SwiftFormat in lint mode against the current directory.
|
||||
|
||||
Reference in New Issue
Block a user