1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-11 07:51:20 +00:00

Merge branch '372-update-start-stop_osx-sh-to-work-on-linux-and-rename-accordingly' into 'develop'

Resolve "Update start/stop_osx.sh to work on linux and rename accordingly"

Closes 

See merge request 
This commit is contained in:
Nigel Gott 2021-03-16 12:58:59 +00:00
commit b8043334af
3 changed files with 68 additions and 36 deletions

68
start_dev.sh Executable file
View file

@ -0,0 +1,68 @@
#!/bin/bash
tabname() {
printf "\e]1;$1\a"
}
print_manual_instructions(){
COMMAND=$1
CONTAINER_COMMAND=$2
echo -e "\nOpen a new tab/terminal and run:"
echo " $COMMAND"
echo "Then inside the container run:"
echo " $CONTAINER_COMMAND"
}
PRINT_WARNING=true
new_tab() {
TAB_NAME=$1
COMMAND=$2
CONTAINER_COMMAND=$3
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [ -x "$(command -v gnome-terminal)" ]; then
gnome-terminal \
--tab --title="$TAB_NAME" --working-directory=`pwd` -- $COMMAND -c \
"echo '$CONTAINER_COMMAND'; $CONTAINER_COMMAND; exec bash"
else
if $PRINT_WARNING; then
echo -e "\nWARNING: gnome-terminal is the only currently supported way of opening
multiple tabs/terminals for linux by this script, add support for your setup!"
PRINT_WARNING=false
fi
print_manual_instructions "$COMMAND" "$CONTAINER_COMMAND"
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
osascript \
-e "tell application \"Terminal\"" \
-e "tell application \"System Events\" to keystroke \"t\" using {command down}" \
-e "do script \"printf '\\\e]1;$TAB_NAME\\\a'; $COMMAND\" in front window" \
-e "do script \"$CONTAINER_COMMAND\" in front window" \
-e "end tell" > /dev/null
else
if $PRINT_WARNING; then
echo -e "\nWARNING: The OS '$OSTYPE' is not supported yet for creating tabs to setup
baserow's dev environemnt, please add support!"
PRINT_WARNING=false
fi
print_manual_instructions "$COMMAND" "$CONTAINER_COMMAND"
fi
}
docker-compose up -d
new_tab "Backend" \
"docker exec -it backend bash" \
"python src/baserow/manage.py runserver 0.0.0.0:8000"
new_tab "Backend celery" \
"docker exec -it backend bash" \
"watchmedo auto-restart --directory=./ --pattern=*.py --recursive -- celery -A baserow worker -l INFO"
new_tab "Web frontend" \
"docker exec -it web-frontend bash" \
"yarn run dev"
new_tab "Web frontend eslint" \
"docker exec -it web-frontend bash" \
"yarn run eslint --fix"

View file

@ -1,36 +0,0 @@
#!/bin/bash
tabname() {
printf "\e]1;$1\a"
}
new_tab() {
TAB_NAME=$1
COMMAND=$2
CONTAINER_COMMAND=$3
osascript \
-e "tell application \"Terminal\"" \
-e "tell application \"System Events\" to keystroke \"t\" using {command down}" \
-e "do script \"printf '\\\e]1;$TAB_NAME\\\a'; $COMMAND\" in front window" \
-e "do script \"$CONTAINER_COMMAND\" in front window" \
-e "end tell" > /dev/null
}
docker-compose up -d
new_tab "Backend" \
"docker exec -it backend bash" \
"python src/baserow/manage.py runserver 0.0.0.0:8000"
new_tab "Backend" \
"docker exec -it backend bash" \
"watchmedo auto-restart --directory=./ --pattern=*.py --recursive -- celery -A baserow worker -l INFO"
new_tab "Web frontend" \
"docker exec -it web-frontend bash" \
"yarn run dev"
new_tab "Web frontend eslint" \
"docker exec -it web-frontend bash" \
"yarn run eslint --fix"