Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a7fd971
Added helper script to detect duplicate bash aliases
aveeyan Jul 8, 2025
902c771
Fixed the old logic that showed duplicates vs. stdin; Requires mezcla…
aveeyan Jul 9, 2025
f378261
(NEW/WIP) Added a utility to test the working of alias
Jul 24, 2025
b61f3b0
Moved alias_tester.py to experimental
aveeyan Jul 29, 2025
6eaa98b
Added experimental script run_diagnostics.py for automation of batspp…
aveeyan Jul 31, 2025
d5e3e40
Fixed python-lint issues for scripts under tests/experimentals (TODO:…
aveeyan Aug 2, 2025
ffb600b
(EXPERIMENTAL) Added failure analyzer to extract a table of failed co…
aveeyan Aug 4, 2025
c3f225f
(EXPERIMENTAL) Fixed the script to support Cygwin environment; Mezcla…
aveeyan Aug 10, 2025
0fa8397
Added heuristic option for failure_analyzer.py; Replaced standard I/O…
aveeyan Aug 17, 2025
b7f5c66
Modified ipynb for testing by adding source on setup cell
aveeyan Aug 21, 2025
8ec5958
Modified ipynb for testing by adding source on setup cell v2
aveeyan Aug 21, 2025
4002b2b
Modified ipynb for testing by adding source on setup cell v2.1
aveeyan Aug 21, 2025
d7fb47b
Added setup for configuring environment
aveeyan Aug 21, 2025
ca8b5b8
Added tabulate to requirements
aveeyan Aug 21, 2025
47e2740
Added Global Setup for source for all the aliases
aveeyan Aug 21, 2025
e3f2347
(WIP) Rework on failure_analyzer.py and its test to use helper functions
aveeyan Aug 25, 2025
f3c2e1c
Ranking done by hit counts compared to percentage failure; Code simpl…
aveeyan Aug 27, 2025
54aead3
Rework on failure_analyzer to create HelperClass to faciliate API-lik…
aveeyan Sep 7, 2025
cf1d544
Added helper function to write JSON reports; Added orchestration func…
aveeyan Sep 10, 2025
4201ca3
Split the test into API test and CLI tests; Added additional test cas…
aveeyan Sep 10, 2025
8ab23d9
Refactored the entire script to improve maintainability and reduced r…
aveeyan Sep 14, 2025
33267e3
fix(heuristic): Restore interactive shell to load user functions for …
aveeyan Sep 14, 2025
701daed
Merge branch 'tomasohara:aviyan-windows-testing' into aviyan-windows-…
aveeyan Sep 19, 2025
7df5176
Added source to tomohara-proper-aliases.bash to increase the test score
aveeyan Oct 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions install_tomohara_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash

# =====================================================================
# Script: install-tomohara-env.sh
# Purpose: Appends the Tomohara dynamic environment setup to ~/.bashrc.
# This script is idempotent. It will not add the configuration
# block if it already exists, preventing configuration duplication.
# =====================================================================

# Define the target file and a unique identifier for our configuration block.
BASHRC_FILE="$HOME/.bashrc"
BLOCK_IDENTIFIER="TOMOHARA DYNAMIC PROJECT ENVIRONMENT SETUP"

# --- Verification Step ---
# Check if the configuration block has already been installed.
# This is the correct way to prevent duplicate entries.
if grep -q "$BLOCK_IDENTIFIER" "$BASHRC_FILE"; then
echo "[INFO] Tomohara environment block already detected in $BASHRC_FILE."
echo "[INFO] No changes are necessary. Exiting."
exit 0
fi

# --- Installation Step ---
# The configuration block does not exist. We will now append it.
# A 'here document' with a quoted delimiter ('EOF') is used to ensure
# that variables like $HOME are written literally to the file, not
# expanded by the shell running this script.

echo "[ACTION] Appending Tomohara v2 environment to $BASHRC_FILE..."

# Add a newline for clean separation before our block.
echo "" >> "$BASHRC_FILE"

cat << 'EOF' >> "$BASHRC_FILE"
# =====================================================================
# === TOMOHARA DYNAMIC PROJECT ENVIRONMENT SETUP (v2) ===
# =====================================================================
# This block dynamically locates the project directory to support forks
# and ensures all paths are portable.

# --- Part 1: Auto-detect the Project Directory ---
# It will prefer your fork ('shell-scripts-aveey') if it exists.
if [ -d "$HOME/shell-scripts-aveey" ]; then
export TOMOHARA_PROJECT_DIR="$HOME/shell-scripts-aveey"
elif [ -d "$HOME/shell-scripts" ]; then
export TOMOHARA_PROJECT_DIR="$HOME/shell-scripts"
else
# If neither is found, set the variable to empty.
export TOMOHARA_PROJECT_DIR=""
fi

# --- Part 2: Configure Environment if Project was Found ---
if [ -n "$TOMOHARA_PROJECT_DIR" ]; then
# Set batspp temporary data paths
export BATSPP_BASE="/tmp/batspp"
mkdir -p "$BATSPP_BASE/out" "$BATSPP_BASE/tmp"
export SINGLE_STORE=1
export BATSPP_OUTPUT="$BATSPP_BASE/out"
export BATSPP_TEMP="$BATSPP_BASE/tmp"

# Add the project directory to PATH (for scripts like perlgrep.perl)
export PATH="$TOMOHARA_PROJECT_DIR:$PATH"

# Add the project directory to PYTHONPATH (for python modules)
# NOTE: We use $TOMOHARA_PROJECT_DIR, NOT a hardcoded path.
export PYTHONPATH="$TOMOHARA_PROJECT_DIR:$PYTHONPATH"

# Source the tomohara-aliases if the file exists
if [ -f "$TOMOHARA_PROJECT_DIR/tomohara-aliases.bash" ]; then
source "$TOMOHARA_PROJECT_DIR/tomohara-aliases.bash"
fi

# Print confirmation with the detected path
echo "[tomohara-env] Initialized using project dir: $TOMOHARA_PROJECT_DIR"
else
echo "[tomohara-env] WARNING: No project directory found (shell-scripts or shell-scripts-aveey)."
fi

# --- Part 3: Standard User Bin Directory ---
# This is kept separate as it's a general user setting, not project-specific.
export PATH="$HOME/bin:$PATH"

# === END TOMOHARA DYNAMIC PROJECT ENVIRONMENT SETUP ===
EOF

# --- Finalization ---
echo "[SUCCESS] The Tomohara environment block has been installed."
echo "To activate the new environment, you must reload your shell configuration."
echo "Run the following command:"
echo " source ~/.bashrc"

exit 0
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pylint
pytest
pyyaml
six
tabulate
#
#...............................................................................
# Optional packages
Expand Down
31 changes: 23 additions & 8 deletions tests/NOBATSPPsudo_test_simplebatspp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "fb2eb784",
"metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [],
"source": [
"# Global Setup\n",
"source ~/shell-scripts/tomohara-aliases.bash"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6e7a3f53",
"metadata": {},
"outputs": [],
Expand All @@ -13,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "561923b4",
"metadata": {},
"outputs": [
Expand All @@ -31,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "04d68d13",
"metadata": {},
"outputs": [
Expand All @@ -49,7 +64,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "231c0073",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -79,7 +94,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "db123939",
"metadata": {},
"outputs": [
Expand All @@ -105,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "8b4b06f1",
"metadata": {},
"outputs": [],
Expand All @@ -115,7 +130,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "4d23f871",
"metadata": {},
"outputs": [
Expand All @@ -133,7 +148,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "ff4914d4",
"metadata": {},
"outputs": [],
Expand Down
21 changes: 11 additions & 10 deletions tests/README.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "47e5bb3c-914c-458d-8401-9172c79b8d2f",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -120,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "1d30de52-801f-48fd-8145-e60af7a8da18",
"metadata": {},
"outputs": [],
Expand All @@ -132,7 +132,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "3564e6de-0a29-488a-9821-be2f201dd258",
"metadata": {},
"outputs": [],
Expand All @@ -146,7 +146,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "13ae4c10-0262-4d53-b781-5ccbe17bc11a",
"metadata": {},
"outputs": [],
Expand All @@ -171,12 +171,13 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "c3c687e3-e2a3-4168-b0dd-70727832ab71",
"metadata": {},
"outputs": [],
"source": [
"# Global setup\n",
"# Global Setup\n",
"source ~/shell-scripts/tomohara-aliases.bash\n",
"#\n",
"# NOTE: For reproducibility, the directory name needs to be fixed\n",
"# In place of $$, use a pseudo-random number (e,g., 1210)\n",
Expand All @@ -193,7 +194,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "713811b0",
"metadata": {},
"outputs": [
Expand All @@ -218,7 +219,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "102d3e2f-04f8-4300-9b90-8104f5eb9d1c",
"metadata": {},
"outputs": [],
Expand All @@ -231,7 +232,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "6edd07c8-b27b-4096-bbdb-c7adc96b2aac",
"metadata": {},
"outputs": [
Expand All @@ -251,7 +252,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"id": "27990ce0-cf70-4218-8231-3b777078334d",
"metadata": {},
"outputs": [
Expand Down
Loading