From c68bd89820aad0063be6a313957f7de3b2fc4502 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Wed, 29 Jun 2022 18:02:54 +0000 Subject: [PATCH] Implement SigScript system and pipeline into project Co-authored-by: sigonasr2 --- C/scripts/build.sh | 7 +++ C/scripts/commit.sh | 20 ++++++++ C/scripts/filelist | 2 + C/scripts/md5 | 2 + CProjectTemplate | Bin 0 -> 16696 bytes README.md | 19 ++++++++ install | 15 ++++++ main | Bin 17624 -> 17688 bytes main.c | 2 + sig | 9 ++++ utils/.coauthors | 1 + utils/.updateDirectories | 4 ++ utils/define.sh | 26 ++++++++++ utils/filelist | 7 +++ utils/main.sh | 28 +++++++++++ utils/md5 | 6 +++ utils/search.sh | 103 +++++++++++++++++++++++++++++++++++++++ utils/utils.c | 6 +++ utils/utils.h | 1 + 19 files changed, 258 insertions(+) create mode 100755 C/scripts/build.sh create mode 100755 C/scripts/commit.sh create mode 100644 C/scripts/filelist create mode 100644 C/scripts/md5 create mode 100755 CProjectTemplate create mode 100644 README.md create mode 100755 install create mode 100755 sig create mode 100644 utils/.coauthors create mode 100644 utils/.updateDirectories create mode 100755 utils/define.sh create mode 100644 utils/filelist create mode 100644 utils/main.sh create mode 100644 utils/md5 create mode 100644 utils/search.sh create mode 100644 utils/utils.c create mode 100644 utils/utils.h diff --git a/C/scripts/build.sh b/C/scripts/build.sh new file mode 100755 index 0000000..654271e --- /dev/null +++ b/C/scripts/build.sh @@ -0,0 +1,7 @@ +#Compiles the entire program then runs it, producing an executable. +#C +printf "Running program...\n\n\n" +if gcc $(find . -type f -name "*.c") ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then + ./${PROJECT_NAME} +fi +printf "\n\n" diff --git a/C/scripts/commit.sh b/C/scripts/commit.sh new file mode 100755 index 0000000..0f56a8f --- /dev/null +++ b/C/scripts/commit.sh @@ -0,0 +1,20 @@ +#Adds a commit message and pushes project to github repository. +#C +COMMIT_MESSAGE="$*" +FIRST_LINE=true +while IFS= read -r line +do +if [ "$FIRST_LINE" = true ]; then + COMMIT_MESSAGE+=" + +Co-authored-by: $line" +FIRST_LINE=false +else + COMMIT_MESSAGE+=" +Co-authored-by: $line" +fi +done < utils/.coauthors +git add -u +git add * +git commit -m "$COMMIT_MESSAGE" +git push \ No newline at end of file diff --git a/C/scripts/filelist b/C/scripts/filelist new file mode 100644 index 0000000..e0fa154 --- /dev/null +++ b/C/scripts/filelist @@ -0,0 +1,2 @@ +build.sh +commit.sh diff --git a/C/scripts/md5 b/C/scripts/md5 new file mode 100644 index 0000000..203bf2d --- /dev/null +++ b/C/scripts/md5 @@ -0,0 +1,2 @@ +build.sh:dbb1880f6b747ec208d6f277c0be61c2 - +commit.sh:89783d2e6a165aa9612c79cfbd804a35 - diff --git a/CProjectTemplate b/CProjectTemplate new file mode 100755 index 0000000000000000000000000000000000000000..deadea398858006a6c816b2cd5e892b6f935c76e GIT binary patch literal 16696 zcmeHOZ)_Y#6`%9j@ujiPm(-z7QsNB_C?WC2P95VEOz!+Id)4I+iA{`}baVEt?SuPc z?)F-{f?{x6_0$@yN~jf7Y9k?mR4ReQhwuS#2$Uevs`&ziQV|NFE=r3NQWT)c@!srv z=iT)=NQF{HIdAU9XjUg%WyNoAM0TQF#4x4bgMHY+GT}~XL`c4wE9g1joj_l5n9pfU^$H?)- znBb?A;^{^O$}lPNTL`z^5ZSr0m-HF24opWcnu+&P-(j+ARHPf>My`jE>-z-Q@sL`U zH~;2gK0@`aG!7cYpOL~VcBPWT9qqePiI!9{Q1>89bxXCPA~vgvqRg@O3H)2SJrp)3SEJUQ)CazP`ML?OwF>6x z`ea@Z9|&9J%(MIo4hSS1ORSI61sl(E2+J01JYNgQFWPu{UqceoH5+fgUS1}?7Ie7J z(!l%jBH%^9i+~paF9Kc!ya;#^_`iz4UmG_6Lz}r2&>pM#^)4Z_hv&_z(#zV+PXcFU z97=n>2K1HE2fq%`&@51Y980de`TJ6-G>0;jJ}*mqg)9fTV3*t8iWbk`s}*0@X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29fmgUP8-7Oe%jd~1;6q}= zvUySu{JN^;*F^{NHou&`dj&p8{@wEvcQz?(Y{Q3vUt6_7@O_qxo|CqItm>mzt#BM+xF5?OsLl^u?!^n{ts<@I=BQjBEN z6Dh+q5^85_M_XkjJS&pai;%P%q6w>J_FtJHGXqpaHJW&Eo()Io$ zkpq2t-@#rTj*2+-5<>6&)WOJsXpgf*o=E`;&g$rW8hOxqj|hE#>`-?krXT9>KiW5- z4@A0Sedtx5WEsg9WQ%WpcEw1<%{U#235Oj=Ufc&_+{I{VoqB;Pokw8wL_VvJ$1@2$ z9uqwTT8U&vFXRpA;!^7{NFWdA^W;VzyU}$xUBdywV>cDg(l}4=IGZNa{8ZYE4+EMx z3&%MJM}LgmgiteC(@@7U1$82qoiK9dl#LoLB;ov3GC@?NJKAE#$AnZLkLSmQnwZK! z6&9K~tK>c-mrrIh4nc>qoRNy70p%uArchv{%rb}Q3Kgbz8m6rKT6qsL{?fsv2lr4b@j8o<*XvX) zbvciC2Yhgi%=Ww=k+4vx2Rt1BgUES`FSA;9Cn%Qd0ol)5R};y`mm?Z zf`HEuY|raYMqGzr;`Xy15;x+aX<-;Z4Oyv}E==Y|uyd_8XH{(E>Zjo3l>46 literal 0 HcmV?d00001 diff --git a/README.md b/README.md new file mode 100644 index 0000000..cc55afb --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +This repository provides a template for starting a new C project using Sig's build system! Updates are automatically propogated. Run `./sig` for a list of commands and then use follow the instructions given to invoke them. Adjust variables as necessary in the `sig` command file. + +``` +@sigonasr2 ➜ /workspaces/CProjectTemplate (main) $ ./sig +Dev build, no checks required. + + Usage: ./sig {args} + +==== Current Configuration ===================== + PROJECT_NAME CProjectTemplate + BUILD_OPTIONS -lncurses + LANGUAGE C +===================================================== + + Command List: + + build Compiles the entire program then runs it, producing an executable. + commit Adds a commit message and pushes project to github repository. +'`` \ No newline at end of file diff --git a/install b/install new file mode 100755 index 0000000..cf8dc5d --- /dev/null +++ b/install @@ -0,0 +1,15 @@ +echo "Initializing..." +FILES=$(ls -dA */) +LANGUAGES=() +for f in $FILES +do + if [ "$f" != "scripts/" ] && [ "$f" != "utils/" ]; + then + LANGUAGES+=(""${f::-1}"") + fi +done +echo "Languages Detected:" +for f in "${LANGUAGES[@]}" +do + printf "\t%-15s\n" $f +done \ No newline at end of file diff --git a/main b/main index 19612d028356e0f531988b5e85816dd7a3c14cc6..9e02579e95d20a64a8040e99e374bbdb4c167eb6 100755 GIT binary patch delta 1317 zcmZWpQD_ub6uoaZTQkP!uE{cv)nsA=snwX-G`bscHKQ9cfmF0jYW(oSmXt*LVK7=P zLZFIfx-Kp~=** zv5Et)?ms;J+Jf(QKB!#n91ec5Q28ndU}Y+sf==z?RABfbw-qi>u+pJ#8UZdvC?Dr1 zS@sWw^|MkQc`k?4bhKl&s~I7UeVe&8#8J~n+(dF12Xe&3wHYbXJu~U{=cfI$J!xg4 z@d~2nk>*Mn1@DVq|lYLBu*V6C~ME0g@C0l<8>(_Vht?CG?p&2H14>9I16SLytn zu9dUakw@i)VP|XflliCg`nULU6&~qdOlUaZi?MJi=Xx42hZy^uizof*XQRSSi8>m2|u~%dr zyKzUE$YMU$Ar4}sIqGa|J|)CC%r~o;YhI%8XBAKlm$CR}gEmeTKok;5H<=4JFxH}K zcicJ(#{bxdxSQC2i50K}wr!egbCWl4l-O$Ww-~}O5%pOAg@<~aY*EV$V#!@q0LHM` zqKYouzE%}`ux_oY)o^DZ0$IPaG<}dYvCsUu^*-y~6iLp|c?6b%-sbE1hG~tvlYe*P zEJsZz##L_i6nwY5QkW+X{carLsC`Y!FlYd6u3#>lM{}Jjrd;Jc9HhL+c`QOd$OwIE z&^;;tLU`$P&UdlR_uS_lgMl~KsoIZJg~_?$`|(Nm7DZf*ZKqyl!)>K=4|n-9E2_NO zeWNISk7tTuck-9)C!oF5JBFii_Rq>ZPEtP0IX;P>3+*2o_;4S7p7>K4>f1N;cHi#z z`<(-=xuDaV%mu|YY&Dyd(l?XELG!ri#(&JF$U)unQ9{dU-7H0Aj{hoXEvIc@duo-U XC)@+5!9%I|{EZvDYN^1FlQsVVu=G+L delta 1249 zcmZWpTWAwm82-?p$*m9Ylj>qPIH)SmKRA4eLp zf0SNDehNG_4|p!s`uBN=(!({DVz$($ltby9cch)@ZV2J`Wd5}AWHR-|vW`t#d(~Wc z!&10%-aItM3(56>gX4${k|pmE`jEufjAiA9W^x15x=}J7ria6N73fN6?pI*BE!C5w zP$4|&hX3+^JUNNmz{qqP9AT5Yt;crqITkz3=;I&jT2e%x>YD%4w`7Lzj0AW+*+}{!c5>#!TCn^s&EvlQ+$S;iG|kpfj&68IafIlO27qtiuw3*X4f7 zvK{~?fIkCAKU&sHU>P_Kq|cVsh!bal+jzIu8p%T0A(>QVP{I<-F3jJ!2(}-2ZMUQ_ z8Zh@__VARZiude~wnWRwP^Z8-P#Zjg*YIIc(=jpH$iQg>jF-zQG}@9b-R$_=yEl_1F=D{!Ee|FGN%%vf?I1gc9)EboCF)9Cemi3P(zLz zk`+(wwQMVE!Pv^Aqp;rr%mjy4sA99d?vrce9F(#X>UWg0>s8(jWzkmt&R1ZMOFM4a znQ>&zQOb8OM=fqo-je2azSD72GmCCD@(8;iI`2%nZWk_dyjzX0MyzDNy^VEl&Z_y2 z+s;y?H}CY0d(88F?>yoh@7M9K zar-WCQ9mg%+?(tOWi_YnEXK_JNlVn+k{>+ABFqjxp8CQ6q1$#)HQz~f2WD0}yC%VR H` #include #include "extras.h" +#include "utils/utils.h" int main(int argc,char**argv) { int rows,cols; @@ -21,6 +22,7 @@ int main(int argc,char**argv) { addch(ACS_BTEE); addch(' '); writeExtras(); + testReach(); mvaddch(5,17,ACS_DARROW); attron(COLOR_PAIR(1)); diff --git a/sig b/sig new file mode 100755 index 0000000..92f6cdb --- /dev/null +++ b/sig @@ -0,0 +1,9 @@ +export AUTO_UPDATE=true + +source utils/define.sh + +define PROJECT_NAME "main" +define CUSTOM_PARAMS "-lncurses" +define LANGUAGE "C" + +source utils/main.sh \ No newline at end of file diff --git a/utils/.coauthors b/utils/.coauthors new file mode 100644 index 0000000..b904d0f --- /dev/null +++ b/utils/.coauthors @@ -0,0 +1 @@ +sigonasr2 diff --git a/utils/.updateDirectories b/utils/.updateDirectories new file mode 100644 index 0000000..0c078d1 --- /dev/null +++ b/utils/.updateDirectories @@ -0,0 +1,4 @@ +Java/ +C/ +scripts/ +utils/ \ No newline at end of file diff --git a/utils/define.sh b/utils/define.sh new file mode 100755 index 0000000..214fc50 --- /dev/null +++ b/utils/define.sh @@ -0,0 +1,26 @@ +export VARS=("") + +export LANGUAGE="" + +function define() { + VARS+=("$1") + value="${*:2}" + eval export "$1"='$value' +} + +if [[ $(pwd) != *"SigScript" && $AUTO_UPDATE = "true" && $1 != "update" ]]; then + source utils/search.sh + + find . -type f -name md5 -delete + find . -type f -name filelist -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 \ No newline at end of file diff --git a/utils/filelist b/utils/filelist new file mode 100644 index 0000000..3e39f04 --- /dev/null +++ b/utils/filelist @@ -0,0 +1,7 @@ +.coauthors +define.sh +main.sh +search.sh +.updateDirectories +utils.c +utils.h diff --git a/utils/main.sh b/utils/main.sh new file mode 100644 index 0000000..d299d6b --- /dev/null +++ b/utils/main.sh @@ -0,0 +1,28 @@ +if [ -z "$1" ] + then + echo "" + echo " Usage: ./sig {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 ./$LANGUAGE/scripts 2>/dev/null | sed -e 's/\.sh$//' | sed -e 's/^/ /') + for f in $FILES + do + if [ -f "./$LANGUAGE/scripts/$f.sh" ]; then + DESC="$(head -n1 ./$LANGUAGE/scripts/$f.sh)" + printf "\n\t%-15s%-65s" $f "${DESC:1}" + fi + done + echo "" + exit +fi + +./$LANGUAGE/scripts/$1.sh "${*:2}" \ No newline at end of file diff --git a/utils/md5 b/utils/md5 new file mode 100644 index 0000000..1608562 --- /dev/null +++ b/utils/md5 @@ -0,0 +1,6 @@ +define.sh:3ecab0dffe2adfb950f3eb7c7061b750 - +main.sh:d3d1bd0b56d8114eb7479964227f8576 - +search.sh:81d08f5ff48e8a44b5f68387d426da05 - +.updateDirectories:fa5e95db12be22ae8aed7ecbc560e38c - +utils.c:dda26981cc7c9e9a62110e8db54e582f - +utils.h:324dca30e95cbdf1effb042813da858d - diff --git a/utils/search.sh b/utils/search.sh new file mode 100644 index 0000000..99a69b3 --- /dev/null +++ b/utils/search.sh @@ -0,0 +1,103 @@ +function search() { + FILES2=$(ls -A $1 2>/dev/null) + 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" ] && [ $g != "filelist" ] && [ $g != ".package.files" ]; then + if [ $g != ".coauthors" ] && [ $g != "version_info" ]; then + SUM=$(md5sum < $1$g) + echo "$g:$SUM" >> $1md5 + fi + echo "$g" >> $1filelist + else + echo " ignoring $g..." + fi + fi + done +} + +function check() { + echo "Check $1" + FILES2=$(ls -A $1 2>/dev/null) + 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]}" + echo "LINE -- $g" + if [ "$g" != "md5" ] && [ "$g" != "filelist" ] && [ "$g" != ".package.files" ]; then + if [ -f $1$g ]; + then + if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then + echo "++Redownload $1$g..." + if [ -f "$1$g" ]; then + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g + 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 $LANGUAGE/scripts/$g + fi + 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 + if [ -f "$1/filelist" ]; + then + echo " filelist: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1filelist" + curl -H 'Cache-Control: no-cache, no-store' -s "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1filelist" --output /tmp/out + cmp -s $1/filelist /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]}" + echo "LINE -- $g" + if [ "$g" != "md5" ] && [ "$g" != "filelist" ] && [ "$g" != ".package.files" ]; then + if [ -f $1$g ]; + then + if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then + echo "++Redownload $1$g..." + if [ -f "$1$g" ]; then + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g + 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 $LANGUAGE/scripts/$g + fi + 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 +} diff --git a/utils/utils.c b/utils/utils.c new file mode 100644 index 0000000..2f20b91 --- /dev/null +++ b/utils/utils.c @@ -0,0 +1,6 @@ +#include +#include "utils.h" + +void testReach() { + addch(ACS_DEGREE); +} \ No newline at end of file diff --git a/utils/utils.h b/utils/utils.h new file mode 100644 index 0000000..4828daf --- /dev/null +++ b/utils/utils.h @@ -0,0 +1 @@ +void testReach(); \ No newline at end of file