static void updatePageContents(LiquidPlannerConfiguration configuration, String spaceName, String pageName, File pageContents) {
if (!pageContents.text.contains("companyweb.company.com:8888/jira")) {
return;
}
File replacedFile = File.createTempFile(spaceName + "-page-replaced", "txt");
def replacedFileWriter = new FileWriter(replacedFile);
new FileReader(pageContents).transformLine(replacedFileWriter) {
it.replaceAll("companyweb\\.company\\.com:8888/jira", "jira\\.company\\.com:8888")
}
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(configuration.pathToConfluenceCli,
"--server",
configuration.confluenceInstallationUrl,
"--user",
configuration.confluenceUser,
"--password",
configuration.confluencePassword,
"--action",
"storePage",
"--space",
spaceName,
"--title",
pageName,
"--file",
replacedFile.absolutePath)
processBuilder.redirectErrorStream(true)
def Process process = processBuilder.start()
writeProcessOutput(process);
int processResult = process.waitFor()
logger.info("Got result from process: {}", processResult)
}