Skip to content

Commit

Permalink
modified develop_academy.sh to compile dev env once
Browse files Browse the repository at this point in the history
  • Loading branch information
vaishnavimulik25 committed Mar 29, 2024
1 parent 166a32f commit 77e4af0
Showing 1 changed file with 31 additions and 37 deletions.
68 changes: 31 additions & 37 deletions scripts/develop_academy.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/bin/sh

# ANSI color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'

# Initialize variables with default values
ram_version="https://github.com/JdeRobot/RoboticsApplicationManager.git"
branch=main
Expand Down Expand Up @@ -48,18 +42,39 @@ fi
# Prepare the frontend
nvm install 16
nvm use 16

# Checking if the frontend needs compilation
cd react_frontend/
if command -v npm &> /dev/null; then
npm install --force
npm run dev &
sleep 10
DIRECTORY_TO_MONITOR="."

checksum=$(find "$DIRECTORY_TO_MONITOR" \( -path "*/node_modules" -o \
-path "*/__pycache__" \) -prune \
-o -type f -exec md5sum {} + | \
sort | \
md5sum | \
awk '{print $1}')

existing_checksum_file="$DIRECTORY_TO_MONITOR/checksum.txt"

if [ -f "$existing_checksum_file" ]; then
existing_checksum=$(cat "$existing_checksum_file")
if [ "$existing_checksum" != "$new_checksum" ]; then
if command -v npm &> /dev/null; then
npm install --force
npm run dev &
sleep 10

else
yarn install
yarn dev run &
sleep 10
fi
fi
else
yarn install
yarn dev run &
sleep 10
echo "$new_checksum" > "$existing_checksum_file"
fi


cd ..

# Prepare the compose file
Expand All @@ -71,27 +86,6 @@ cp compose_cfg/$compose_file docker-compose.yaml


# Proceed with docker-compose commands
while true; do
echo -e "${GREEN}Enter your choice${NC}"
echo -e "${GREEN}1.For docker-compose up : up${NC}"
echo -e "${GREEN}2.For docker-compose down : down${NC}"
echo -e "${GREEN}3.For remove docker-compose.yaml : rm${NC}"

read choice

case $choice in
up)
docker-compose up &
;;
down)
docker-compose down &
;;
rm)
rm docker-compose.yaml &
echo -e "${YELLOW}Removing docker-compose.yaml and closing this
process${NC}"
exit 0
;;
esac
sleep 10
done
docker-compose up
docker-compose down
rm docker-compose.yaml

0 comments on commit 77e4af0

Please sign in to comment.