move commands to gradle

parent 87a6b1ff
import org.apache.tools.ant.taskdefs.condition.Os
import java.nio.file.*
buildscript {
repositories {
......@@ -322,7 +323,7 @@ task createKeystore (type:Exec, group: "build", description: "Create CAS keystor
}
}
task listTemplateViews (group: "build", description: "Create CAS keystore") {
task listTemplateViews (group: "build", description: "List all CAS views") {
dependsOn explodeWar
doFirst {
......@@ -336,6 +337,40 @@ task listTemplateViews (group: "build", description: "Create CAS keystore") {
}
}
task getTemplateView(group: "build", description: "Fetch a CAS views and move it into the overlay") {
dependsOn explodeWar
doFirst {
def explodedDir="${buildDir}/cas"
def viewName = project.getProperty("viewName")
def results = fileTree(explodedDir).matching {
include "**/${viewName}.html"
}
if (results.isEmpty()) {
println "No views could be found matching ${viewName}"
return
}
if (results.size() > 1) {
println "Multiple views found matching ${viewName}: ${results}"
return
}
def fromFile = explodedDir + "/WEB-INF/classes"
def resourcesDir = "src/main/resources"
mkdir resourcesDir
def viewFile = results[0].canonicalPath
def toViewFile = viewFile.replace(fromFile, resourcesDir)
def parent = file(toViewFile).getParent()
mkdir parent
Files.copy(Paths.get(viewFile), Paths.get(toViewFile), StandardCopyOption.REPLACE_EXISTING)
println "Copied view file to ${toViewFile}"
}
}
def isRunningCasServerSnapshot(casServerVersion) {
return "${casServerVersion}".contains("-SNAPSHOT")
}
......@@ -94,7 +94,6 @@ function listviews() {
function explodeApp() {
./gradlew explodeWar
echo "Exploded the CAS web application file at build/cas"
}
function getresource() {
......@@ -128,33 +127,7 @@ function getresource() {
}
function getview() {
explodeApp
echo "Searching for view name $@..."
explodedDir=build/cas
results=`find $explodedDir -type f -name "*.html" | grep -i "$@"`
count=`wc -w <<< "$results"`
if [ "$count" -eq 0 ];then
echo "No views could be found matching $@"
exit 1
fi
echo -e "Found view(s): \n$results"
if [ "$count" -eq 1 ];then
fromFile="build/cas/WEB-INF/classes"
toFile="src/main/resources"
overlayfile=`echo "${results/$fromFile/$toFile}"`
overlaypath=`dirname "${overlayfile}"`
# echo "Overlay file is $overlayfile to be created at $overlaypath"
mkdir -p $overlaypath
cp $results $overlaypath
echo "Created view at $overlayfile"
ls $overlayfile
else
echo "More than one view file is found. Narrow down the search query..."
fi
./gradlew getTemplateView -PviewName="$@"
}
function gencert() {
......
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout}">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<title th:text="#{screen.error.page.title.pagenotfound}">Error - Page Not Found</title>
<link href="../../static/css/cas.css" rel="stylesheet" th:remove="tag" />
</head>
<body>
<main role="main" class="container mt-3 mb-3">
<div layout:fragment="content">
<div class="alert alert-info">
<h2 th:utext="#{screen.error.page.notfound}">Page Not Found</h2>
<p th:utext="#{screen.error.page.doesnotexist}">The page you are attempting to access does not exist at the
moment.</p>
<a class="btn btn-submit" th:href="@{/login}" th:utext="#{screen.error.page.loginagain}">Login
Again</a>
</div>
</div>
</main>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment