Commit 939ea48b authored by Misagh Moayyed's avatar Misagh Moayyed

move commands to gradle

parent 87a6b1ff
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}"
if (results.size() > 1) {
println "Multiple views found matching ${viewName}: ${results}"
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() {
echo "Searching for view name $@..."
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
echo -e "Found view(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 view at $overlayfile"
ls $overlayfile
echo "More than one view file is found. Narrow down the search query..."
./gradlew getTemplateView -PviewName="$@"
function gencert() {
<!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