Use new SigScript setup
This commit is contained in:
parent
06363ff433
commit
7db9f46b56
@ -1,7 +1,9 @@
|
|||||||
#Builds and runs the project.
|
#Builds and runs the project.
|
||||||
|
#Java
|
||||||
rm -Rf out/*
|
rm -Rf out/*
|
||||||
javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java
|
javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java
|
||||||
printf "\n\n\nRunning Program...\n\n"
|
printf "\n\n\nRunning Program...\n\n"
|
||||||
|
ORIGINAL_LOC=$(pwd)
|
||||||
cd $OUT_DIR
|
cd $OUT_DIR
|
||||||
java ${MAIN_CLASS} "$@"
|
java ${MAIN_CLASS} "$@"
|
||||||
../scripts/clean.sh
|
${ORIGINAL_LOC}/scripts/clean.sh
|
@ -1,3 +1,4 @@
|
|||||||
#Cleans up and removes unused files.
|
#Cleans up and removes unused files.
|
||||||
|
#Java
|
||||||
find . -type f -name *.class -delete
|
find . -type f -name *.class -delete
|
||||||
find . -type f -name manifest -delete
|
find . -type f -name manifest -delete
|
@ -1,4 +1,5 @@
|
|||||||
#Adds a commit message and pushes project to github repository.
|
#Adds a commit message and pushes project to github repository.
|
||||||
|
#Java
|
||||||
git add -u
|
git add -u
|
||||||
git add *
|
git add *
|
||||||
git commit -m "$*"
|
git commit -m "$*"
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar.
|
#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar.
|
||||||
|
#Java
|
||||||
rm -Rf bin/*
|
rm -Rf bin/*
|
||||||
javac -Xlint:unchecked -cp src -d bin ${PROJECT_DIR}/${PROJECT_NAME}.java
|
javac -Xlint:unchecked -cp src -d bin ${PROJECT_DIR}/${PROJECT_NAME}.java
|
||||||
printf "\n\n\nGenerating Manifest...\n\n"
|
printf "\n\n\nGenerating Manifest...\n\n"
|
||||||
touch manifest
|
touch manifest
|
||||||
echo "Main-Class: ${MAIN_CLASS}" >> manifest
|
echo "Main-Class: ${MAIN_CLASS}" >> manifest
|
||||||
printf "\n\n\nCreating Jar...\n\n"
|
printf "\n\n\nCreating Jar...\n\n"
|
||||||
|
ORIGINAL_LOC=$(pwd)
|
||||||
cd ${OUT_DIR}
|
cd ${OUT_DIR}
|
||||||
jar cfm ${PROJECT_NAME}.jar ../manifest sig
|
jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest sig
|
||||||
printf "\n\n\nRunning Program...\n\n"
|
printf "\n\n\nRunning Program...\n\n"
|
||||||
java -jar ${PROJECT_NAME}.jar
|
java -jar ${PROJECT_NAME}.jar
|
||||||
mv ${PROJECT_NAME}.jar ..
|
mv ${PROJECT_NAME}.jar ${ORIGINAL_LOC}
|
||||||
cd ..
|
cd ..
|
||||||
./scripts/clean.sh
|
./scripts/clean.sh
|
36
sig
36
sig
@ -1,32 +1,8 @@
|
|||||||
export PROJECT_NAME="JavaProjectTemplate"
|
source utils/define.sh
|
||||||
export PROJECT_DIR="src/sig"
|
|
||||||
export MAIN_CLASS="sig.${PROJECT_NAME}"
|
|
||||||
export OUT_DIR="bin"
|
|
||||||
|
|
||||||
|
define PROJECT_NAME "JavaProjectTemplate"
|
||||||
|
define PROJECT_DIR "src/sig"
|
||||||
|
define MAIN_CLASS "sig.${PROJECT_NAME}"
|
||||||
|
define OUT_DIR "bin"
|
||||||
|
|
||||||
if [ -z "$1" ]
|
source utils/main.sh
|
||||||
then
|
|
||||||
echo ""
|
|
||||||
echo " Usage: ./sig <command> {args}"
|
|
||||||
echo ""
|
|
||||||
printf "====\tCurrent Configuration"
|
|
||||||
printf "\t====================="
|
|
||||||
printf "\n\t%-15s%20s" PROJECT_NAME ${PROJECT_NAME}
|
|
||||||
printf "\n\t%-15s%20s" PROJECT_DIR ${PROJECT_DIR}
|
|
||||||
printf "\n\t%-15s%20s" MAIN_CLASS ${MAIN_CLASS}
|
|
||||||
printf "\n\t%-15s%20s" OUT_DIR ${OUT_DIR}
|
|
||||||
printf "\n====================================================="
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo " Command List:"
|
|
||||||
FILES=$(ls -1 ./scripts | sed -e 's/\.sh$//' | sed -e 's/^/ /')
|
|
||||||
for f in $FILES
|
|
||||||
do
|
|
||||||
DESC="$(head -n1 ./scripts/$f.sh)"
|
|
||||||
printf "\n\t%-15s%-65s" $f "${DESC:1}"
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
./scripts/$1.sh "${*:2}"
|
|
22
utils/define.sh
Executable file
22
utils/define.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
export VARS=("")
|
||||||
|
|
||||||
|
function define() {
|
||||||
|
VARS+=("$1")
|
||||||
|
value="${*:2}"
|
||||||
|
eval "$1"='$value'
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $(pwd) != *"SigScript" ]]; then
|
||||||
|
source utils/search.sh
|
||||||
|
|
||||||
|
find . -type f -name md5 -delete
|
||||||
|
|
||||||
|
#Check for hashes
|
||||||
|
for f in $FILES
|
||||||
|
do
|
||||||
|
search $f
|
||||||
|
check $f
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Dev build, no checks required."
|
||||||
|
fi
|
28
utils/main.sh
Normal file
28
utils/main.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
echo " Usage: ./sig <command> {args}"
|
||||||
|
echo ""
|
||||||
|
printf "====\tCurrent Configuration"
|
||||||
|
printf "\t====================="
|
||||||
|
for t in ${VARS[@]}
|
||||||
|
do
|
||||||
|
printf "\n\t%-15s%20s" $t ${!t}
|
||||||
|
done
|
||||||
|
printf "\n====================================================="
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo " Command List:"
|
||||||
|
FILES=$(ls -1 ./scripts | sed -e 's/\.sh$//' | sed -e 's/^/ /')
|
||||||
|
for f in $FILES
|
||||||
|
do
|
||||||
|
if [ $f != "md5" ]; then
|
||||||
|
DESC="$(head -n1 ./scripts/$f.sh)"
|
||||||
|
printf "\n\t%-15s%-65s" $f "${DESC:1}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
./scripts/$1.sh "${*:2}"
|
53
utils/search.sh
Normal file
53
utils/search.sh
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
function search() {
|
||||||
|
FILES2=$(ls $1)
|
||||||
|
for g in $FILES2
|
||||||
|
do
|
||||||
|
if [ -d $1$g ];
|
||||||
|
then
|
||||||
|
echo "$1$g is a directory"
|
||||||
|
search $1$g/
|
||||||
|
else
|
||||||
|
echo "$1$g is a file"
|
||||||
|
if [ $g != "md5" ]; then
|
||||||
|
md5sum < $1$g >> $1md5
|
||||||
|
else
|
||||||
|
echo " md5 file, ignoring..."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function check() {
|
||||||
|
echo "Check $1"
|
||||||
|
FILES2=$(ls $1)
|
||||||
|
REDOWNLOAD=false
|
||||||
|
if [ -f "$1/md5" ];
|
||||||
|
then
|
||||||
|
echo " md5: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5"
|
||||||
|
curl -s https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5 --output /tmp/out
|
||||||
|
DIFF=$(diff $1/md5 /tmp/out)
|
||||||
|
if [ "$DIFF" != "" ]
|
||||||
|
then
|
||||||
|
echo " Differences detected!"
|
||||||
|
REDOWNLOAD=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
for g in $FILES2
|
||||||
|
do
|
||||||
|
if [ -d $1$g ];
|
||||||
|
then
|
||||||
|
echo "$1$g is a directory"
|
||||||
|
check $1$g/
|
||||||
|
else
|
||||||
|
if [ "$REDOWNLOAD" = "true" ]; then
|
||||||
|
echo "++Redownload $1$g..."
|
||||||
|
if [ -f "$1$g" ]; then
|
||||||
|
curl https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $1$g
|
||||||
|
else
|
||||||
|
echo "===Could not find directory, assuming regular scripts directory exists."
|
||||||
|
curl https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output scripts/$g
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user