turns off bash literal file globs for developer scripts
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Tue, 7 Jan 2025 05:04:50 +0000 (05:04 +0000)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Tue, 7 Jan 2025 05:04:50 +0000 (05:04 +0000)
18 files changed:
developer/bash/Build [new file with mode: 0755]
developer/documentđź–‰/Step_Right_Machine.txt
developer/example/Example_* [new file with mode: 0755]
developer/example/Example_CountingNumber_0 [deleted file]
developer/example/Example_IndexTree_Diagonal_SRM [deleted file]
developer/example/Example_SRMI_Array [deleted file]
developer/example/Example_SRM_List [deleted file]
developer/example/list [new file with mode: 0755]
developer/toolđź–‰/bash_wrapper_list
developer/toolđź–‰/clean
developer/toolđź–‰/env_script [new file with mode: 0644]
developer/toolđź–‰/gather_source_links
developer/toolđź–‰/gather_third_party
developer/toolđź–‰/make
developer/toolđź–‰/make_example
developer/toolđź–‰/release
release/Ariadne.jar
tool_shared/bespokeđź–‰/env

diff --git a/developer/bash/Build b/developer/bash/Build
new file mode 100755 (executable)
index 0000000..2a18026
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+java com.ReasoningTechnology."Ariadne".Build
index df98f3a..7191296 100644 (file)
@@ -81,3 +81,6 @@ Rightmost     true    false   At the last cell of a finite segment (or singleton tape).
 A precise loop that doesn’t compromise readability or efficiency.
 An elegant state pattern that aligns with the real-world model.
 The beauty of RT code format guiding clarity and consistency!
+
+
+Callisto
diff --git a/developer/example/Example_* b/developer/example/Example_*
new file mode 100755 (executable)
index 0000000..3c6f542
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+java Example_*
diff --git a/developer/example/Example_CountingNumber_0 b/developer/example/Example_CountingNumber_0
deleted file mode 100755 (executable)
index 03434e8..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java Example_CountingNumber_0
diff --git a/developer/example/Example_IndexTree_Diagonal_SRM b/developer/example/Example_IndexTree_Diagonal_SRM
deleted file mode 100755 (executable)
index 5b45c16..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java Example_IndexTree_Diagonal_SRM
diff --git a/developer/example/Example_SRMI_Array b/developer/example/Example_SRMI_Array
deleted file mode 100755 (executable)
index 80c5dbd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java Example_SRMI_Array
diff --git a/developer/example/Example_SRM_List b/developer/example/Example_SRM_List
deleted file mode 100755 (executable)
index e0d48dd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java Example_SRM_List
diff --git a/developer/example/list b/developer/example/list
new file mode 100755 (executable)
index 0000000..826de9c
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/env bash
+
+for file in Example_*.class; do
+  echo "file: " $file
+  done 
index d4c620b..49e565b 100755 (executable)
@@ -1,15 +1,8 @@
 #!/bin/env bash
 script_afp=$(realpath "${BASH_SOURCE[0]}")
 
-# input guards
-
-  env_must_be="developer/toolđź–‰/env"
-  if [ "$ENV" != "$env_must_be" ]; then
-    echo "$(script_fp):: error: must be run in the $env_must_be environment"
-    exit 1
-  fi
-
-  cd "$REPO_HOME"/developer
+cd "$REPO_HOME"/developer || exit 1
+source toolđź–‰/env_script
 
 # list of classes that have main calls and get bash wrappers
 echo Build
index 6e55aec..687883e 100755 (executable)
@@ -6,29 +6,30 @@ script_afp=$(realpath "${BASH_SOURCE[0]}")
 # directory if you have authored scripts for release, add a `bashđź–‰`
 # directory instead of putting them in `bash`.
 
-# input guards
-  env_must_be="developer/toolđź–‰/env"
-  if [ "$ENV" != "$env_must_be" ]; then
-    echo "$(script_fp):: error: must be run in the $env_must_be environment"
-    exit 1
-  fi
+cd "$REPO_HOME"/developer || exit 1
+source toolđź–‰/env_script
 
 set -x
 
 # remove main build files
 
-  cd "$REPO_HOME"/developer
-
   # rm_na currently does not handle links correctly 
   rm -r scratchpad/*
-
   rm_na jvm/*
   rm_na bash/*
 
 
 # remove example class files
 
-  rm_na example/*.class
+  cd example || exit 1
+
+  for file in Example_*.class; do
+    echo "file: " $file
+    rm_na "$file"
+    wrapper_name=$(basename "$file" .class)
+    rm_na "$wrapper_name"
+  done
+
 
 set +x
 
diff --git a/developer/toolđź–‰/env_script b/developer/toolđź–‰/env_script
new file mode 100644 (file)
index 0000000..3a1dc02
--- /dev/null
@@ -0,0 +1,14 @@
+# correct shell environment test
+#
+  env_must_be="developer/toolđź–‰/env"
+  if [ "$ENV" != "$env_must_be" ]; then
+    echo "$(script_fp):: error: must be run in the $env_must_be environment"
+    exit 1
+  fi
+
+# turn off literal shell globs 
+# bash options do not become part of the environment
+# Without this bash takes unmatching globs literally
+#
+  shopt -s nullglob
+
index c0a9874..b88b672 100755 (executable)
@@ -5,14 +5,8 @@ script_afp=$(realpath "${BASH_SOURCE[0]}")
 # the package name in scratch_pad.  If the `-nolink` option is specified,
 # it makes a copy instead of a link.
 
-# Input guards
-env_must_be="developer/toolđź–‰/env"
-if [ "$ENV" != "$env_must_be" ]; then
-  echo "$script_afp:: error: must be run in the $env_must_be environment"
-  exit 1
-fi
-
 cd "$REPO_HOME"/developer || exit 1
+source toolđź–‰/env_script
 
 # Parse options
 nolink=false
index 5941b9a..18a4fbc 100755 (executable)
@@ -1,21 +1,14 @@
 #!/bin/env bash
 script_afp=$(realpath "${BASH_SOURCE[0]}")
 
+cd "$REPO_HOME"/developer || exit 1
+source toolđź–‰/env_script
+
 # Ariadne does not currently package any third party tools with the .jar
 # release, so this script does nothing.
 
 # This script expands Mosaic third party projects onto the scratchpad. This is done before releasing or running local ad hoc tests, so that the third party tools will be present. I.e. this is for creating a 'fat' jar.
 
-# Input guards
-
-  env_must_be="developer/toolđź–‰/env"
-  if [ "$ENV" != "$env_must_be" ]; then
-    echo "$(script_fp):: error: must be run in the $env_must_be environment"
-    exit 1
-  fi
-
-  cd "$REPO_HOME"/developer
-
 # Expand the third party tools into the package tree
 
   # echo "Expanding .jar files to be included with Mosaic into scratchpad."
index 64602b6..fcd38a7 100755 (executable)
@@ -1,15 +1,8 @@
 #!/bin/env bash
 script_afp=$(realpath "${BASH_SOURCE[0]}")
 
-# input guards
-
-  env_must_be="developer/toolđź–‰/env"
-  if [ "$ENV" != "$env_must_be" ]; then
-    echo "$(script_fp):: error: must be run in the $env_must_be environment"
-    exit 1
-  fi
-
-  cd "$REPO_HOME"/developer
+cd "$REPO_HOME"/developer || exit 1
+source toolđź–‰/env_script
 
 echo "Compiling files..."
   set -x
@@ -35,9 +28,8 @@ echo "Creating JAR file..."
 
 echo "Creating bash wrappers..."
   mkdir -p bash
-  # wrapper is a space separated list
   wrapper=$(bash_wrapper_list)
-  for file in $wrapper;do
+  for file in "${wrapper[@]}"; do
     cat > bash/$file << EOL
 #!/bin/bash
 java com.ReasoningTechnology."$PROJECT".$file
index 3cd18be..738770e 100755 (executable)
@@ -1,15 +1,11 @@
 #!/bin/env bash
 script_afp=$(realpath "${BASH_SOURCE[0]}")
 
-# input guards
+cd "$REPO_HOME"/developer || exit 1
+source toolđź–‰/env_script
 
-  env_must_be="developer/toolđź–‰/env"
-  if [ "$ENV" != "$env_must_be" ]; then
-    echo "$(script_fp):: error: must be run in the $env_must_be environment"
-    exit 1
-  fi
 
-  cd "$REPO_HOME"/developer/example
+cd example || exit 1
 
 echo "Compiling example .java files..."
 
@@ -26,9 +22,8 @@ echo "Creating bash wrappers..."
 
 set -x
 
-wrapper=(Example_*.class)
-
-for file in "${wrapper[@]}"; do
+for file in Example_*.class; do
+  echo "file: " $file
   wrapper_name=$(basename "$file" .class)
   cat > "$wrapper_name" << EOL
 #!/bin/bash
@@ -37,7 +32,7 @@ EOL
 
   # Make the wrapper executable
   chmod +x "$wrapper_name"
-done
+  done
 
 set +x
 
index c8c32fe..688ff8c 100755 (executable)
@@ -3,20 +3,14 @@ script_afp=$(realpath "${BASH_SOURCE[0]}")
 
 # before running this script, gather everything needed for the release on the scratchpad
 
-# input guards
+cd "$REPO_HOME"/developer || exit 1
+source toolđź–‰/env_script
 
-  if [ -z "$REPO_HOME" ]; then
-    echo "$(script_fp):: REPO_HOME is not set."
-    exit 1
-  fi
+# Inform the user
 
-  env_must_be="developer/toolđź–‰/env"
-  if [ "$ENV" != "$env_must_be" ]; then
-    echo "$(script_fp):: must be run in the $env_must_be environment"
-    exit 1
-  fi
+  echo "The pwd for this script is `pwd`."
 
-  cd "$REPO_HOME"/developer
+# we build into the scratchpad
 
   if [ ! -d scratchpad ]; then
     echo "$(script_fp):: no scratchpad directory"
@@ -24,10 +18,6 @@ script_afp=$(realpath "${BASH_SOURCE[0]}")
   fi
 
 
-# Inform the user
-
-  echo "The pwd for this script is `pwd`."
-
 # Function to copy and set permissions
 
   install_file() {
index b077223..fda7fab 100644 (file)
Binary files a/release/Ariadne.jar and b/release/Ariadne.jar differ
index 18d2060..01f47a3 100644 (file)
@@ -5,6 +5,9 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
   exit 1
 fi
 
+# without this bash takes non-matching globs literally
+shopt -s nullglob
+
 # --------------------------------------------------------------------------------
 # project definition