Merge pull request #35 from shibapm/clean_git_status_message

Print specific error message for failed pre checks
This commit is contained in:
Franco Meloni 2019-12-16 16:55:57 +00:00 committed by GitHub
commit 8a9be9e3db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View File

@ -12,7 +12,7 @@
},
{
"package": "Logger",
"repositoryURL": "https://github.com/f-meloni/Logger",
"repositoryURL": "https://github.com/shibapm/Logger",
"state": {
"branch": null,
"revision": "53c3ecca5abe8cf46697e33901ee774236d94cce",

View File

@ -41,8 +41,10 @@ if let rocketYamlPath = RocketFileFinder.rocketFilePath() {
let checks = ChecksParser.parsePreReleaseChecks(fromDictionary: dictionary)
let failedChecks = checks.filter { !$0.check() }
guard failedChecks.count == 0 else {
logger.logError("Pre release checks failed")
guard failedChecks.isEmpty else {
logger.logError("Pre release checks failed",
failedChecks.map { $0.errorMessage }.joined(separator: "\n"),
separator: "\n")
exit(1)
}

View File

@ -1,4 +1,7 @@
public protocol Check {
init()
var errorMessage: String { get }
func check() -> Bool
}

View File

@ -2,6 +2,10 @@ import Foundation
struct CleanGitStatusCheck: Check {
let launcher: ScriptLaunching
var errorMessage: String {
return "Your git status contains not committed code, please remove it or commit it"
}
init() {
self.init(launcher: ScriptLauncher())