-
Notifications
You must be signed in to change notification settings - Fork 0
/
hot.sh
executable file
·30 lines (22 loc) · 1.16 KB
/
hot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
set -e
# script that automatically recompiles and restarts the app when any source file changes
# requires globally installed https://nodemon.io/
# ASCII color sequences
# credits: https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
# see also: https://unix.stackexchange.com/questions/269077/tput-setaf-color-table-how-to-determine-color-codes
# to get all 256 colors:
# for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; echo =$c; done
red=$(tput setaf 1)
green=$(tput setaf 2)
cyan=$(tput setaf 6)
gray=$(tput setaf 8)
bold=$(tput bold)
reset=$(tput sgr0)
# here you can rewrite JAVA_HOME and Maven will use it (in case you work with more java versions)
# export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home
echo "${gray}Running ${bold}${cyan}mvm clean${reset}${gray} ... ${reset}"
mvn clean
echo "${gray}Running ${bold}${cyan}nodemon --exec \"mvn compile && mvn javafx:run ${*}\" --watch 'src/**/*' --config nodemon.json${reset}${gray} ... ${reset}"
# see https://nodemon.io/
nodemon --exec "mvn compile && mvn javafx:run ${*}" --watch 'src/**/*' --config nodemon.json