Skip to content

Commit

Permalink
really got #2 fixed maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSPoon committed Feb 15, 2024
1 parent 4f2a967 commit 46ced2c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 54 deletions.
39 changes: 5 additions & 34 deletions .bash_history
Original file line number Diff line number Diff line change
@@ -1,37 +1,3 @@
cd /opt/logicmoo_workspace/packs_sys/logicmoo_opencog/MeTTa/vspace-metta/
./MeTTa --v_2a examples/interp_2a/
./MeTTa --v_3y examples/interp_3y/
./scripts/test_in_metta.sh -n --report=Y
git add reports/
cp pyswip/metta_reader.pl pyswip_3y/
cd ..
./scripts/test_in_metta.sh -n --report=Y
./MeTTa examples/interp_88
git add reports/
git status examples/
git add examples/
git status examples/
./scripts/test_in_metta.sh -n --report=Y
git status .
git add metta_vspace/pyswip_2a/
git add metta_vspace/pyswip_3y
git add metta_vspace/pyswip/
ls reports/cuRRent/interp_88/hyperon-pln_metta/entail/
./scripts/test_in_metta.sh -n --report=Y
ls reports/cuRRent/interp_88/hyperon-pln_metta/entail/
git add reports/
git status .
git add etta_vspace/pyswip_1/
git add metta_vspace/pyswip_1/
git add metta_vspace/pyswip_1
git add -U metta_vspace/pyswip_1
git add -u metta_vspace/pyswip_1
git add -u metta_vspace/pyswip_1/
git status .
git add reports/
./scripts/test_in_metta.sh -n --report=Y
./MeTTa examples/interp_88 --clean
git add reports/
git add git status .
git status .
git commit -am reports/cuRRent
Expand Down Expand Up @@ -2027,3 +1993,8 @@ git checkout 586ef99b9703c3910df3c5f2bb9478a50ef442c3 Dockerfile
git diff 586ef99b9703c3910df3c5f2bb9478a50ef442c3 Dockerfile
git checkout 586ef99b9703c3910df3c5f2bb9478a50ef442c3 Dockerfile
git commit -am ENV PATH="${PATH}:${MATTALOG_DIR}"
git commit -am 'ENV PATH="${PATH}:${MATTALOG_DIR}"'
git push
docker build . -t mettalog
docker build . -t mettalog
docker build . -t mettalog
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ WORKDIR ${HOME}

# Install MeTTaLog

ENV MATTALOG_DIR="${HOME}/vspace-metta"
ENV METTALOG_DIR="${HOME}/vspace-metta"
ENV PATH="${PATH}:${METTALOG_DIR}"

WORKDIR ${HOME}
RUN git clone https://github.com/logicmoo/vspace-metta.git
WORKDIR ${MATTALOG_DIR}
WORKDIR ${METTALOG_DIR}
# This COPY is in case we have made local changes
# so we dont have to commit to Github to test them out
COPY ./INSTALL.sh ./INSTALL.sh

ENV PATH="${PATH}:${MATTALOG_DIR}"

RUN ./INSTALL.sh --easy

# This COPY is in case we have made local changes
# so we dont have to commit to Github to test them out
#COPY ./ ${METTALOG_DIR}/
#COPY ./metta_vspace/pyswip ${METTALOG_DIR}/metta_vspace/pyswip
COPY ./ ./


Expand Down
1 change: 1 addition & 0 deletions INSTALL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ check_metalog_in_path() {
# Call the function to perform the check and update
check_metalog_in_path

which swipl

echo -e "${GREEN}Installation and setup complete!${NC}."

Expand Down
4 changes: 2 additions & 2 deletions metta_vspace/pyswip/metta_interp.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2313,7 +2313,7 @@
ggtrace0(G):- ggtrace,
leash(-all),
visible(-all),
% debug,
% debug,
%visible(+redo),
visible(+call),
visible(+exception),
Expand Down Expand Up @@ -2350,7 +2350,7 @@
nop(load_history),
set_prolog_flag(history, 3),
(set_output_stream),
update_changed_files,
if_t(is_compiled,update_changed_files),
run_cmd_args,
maybe_halt(7)]))),!.

Expand Down
46 changes: 33 additions & 13 deletions mettalog
Original file line number Diff line number Diff line change
Expand Up @@ -138,27 +138,46 @@ function resolve_upward {
done
}

# if not already in docker
# Check if the script is running inside a Docker container
if [ ! -f /.dockerenv ]; then
# The name of the Docker image you're looking to use
# Define the name of the Docker image
IMAGE_NAME="mettalog"

# Check if Docker is installed
if command -v docker &> /dev/null; then
# Check if the Docker image exists
if docker image inspect "$IMAGE_NAME" &> /dev/null ; then
DEBUG "Image $IMAGE_NAME is installed. Running command..."
# Run your command inside the Docker container
UPWARD=$(resolve_upward "$(pwd)")
# Run the Docker container with necessary volumes mounted
# Note: It's crucial to quote '$(pwd)' to handle spaces in the path
docker run --rm -it \
if docker image inspect "$IMAGE_NAME" &> /dev/null; then
echo "Updating the Docker image: $IMAGE_NAME"

# Create a temporary file to capture the build output
temp_file=$(mktemp)

# Build the Docker image and redirect stderr to the temporary file
if ! docker build . -t "$IMAGE_NAME" > "$temp_file" 2>&1; then
echo "Docker build failed. Output:"
# Tail the last 30 lines of the build output for debugging
tail -30 "$temp_file"
# Clean up the temporary file
rm "$temp_file"
exit 1
else
# If build succeeds, remove the temporary file
rm "$temp_file"
echo "Image $IMAGE_NAME successfully updated."
fi

# Setup additional environment variables or paths
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
# Example: UPWARD=$(resolve_upward "$(pwd)")

# Run the Docker container with the necessary volumes mounted
exec docker run -it \
-v "${SCRIPT_DIR}:/home/user/vspace-metta" \
-v "${UPWARD}:${UPWARD}" \
-v "$(pwd):/host/cwd" \
-v "$(pwd):$(pwd)" \
-w "$(pwd)" \
mettalog:latest \
/home/user/vspace-metta/mettalog ${@}
"$IMAGE_NAME" \
/home/user/vspace-metta/mettalog "$@"

else
echo "Image $IMAGE_NAME is not installed. Continuing with script..."
fi
Expand All @@ -168,6 +187,7 @@ if [ ! -f /.dockerenv ]; then
fi



quoted_args=() # Initialize an empty array to store the results
for arg in "$@"; do
# Check if the argument contains spaces, exclamation marks, backslashes, or quote characters
Expand Down

0 comments on commit 46ced2c

Please sign in to comment.