Created
April 2, 2019 06:32
-
-
Save rajajawahar/85b6663422cf0254786edbe819952fec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Other methods | |
def getGitHash() { | |
def stdout = new ByteArrayOutputStream() | |
exec { | |
commandLine 'git', 'rev-parse', '--short', 'HEAD' | |
standardOutput = stdout | |
} | |
return stdout.toString().trim() | |
} | |
def static getCommitMessages() { | |
def gitlog = 'git log origin/develop...HEAD --decorate'.execute().text | |
if (gitlog.trim().length() > 0) return gitlog | |
return 'git log -n 1 --decorate'.execute().text | |
} | |
// Export methods by turning them into closures | |
ext { | |
getGitHash = this.&getGitHash | |
getCommitMessages = this.&getCommitMessages | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment