Include SigScript build system

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
Nic0Nic0Nii 3 years ago
parent 92f9f247f7
commit aa8b87de1a
  1. 9
      scripts/build.sh
  2. 4
      scripts/clean.sh
  3. 13
      scripts/commit.sh
  4. 16
      scripts/jar.sh
  5. 1
      scripts/lean.sh
  6. 5
      scripts/md5
  7. 8
      sig
  8. 0
      src/sig/MultipartUtility.java
  9. 0
      src/sig/client.java
  10. 0
      src/sig/exceptions/FailedResponseException.java
  11. 0
      src/sig/requests/GETRequest.java
  12. 0
      src/sig/requests/POSTRequest.java
  13. 1
      utils/.coauthors
  14. 3
      utils/.updateDirectories
  15. 23
      utils/define.sh
  16. 28
      utils/main.sh
  17. 5
      utils/md5
  18. 77
      utils/search.sh

@ -0,0 +1,9 @@
#Builds and runs the project.
#Java
rm -Rf out/*
javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java
printf "\n\n\nRunning Program...\n\n"
ORIGINAL_LOC=$(pwd)
cd $OUT_DIR
java ${MAIN_CLASS} "$@"
${ORIGINAL_LOC}/scripts/clean.sh

@ -0,0 +1,4 @@
#Cleans up and removes unused files.
#Java
find . -type f -name *.class -delete
find . -type f -name manifest -delete

@ -0,0 +1,13 @@
#Adds a commit message and pushes project to github repository.
#Java
COMMIT_MESSAGE="$*"
while IFS= read -r line
do
COMMIT_MESSAGE+="
Co-authored-by: $line"
done < utils/.coauthors
git add -u
git add *
git commit -m "$COMMIT_MESSAGE"
git push

@ -0,0 +1,16 @@
#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar.
#Java
rm -Rf bin/*
javac -Xlint:unchecked -cp src -d bin ${PROJECT_DIR}/${PROJECT_NAME}.java
printf "\n\n\nGenerating Manifest...\n\n"
touch manifest
echo "Main-Class: ${MAIN_CLASS}" >> manifest
printf "\n\n\nCreating Jar...\n\n"
ORIGINAL_LOC=$(pwd)
cd ${OUT_DIR}
jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest sig
printf "\n\n\nRunning Program...\n\n"
java -jar ${PROJECT_NAME}.jar
mv ${PROJECT_NAME}.jar ${ORIGINAL_LOC}
cd ..
./scripts/clean.sh

@ -0,0 +1 @@
404: Not Found

@ -0,0 +1,5 @@
build.sh:a833e7598ad65672a9c01306d244b49f -
clean.sh:96ce35f2d2dcb555421e00a6afda23ca -
commit.sh:21af1fa6f09d01679c9e11408967264a -
jar.sh:2ac636f584c43a1124affb9ea6bdc7bf -
lean.sh:3be7b8b182ccd96e48989b4e57311193 -

8
sig

@ -0,0 +1,8 @@
source utils/define.sh
define PROJECT_NAME "HttpClient"
define PROJECT_DIR "src/sig"
define MAIN_CLASS "sig.client"
define OUT_DIR "bin"
source utils/main.sh

@ -0,0 +1 @@
sigonasr2 <sigonasr2@gmail.com>

@ -0,0 +1,3 @@
Java/
scripts/
utils/

@ -0,0 +1,23 @@
export VARS=("")
function define() {
VARS+=("$1")
value="${*:2}"
eval export "$1"='$value'
}
if [[ $(pwd) != *"SigScript" ]]; then
source utils/search.sh
find . -type f -name md5 -delete
#Check for hashes
FILES=$(cat utils/.updateDirectories)
for f in $FILES
do
search $f
check $f
done
else
echo "Dev build, no checks required."
fi

@ -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 -1A ./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}"

@ -0,0 +1,5 @@
.coauthors:3785ad38663e5fc43e574914ad067294 -
define.sh:d6b20a25a04a60d94f466e48fa60ac69 -
main.sh:32a1f953ffca8584d1eb57c0ecd8a582 -
search.sh:28d0ede8345514d80cc68cc756870002 -
.updateDirectories:0ede00461e947494545e694040787b3f -

@ -0,0 +1,77 @@
function search() {
FILES2=$(ls -A $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
SUM=$(md5sum < $1$g)
echo "$g:$SUM" >> $1md5
else
echo " md5 file, ignoring..."
fi
fi
done
}
function check() {
echo "Check $1"
FILES2=$(ls -A $1)
if [ -f "$1/md5" ];
then
echo " md5: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5"
curl -H 'Cache-Control: no-cache, no-store' -s https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5 --output /tmp/out
cmp -s $1/md5 /tmp/out
if [ "$?" -ne 0 ]
then
echo " Differences detected!"
cat /tmp/out
while IFS= read -r line
do
IFS=':' read -ra split <<< $line
g="${split[0]}"
if [ "$g" != "md5" ]; then
if [ -f $1$g ];
then
echo "++Redownload $1$g..."
if [ -f "$1$g" ]; then
#Read the 2nd line and see if it has a special directory.
CHECKLINE=$(sed -n '2{p;q;}' $1$g)
if [ "${CHECKLINE:0:1}" = "#" ]; then
#This could be a different diff, try that one.
echo " md5: https://raw.githubusercontent.com/sigonasr2/SigScript/main/${CHECKLINE:1}/$1md5"
curl -H 'Cache-Control: no-cache, no-store' -s https://raw.githubusercontent.com/sigonasr2/SigScript/main/${CHECKLINE:1}/$1md5 --output /tmp/out
cmp -s $1/md5 /tmp/out
if [ "$?" -ne 0 ]
then
echo " Differences detected here too."
curl -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/sigonasr2/SigScript/main/${CHECKLINE:1}/$1$g --output $1$g
fi
else
curl -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $1$g
fi
else
echo "===Could not find directory, assuming regular scripts directory exists."
curl -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output scripts/$g
fi
else
echo "++==Downloading $1$g..."
curl -H 'Cache-Control: no-cache, no-store' https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $1$g
fi
fi
done < /tmp/out
fi
fi
for g in $FILES2
do
if [ -d $1$g ];
then
echo "$1$g is a directory"
check $1$g/
fi
done
}
Loading…
Cancel
Save