From 4717636150370f70e4589cafeab51b2f6881e140 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Wed, 30 Oct 2024 10:06:01 +0000 Subject: [PATCH] refactor Util quantifiers --- developer/document/nomenclature.txt | 3 - .../document/unique_node_label_check.txt | 15 --- .../document/variable_suffix_conventions.txt | 4 + developer/javac/Mosaic.java | 11 ++- developer/javac/Util.java | 25 +++-- developer/tool/clean_build_directories | 1 + developer/tool/clean_javac_output | 1 + developer/tool/clean_make_output | 1 + developer/tool/clean_release | 1 + developer/tool/distribute_source | 1 + developer/tool/make | 1 + developer/tool/release | 1 + developer/tool/shell_wrapper_list | 1 + document/return_script_name.txt | 39 ++++++++ document/todo.txt | 4 +- release/Mosaic.jar | Bin 7916 -> 0 bytes .../alias/com/ReasoningTechnology/Mosaic/Test | 1 - tester/document/emacs_jdb.txt | 18 ---- tester/document/jdb.txt | 45 +++++++++ tester/jvm/Test_Mosaic.jar | Bin 0 -> 3664 bytes tester/shell/Test0 | 2 + tester/shell/Test_IO | 2 + tester/shell/Test_Util | 2 + tester/tool/#run_jdb# | 12 +++ tester/tool/env | 5 + tester/tool/make | 2 +- tester/tool/run_jdb | 11 +++ tester/tool/shell_wrapper_list | 2 +- tool_shared/bespoke/cat_w_fn | 1 + tool_shared/bespoke/deprecate | 4 +- tool_shared/bespoke/env | 48 ++++------ tool_shared/bespoke/env4 | 90 ------------------ tool_shared/bespoke/version | 1 + tool_shared/bespoke/vl | 1 + tool_shared/bespoke/wipe_release | 1 + 35 files changed, 184 insertions(+), 173 deletions(-) delete mode 100644 developer/document/nomenclature.txt delete mode 100644 developer/document/unique_node_label_check.txt create mode 100644 document/return_script_name.txt delete mode 100644 release/Mosaic.jar delete mode 120000 tester/alias/com/ReasoningTechnology/Mosaic/Test delete mode 100644 tester/document/emacs_jdb.txt create mode 100644 tester/document/jdb.txt create mode 100644 tester/jvm/Test_Mosaic.jar create mode 100755 tester/shell/Test0 create mode 100755 tester/shell/Test_IO create mode 100755 tester/shell/Test_Util create mode 100755 tester/tool/#run_jdb# create mode 100755 tester/tool/run_jdb delete mode 100644 tool_shared/bespoke/env4 diff --git a/developer/document/nomenclature.txt b/developer/document/nomenclature.txt deleted file mode 100644 index 633dc4a..0000000 --- a/developer/document/nomenclature.txt +++ /dev/null @@ -1,3 +0,0 @@ - -wellformed is a single word. Its antonym is 'malformed'. Wellformed syntax -parses without errors. diff --git a/developer/document/unique_node_label_check.txt b/developer/document/unique_node_label_check.txt deleted file mode 100644 index b978a74..0000000 --- a/developer/document/unique_node_label_check.txt +++ /dev/null @@ -1,15 +0,0 @@ - -predicate == is_well_formed_q - -We can not check that the node labels are unique because the given value -is a single node, and the code is stateless. Besides there is no contract with -the programmer on how to use the predicated, so the programmer could call the -predicate multiple times on the same node. Now can we test this condition in -our do_markup_graph routine because of the way lookup works, it will always -return the same node for the same label. This would be a truly difficult check -to perform because the map does not given an error but just takes the second of -the duplicate key definitions (is this really true?) besides, it would require -a formal proof of the recognizer functions that they do not return different -definitions for different keys to match regexprs against. I've been mulling -this over. As we currently the programmer provides the map and function -definitions, we don't even know which nodes will be in the graph... diff --git a/developer/document/variable_suffix_conventions.txt b/developer/document/variable_suffix_conventions.txt index e5ef76e..e3ad587 100644 --- a/developer/document/variable_suffix_conventions.txt +++ b/developer/document/variable_suffix_conventions.txt @@ -15,9 +15,13 @@ Instead of making a variable name plural, add the interface qualifier. ## Always a good idea to use these when working with files - `_fp`: Refers to a file path. The part after the last slash is a file name. + +- `_afp`: Refers to an absolute file path. - `_dp`: Refers to a directory path. By convention, the value ends in a slash. +- `_adp`: Refers to an absolute directory path. + - `_fn`: Refers to a file name. Value has no slashes. - `_dn`: Refers to a directory name. Value has no slashes. diff --git a/developer/javac/Mosaic.java b/developer/javac/Mosaic.java index d20baae..8ab7fe7 100644 --- a/developer/javac/Mosaic.java +++ b/developer/javac/Mosaic.java @@ -14,13 +14,14 @@ public class Mosaic{ } public static int run(){ - System.out.println("Mosic currently does not have a shell user interface."); + System.out.println("Main function placeholder. Currently Mosaic is used by extending the TestBench class."); return 0; } - // Main function to provide a shell interface for running tests - public static int main(String[] args){ - // currently accepts no arguments or options - return run(); + public static void main(String[] args){ + int return_code = run(); + System.exit(return_code); + return; } + } diff --git a/developer/javac/Util.java b/developer/javac/Util.java index 45f2a53..1757275 100644 --- a/developer/javac/Util.java +++ b/developer/javac/Util.java @@ -9,17 +9,28 @@ import java.lang.reflect.Method; import java.time.Instant; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; +import java.util.function.Predicate; public class Util{ - // Typically used to gather conditions before returning a test result. - // As this is used for testing, and an empty conditions list is unusual, - // returns false for an empty conditions list. - public static boolean all(boolean[] conditions){ - if( conditions.length == 0 ) return false; - for(boolean condition : conditions) if(!condition) return false; - return true; + // Linear search with a predicate + public static T find( T[] elements ,Predicate predicate ){ + for( T element : elements ){ + if( predicate.test( element )) return element; // Return the first match + } + return null; // Return null if no element satisfies the predicate + } + + // True when it does a search and finds a true value; otherwise false. + public static boolean exists( Object[] elements ){ + return elements.length > 0 && find( elements ,element -> (element instanceof Boolean) && (Boolean) element ) != null; } + + // True when it does a search and does not find a false value; otherwise false. + public static boolean all( Object[] elements ){ + return elements.length > 0 && find( elements ,element -> !(element instanceof Boolean) || !(Boolean) element ) == null; + } + public static void all_set_false(boolean[] conditions){ for(boolean condition : conditions) condition = false; } diff --git a/developer/tool/clean_build_directories b/developer/tool/clean_build_directories index 8990e26..4e2d60e 100755 --- a/developer/tool/clean_build_directories +++ b/developer/tool/clean_build_directories @@ -1,4 +1,5 @@ #!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # Removes all files found in the build directories. It asks no questions as to # how or why the files got there. Be especially careful with the 'shell' directory diff --git a/developer/tool/clean_javac_output b/developer/tool/clean_javac_output index 1f94c43..5ebeb51 100755 --- a/developer/tool/clean_javac_output +++ b/developer/tool/clean_javac_output @@ -1,4 +1,5 @@ #!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # remove all files created by make's call to `javac` # input guards diff --git a/developer/tool/clean_make_output b/developer/tool/clean_make_output index af7c00a..a7c6ebf 100755 --- a/developer/tool/clean_make_output +++ b/developer/tool/clean_make_output @@ -1,4 +1,5 @@ #!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # remove all files made by `make` # input guards diff --git a/developer/tool/clean_release b/developer/tool/clean_release index ec10d91..a33f19a 100755 --- a/developer/tool/clean_release +++ b/developer/tool/clean_release @@ -1,4 +1,5 @@ #!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # remove files made by `make` and by `release` # input guards diff --git a/developer/tool/distribute_source b/developer/tool/distribute_source index 003dd3d..faf844d 100755 --- a/developer/tool/distribute_source +++ b/developer/tool/distribute_source @@ -1,4 +1,5 @@ #!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # This script links the sources into the directory tree in parallel to the package. diff --git a/developer/tool/make b/developer/tool/make index 16b477b..be84a0e 100755 --- a/developer/tool/make +++ b/developer/tool/make @@ -1,4 +1,5 @@ #!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # input guards diff --git a/developer/tool/release b/developer/tool/release index 9ca9125..bcf4686 100755 --- a/developer/tool/release +++ b/developer/tool/release @@ -1,4 +1,5 @@ #!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # input guards diff --git a/developer/tool/shell_wrapper_list b/developer/tool/shell_wrapper_list index 67f7b2b..c95affe 100755 --- a/developer/tool/shell_wrapper_list +++ b/developer/tool/shell_wrapper_list @@ -1,4 +1,5 @@ #!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # input guards diff --git a/document/return_script_name.txt b/document/return_script_name.txt new file mode 100644 index 0000000..43738db --- /dev/null +++ b/document/return_script_name.txt @@ -0,0 +1,39 @@ + +I had a lot of problems in bash scripting language, while trying to export a +function that could report the name of the script it was called in. + +1. + +BASH_SOURCE[0] was used because $0 did not work with sourced scripts (a +fact that is leveraged for detecting when in a sourced script). + +2. + +Hence, this did not work in general: + + read -r -d '' script_afp_string <<'EOF' + realpath "${BASH_SOURCE[0]}" 2>/dev/null + EOF + + script_afp(){ + eval "$script_afp_string" + } + + export script_afp_string + export -f script_afp + +When `script_afp` was exported, used in another file, and used within a function +in that other file, it reported `environment` for the script name at +BASH_SOURCE[0]. In various call scenarios the actual script name appears at +BASH_SOURCE[1] or even at BASH_SOURCE[2]. + +3. + +As a stable alternative to having a script_afp function, place this line +at the top of scripts that use the `script_XX` functions, or at the top +of all scripts: + + script_afp=realpath "${BASH_SOURCE[0]}" + +Then use $script_afp as a string within other functions. It will have stable +value no matter the call structure. diff --git a/document/todo.txt b/document/todo.txt index 7f86390..6ff1508 100644 --- a/document/todo.txt +++ b/document/todo.txt @@ -24,6 +24,8 @@ Updates for Ariadne 5. make_source_tree also integrated into make -6. replacement for bespoke/env and all other env files +6. replacement for bespoke/env and all other env files, related document. + + diff --git a/release/Mosaic.jar b/release/Mosaic.jar deleted file mode 100644 index aa4a40040b234c9f88a73391491e70e79d6ed79d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7916 zcma)B1yod9+Xm@UK)MB_OS+Nn?h@$`h8RK`1{7&<1aW9Y+5shpMhR&cx&#pzhK^Ah ze)#YGKE2<%|9AiQtXb>KI`8wGcki>;diQ=FJxvTuGBjLVT(r-cmgZ=`1s)nEnzpi$ zJg>Tr3jbvv8X5+go+b|NO~$Q1)AasNFxhp+zrot_I_fIQhDLnaDu>zw{aTv5e4|8~ zyj(*A!_@`?<3dZTK71P5JnGt`eq}WV0>a}$BSON4BVO7=y*wN`#$H;z{2aYJgA*&O z%d5Bkw+L+@RfgjAE99?#zlsP5)cDH?@UNfpIlKD0Is-g?9LJUo#-}ugd3v>m`}sBg zB;rq;6(G4zyYnZ}HRO7PSR&?sA;P?VYVYa6fAgxp&!GAhy4tCP*eNc)g%+h~|SAz%5b zhLq_^>g-_of=F!>)L(3Thc~fa$YJC3er@wxTc>pgd3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pfotbGuy>qrjs)6U#OI4Y*F&hbh1b!#(hgShjP;rN1wb54y$`g=*{Gq; zVk8DzCr zzeR@jR~P7C7Tk?X_t*Hh?RMkY{U`Ky9M7`|HgA zuBqPmZ@(h%pUM8^#{IXMxshXk#Tw2ZGxK-j{IkM8#o51>`MV@{BhUT{j%#=GX0HE< z@prNI_Z4s>>-~OIx{>vMh0gWo{s;D7BHw?~{=VXG&RM^L?AoFI2ipHQb?IqhU7zL9 R& which jdb - /var/user_data/Thomas-developer/Mosaic/tool_shared/third_party/jdk-11/bin/jdb - -If Emacs has been run from outside of `env_developer` or `env_tester` then -emacs will not see the path to tool_shared/third_party. Emacs can be told -explicitly: - - (setenv "PATH" (concat (getenv "PATH") ":/var/user_data/Thomas-developer/Mosaic/tool_shared/third_party/jdk-11/bin")) - (setq exec-path (append exec-path '("/var/user_data/Thomas-developer/Mosaic/tool_shared/third_party/jdk-11/bin"))) - -but this probably won't work as other things will also be missing from the -environment.So either run emacs in the correct environment, or run jdb from a -shell after sourcing the environment. diff --git a/tester/document/jdb.txt b/tester/document/jdb.txt new file mode 100644 index 0000000..14cceb2 --- /dev/null +++ b/tester/document/jdb.txt @@ -0,0 +1,45 @@ + +1. location + + jdb will be in the third_party tools directory: + + 2024-10-27T09:34:37Z[Mosaic_tester] + Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ + > which jdb + /var/user_data/Thomas-developer/Mosaic/tool_shared/third_party/jdk-11/bin/jdb + +2. IDE and the environment + + The environment must be set before running the IDE or the IDE will not + have access to it. + + For example Emacs will be following the PATH as it was when Emacs + was invoked, for file completion in the Emacs shell, etc. Even when + the environment is set in a shell running inside of emacs. + + FYI, the path can be fixed but other environment settings will still be missing. + (setenv "PATH" (concat (getenv "PATH") ":")) + (setq exec-path (append exec-path '(" + + currently, in emacs, e.g.: + jdb -sourcepathjavac Test_Util + + When invoked from Emacs M-x jdb, there is no space between the -sourcepath and + the $SOURCEPATH. + + In jdb run from gud-gdb, when packages are used, the SOURCEPATH is the path + to the directory that holds a directory tree, where said directory tree + parallels the package name. Otherwise it is the directory path to the source + directory. Note the `distribute_sources` script. + + When using packages, the is fully qualified. + + + diff --git a/tester/jvm/Test_Mosaic.jar b/tester/jvm/Test_Mosaic.jar new file mode 100644 index 0000000000000000000000000000000000000000..5e80583ab14bfeace406a3829e432b0c5ff24669 GIT binary patch literal 3664 zcmaKv2T)U47sqMQ&^rbxf*?ggC<#>o0fU4P2wgfTRZ65Oph&MPNbemNsaZ-u1O!wN zB7uM)Q3yzHOA$euA|LGTx1uxOciz02`{tf=-+gz^`=9eeBdKXPD1bm9g*?i}oZ^Jh zQqWMK;Ku5b2t6&S?{6q5s439M)4*d7s(;+j|1+55$m8E&l)4^53vOf#L1}HG2)(*U zNys20Qu1Oyfmm-SJq(?k^M>f4zzEc!Uj@!k8a50afWnLhZln6~U@<+D+q!ruF+8~M z-R#`-9MxZ&K>2_&HIH7QesurXM39~SPhUWHGz)Qd^>uaj#CSUnO&boAkVG(Em)I+% z^Up$3@uSkLM{dkNEhP8LQP3aF8aw*Bl#Bhjp72xgkVHFSF#1lCvjO zb)TjUj19yFj=EyX-Q~z}Y0?AQCDJzZQ0rXgFzkoHXOnWKCZ1eeksW1Z_vQOT4t$Ps zB!K9j!gt!i#wD;1BU(>l(WBSTT&1rA`zoM7&&_G?R^z%6FFc}^S+#EQ#FM7RYWSlO zl@qWmJ&WJc

tfr2Ta*6qCe<@X38W{WA(fdR*n*&4t^Nt7*mJ0)?0C5(OW*QIeib zc|j++ow}D7GDK zpD&{9T3z8HikQJQnAsvW(bv9YXmy9Nzph1NJ*v)N`I21M=Cm3BqN^bL-SsBrYBi$o zjcgGk`+EkU%OYU^mM(F>GN_inL z6vDH$L><-+*n(0R(;G2o>wjQKB|i$`U0Nx%Q1nOd@JF-VesQp-nss+uyjmH#`Bm}U z;`fJ_(BCyOzSh1EuwC?~lj)A@LsRa1ad$Y!Oq-wLw$C*X0nP9}0Z#)jSUGXeJqGYQ z6J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DSR42Q}ShAbrI{5nC=UDE}NUVa2g~W%o9O@{yehp{p z602xa@|%08JXQ^px*#?ltka)&>1c;_@8oLi8xG=Ike-8$^4*bZTs3xN6AOscif)_Z#qB2v5{vk(Vc8(uQ0P7l%e$Kq z5P^7skl;_(W(6lpS~S80E>YC$+KH-M(MA=oR2@X=@${Il#;Phb#jjg39NhEu&^Hz@>PMBnsG`(=XWv=E+Y#oT(V?@SciIxZhVir z9(%nIp>THViX=&{J)N6go+8i*%u&WUNjY_;8ps?&b1TwchHw@9J{4vx4k1Te%l54| z2&QncS-`Mu24a=R5UHTNtwDIQr`D2vwzZX$0x8xjTJZwg{eJ#7C#jEvy+Zr`Zyw|i z5`CCHg@v=tCSK)Ev`Ln|s#B`Cg4(7Z9dJwrc@-K(A!<$wiimHsbzdvk+FmW28Dm;iYj|s9SwHBB1|bbPW3xpq_!H zTbTAUqqWqMv^EOwwm-;dcq36(Tk!MQvn&N+PP8M1`0pso5u~M?&!4xx z3w{u-`zE#b+aa_dakM$jBMH8fu5LRtWAMnf(w3s(D>-4lI!jD*#jdH@V3|azm4&p)Ci<*l#?+VSSmzRVSQBdnrZn*rsW z1yk#$%-?Td$t!tWDav$SiW`k$lIgttd(|dT)nr+I{_2gK#%R<+4%|6GVAJM(zHHXa z!!m`i0`}Z3`F(LBW=sEA$@1W%r1&Ex>!UqZGD<2Ail3?GzsPb-H9y7_#{4jdTpJ?RQz>}JO y+$sLB?4z#oFCG7H-}r0j$wNFA{U1hm#C^Y%05lSC>e%7b(dBfsrD2BSr~d%(&<>LT literal 0 HcmV?d00001 diff --git a/tester/shell/Test0 b/tester/shell/Test0 new file mode 100755 index 0000000..5b3584f --- /dev/null +++ b/tester/shell/Test0 @@ -0,0 +1,2 @@ +#!/bin/env bash +java Test0 diff --git a/tester/shell/Test_IO b/tester/shell/Test_IO new file mode 100755 index 0000000..72977e7 --- /dev/null +++ b/tester/shell/Test_IO @@ -0,0 +1,2 @@ +#!/bin/env bash +java Test_IO diff --git a/tester/shell/Test_Util b/tester/shell/Test_Util new file mode 100755 index 0000000..0e4ba3d --- /dev/null +++ b/tester/shell/Test_Util @@ -0,0 +1,2 @@ +#!/bin/env bash +java Test_Util diff --git a/tester/tool/#run_jdb# b/tester/tool/#run_jdb# new file mode 100755 index 0000000..9c472f4 --- /dev/null +++ b/tester/tool/#run_jdb# @@ -0,0 +1,12 @@ +#!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# input guards +env_must_be="tester/tool/env" +if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 +fi + +jdb -sourcepath "$SOURCEPATH" "$@" + diff --git a/tester/tool/env b/tester/tool/env index 322258e..e73741c 100644 --- a/tester/tool/env +++ b/tester/tool/env @@ -29,6 +29,11 @@ export CLASSPATH=\ :"$REPO_HOME"/tester/jvm/Test_"$PROJECT".jar\ :"$CLASSPATH" +export SOURCEPATH=\ +"$REPO_HOME"/tester/javac/\ +:"$REPO_HOME"/developer/scratchpad/\ + + # misc # make .githolder and .gitignore visible diff --git a/tester/tool/make b/tester/tool/make index e125d92..deae0a1 100755 --- a/tester/tool/make +++ b/tester/tool/make @@ -24,7 +24,7 @@ echo "Creating shell wrappers..." for file in $wrapper;do cat > shell/$file << EOL #!/bin/env bash -java com.ReasoningTechnology.$PROJECT.Test.$file +java $file EOL chmod +x shell/$file done diff --git a/tester/tool/run_jdb b/tester/tool/run_jdb new file mode 100755 index 0000000..65b05c4 --- /dev/null +++ b/tester/tool/run_jdb @@ -0,0 +1,11 @@ +#!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# input guards +env_must_be="tester/tool/env" +if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 +fi + +jdb -sourcepath "$SOURCEPATH" "$@" diff --git a/tester/tool/shell_wrapper_list b/tester/tool/shell_wrapper_list index 74933cb..aec2e97 100755 --- a/tester/tool/shell_wrapper_list +++ b/tester/tool/shell_wrapper_list @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/env bash script_afp=$(realpath "${BASH_SOURCE[0]}") # input guards diff --git a/tool_shared/bespoke/cat_w_fn b/tool_shared/bespoke/cat_w_fn index f8d02cd..89166b6 100755 --- a/tool_shared/bespoke/cat_w_fn +++ b/tool_shared/bespoke/cat_w_fn @@ -1,4 +1,5 @@ #!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # Check if at least one file is provided if [ $# -eq 0 ]; then diff --git a/tool_shared/bespoke/deprecate b/tool_shared/bespoke/deprecate index 124ffed..4713db5 100755 --- a/tool_shared/bespoke/deprecate +++ b/tool_shared/bespoke/deprecate @@ -1,12 +1,12 @@ #!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # cp subtree at under file path , and make all the copied # files read-only. The intended use case is for moving files to a `deprecated` # directory. This helps prevent subsequent accidental editing. -SCRIPT_NAME=$(basename "$0") if [ "$#" -lt 2 ]; then - echo "Usage: $SCRIPT_NAME " + echo "Usage: $script_afp " exit 1 fi SRC="$1" diff --git a/tool_shared/bespoke/env b/tool_shared/bespoke/env index 59f8f96..4fa561b 100644 --- a/tool_shared/bespoke/env +++ b/tool_shared/bespoke/env @@ -5,47 +5,37 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then exit 1 fi -# This is the base environment shared by all roles in the project. +# -------------------------------------------------------------------------------- +# project definition -# The project administrator sets up the following tools for all roles to use: -# - export JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-11" - -# Absolute path to script file. The use of eval makes it suitable for exporting -# and use with other scripts -# -# IMHO it is not possible write a function in bash that reliably returns the -# script's path in all execution scenarios of direct execute, sourcing, and -# usage in other functions. So instead, define a variable script_afp at the top -# of each script: -# -# script_afp=realpath "${BASH_SOURCE[0]}" -# -# read -r -d '' script_afp_string <<'EOF' -# realpath "${BASH_SOURCE[0]}" 2>/dev/null -# EOF -# script_afp(){ -# eval "$script_afp_string" -# } +# actual absolute director path for this script file script_adp(){ dirname "$script_afp" } - -# This script assumes it is located at $REPO_HOME/tools_shared/bespoke and works -# backwards to recover $REPO_HOME, etc. +# assume this script is located $REPO_HOME/tools_shared/bespoke and work backwards +# to get $REPO_HOME, etc. REPO_HOME=$(dirname "$(dirname "$(script_adp)")") echo REPO_HOME "$REPO_HOME" PROJECT=$(basename "$REPO_HOME") echo PROJECT "$PROJECT" + + # set the prompt decoration to the name of the project PROMPT_DECOR=$PROJECT +# -------------------------------------------------------------------------------- +# The project administrator sets up the following tools for all roles to use: +# + export JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-11" -# These functions are offered as a convenience to be run inside other scripts. -# These produce $REPO_HOME relative results, and thus preferred over script_adp. +# -------------------------------------------------------------------------------- +# the following functions are provided for other scripts to use. +# at the top of files that make use of these functions put the following line: +# script_afp=$(realpath "${BASH_SOURCE[0]}") +# ## script's filename script_fn(){ @@ -62,12 +52,12 @@ fi dirname "$(script_fp)" } -# Exports, and give the exported environment a name +# -------------------------------------------------------------------------------- +# Exports # Bash has no 'closure' hence when exporting a function, one must also export all the pieces. +# do not export script_afp export REPO_HOME PROJECT PROMPT_DECOR -# export script_afp_string -# export -f script_afp script_adp script_fn script_dp script_fp export -f script_adp script_fn script_dp script_fp export ENV=$(script_fp) diff --git a/tool_shared/bespoke/env4 b/tool_shared/bespoke/env4 deleted file mode 100644 index 39abce6..0000000 --- a/tool_shared/bespoke/env4 +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# This is the base environment shared by all roles in the project. - -# The project administrator sets up the following tools for all roles to use: -# - export JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-11" - -# Absolute path to script file. The use of eval makes it suitable for exporting -# and use with other scripts -# -# IMHO it is not possible write a function in bash that reliably returns the -# script's path in all execution scenarios of direct execute, sourcing, and -# usage in other functions. So instead, define a variable script_afp at the top -# of each script: -# -# script_afp=realpath "${BASH_SOURCE[0]}" -# -# read -r -d '' script_afp_string <<'EOF' -# realpath "${BASH_SOURCE[0]}" 2>/dev/null -# EOF -# script_afp(){ -# eval "$script_afp_string" -# } - - script_adp(){ - dirname "$script_afp" - } - - -# This script assumes it is located at $REPO_HOME/tools_shared/bespoke and works -# backwards to recover $REPO_HOME, etc. - - REPO_HOME=$(dirname "$(dirname "$(script_adp)")") - echo REPO_HOME "$REPO_HOME" - - PROJECT=$(basename "$REPO_HOME") - echo PROJECT "$PROJECT" - PROMPT_DECOR=$PROJECT - - -# These functions are offered as a convenience to be run inside other scripts. -# These produce $REPO_HOME relative results, and thus preferred over script_adp. - - ## script's filename - script_fn(){ - basename "$script_afp" - } - - ## script's dirpath relative to $REPO_HOME - script_fp(){ - realpath --relative-to="${REPO_HOME}" "$script_afp" - } - - ## script's dirpath relative to $REPO_HOME - script_dp(){ - dirname "$(script_fp)" - } - -# Exports, and give the exported environment a name -# Bash has no 'closure' hence when exporting a function, one must also export all the pieces. - - export REPO_HOME PROJECT PROMPT_DECOR -# export script_afp_string -# export -f script_afp script_adp script_fn script_dp script_fp - export -f script_adp script_fn script_dp script_fp - - export ENV=$(script_fp) - echo ENV "$ENV" - -echo -echo "--------------------------------------------------------------------------------" -echo "from within, at the end, of test_shared/bespoke/env the script functions return the following." -echo -echo "REPO_HOME:" "$REPO_HOME" -echo "PROJECT:" "$PROJECT" -echo "script_afp:" "$script_afp" -echo "script_adp:" "$(script_adp)" -echo "script_fn:" "$(script_fn)" -echo "script_fp:" "$(script_fp)" -echo "script_dp:" "$(script_dp)" -echo "ENV:" "$ENV" -echo "---------" -echo "the stack" - top_index=$(( ${#BASH_SOURCE[@]} - 1 )) - for (( i=0; i<=top_index; i++ )); do - echo "$i: ${BASH_SOURCE[$i]}" - done - diff --git a/tool_shared/bespoke/version b/tool_shared/bespoke/version index 5b99cbb..3a9dd05 100755 --- a/tool_shared/bespoke/version +++ b/tool_shared/bespoke/version @@ -1,4 +1,5 @@ #!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # 2024-10-24T14:56:09Z project skeleton and test bench files extracted from Ariadne echo v0.1 diff --git a/tool_shared/bespoke/vl b/tool_shared/bespoke/vl index 94fe14d..2c968d3 100755 --- a/tool_shared/bespoke/vl +++ b/tool_shared/bespoke/vl @@ -1,4 +1,5 @@ #!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # vl 'vertical list' # Check if the command is provided diff --git a/tool_shared/bespoke/wipe_release b/tool_shared/bespoke/wipe_release index d92cc88..5bac0e7 100755 --- a/tool_shared/bespoke/wipe_release +++ b/tool_shared/bespoke/wipe_release @@ -1,4 +1,5 @@ #!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") # remove all files in the release directory set -e -- 2.20.1