Commit 564cb84a authored by Misagh Moayyed's avatar Misagh Moayyed

move commands to gradle

parent 939ea48b
......@@ -371,6 +371,41 @@ task getTemplateView(group: "build", description: "Fetch a CAS views and move it
}
}
task getResource(group: "build", description: "Fetch a CAS resource and move it into the overlay") {
dependsOn explodeWar
doFirst {
def explodedDir="${buildDir}/cas"
def resourceName = project.getProperty("resourceName")
def results = fileTree(explodedDir).matching {
include "**/${resourceName}.html"
}
if (results.isEmpty()) {
println "No resources could be found matching ${resourceName}"
return
}
if (results.size() > 1) {
println "Multiple resources found matching ${resourceName}: ${results}"
return
}
def fromFile = explodedDir + "/WEB-INF/classes"
def resourcesDir = "src/main/resources"
mkdir resourcesDir
def resourceFile = results[0].canonicalPath
def toResourceFile = resourceFile.replace(fromFile, resourcesDir)
def parent = file(toResourceFile).getParent()
mkdir parent
Files.copy(Paths.get(resourceFile), Paths.get(toResourceFile), StandardCopyOption.REPLACE_EXISTING)
println "Copied file to ${toViewFile}"
}
}
def isRunningCasServerSnapshot(casServerVersion) {
return "${casServerVersion}".contains("-SNAPSHOT")
}
......@@ -97,33 +97,7 @@ function explodeApp() {
}
function getresource() {
explodeApp
echo "Searching for resource name $@..."
explodedDir=build/cas
results=`find $explodedDir -type f -name "*.*" | grep -i "$@"`
count=`wc -w <<< "$results"`
if [ "$count" -eq 0 ];then
echo "No resources could be found matching $@"
exit 1
fi
echo -e "Found resource(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 resource at $overlayfile"
ls $overlayfile
else
echo "More than one resource file is found. Narrow down the search query..."
fi
./gradlew getResource -PresourceName="$@"
}
function getview() {
......
<!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