Created
January 5, 2012 17:13
-
-
Save davelnewton/1566181 to your computer and use it in GitHub Desktop.
Groovier groovy
This file contains hidden or 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
/** | |
* Original with inline Groovier version | |
*/ | |
//def publisher = null | |
//for (iter in project.getPublishersList()) { | |
// if (iter.getDescriptor().getDisplayName().equals("Editable Email Notification")) { | |
// publisher = iter | |
// break | |
// } | |
//} | |
publisher = project.publishersList.find { it.descriptor.displayName == "Editable Email Notification" } | |
if (publisher != null) { | |
//def logParserResult | |
//for (action in build.getActions()) { | |
// if (action.toString().contains("LogParserAction")) { | |
// logParserResult = action.getResult() | |
// break | |
// } | |
//} | |
logParserResult = build.actions.find { it.toString().contains "LogParserAction" } | |
def errorLinksFile = new File(logParserResult.getErrorLinksFile()) | |
pattern = ~/<a.*?><font.*?>/ | |
replaceWith = "<a href=\"${rootUrl}${build.url}parsed_console/?\">" | |
//def errorList = [] | |
//for (line in errorLinksFile.getText().split("\n")) { | |
// if (!line.contains("href")) { | |
// continue | |
// } | |
// errorList.add(line.replaceAll(pattern, "<a href="+ rooturl + build.url + "parsed_console/?\">").minus("</font>")) | |
//} | |
errorList = errorLinksFile.readLines().grep { it.contains "href" }.collect { line -> | |
line.replaceAll(pattern, replaceWith).minus("</font>") | |
} | |
} |
This file contains hidden or 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
/** | |
* Just Groovier version. | |
*/ | |
publisher = project.publishersList.find { it.descriptor.displayName == "Editable Email Notification" } | |
if (publisher != null) { | |
logParserResult = build.actions.find { it.toString().contains "LogParserAction" } | |
pattern = ~/<a.*?><font.*?>/ | |
replaceWith = "<a href=\"${rootUrl}${build.url}parsed_console/?\">" | |
errorLinksFile = new File(logParserResult.getErrorLinksFile()) | |
errorList = errorLinksFile.readLines().grep { it.contains "href" }.collect { line -> | |
line.replaceAll(pattern, replaceWith).minus("</font>") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using this in the groovy email template I get:
Also, the ${rootUrl} should be ${rooturl}