Merge pull request #35 from shibapm/clean_git_status_message
Print specific error message for failed pre checks
This commit is contained in:
commit
8a9be9e3db
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
{
|
||||
"package": "Logger",
|
||||
"repositoryURL": "https://github.com/f-meloni/Logger",
|
||||
"repositoryURL": "https://github.com/shibapm/Logger",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "53c3ecca5abe8cf46697e33901ee774236d94cce",
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
public protocol Check {
|
||||
init()
|
||||
|
||||
var errorMessage: String { get }
|
||||
|
||||
func check() -> Bool
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue