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}"
if (results.size() > 1) {
println "Multiple resources found matching ${resourceName}: ${results}"
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() {
echo "Searching for resource name $@..."
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
echo -e "Found resource(s): \n$results"
if [ "$count" -eq 1 ];then
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
echo "More than one resource file is found. Narrow down the search query..."
./gradlew getResource -PresourceName="$@"
function getview() {
<!DOCTYPE html>
<html xmlns:layout="" layout:decorate="~{layout}">
<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="#{}">Error - Page Not Found</title>
<link href="../../static/css/cas.css" rel="stylesheet" th:remove="tag" />
<main role="main" class="container mt-3 mb-3">
<div layout:fragment="content">
<div class="alert alert-info">
<h2 th:utext="#{}">Page Not Found</h2>
<p th:utext="#{}">The page you are attempting to access does not exist at the
<a class="btn btn-submit" th:href="@{/login}" th:utext="#{}">Login
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