Mercurial > hg > thermostat-ng
changeset 13:255adf10b4fd
Copy web-client to web-gateway when web-gateway build is specified
Reviewed-by: jerboaa
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-August/024618.html
author | Miloslav Zezulka <mzezulka@redhat.com> |
---|---|
date | Tue, 22 Aug 2017 14:04:45 +0200 |
parents | 2f04aa98a8a9 |
children | 3d69f746e18f |
files | thermostat-ng.sh |
diffstat | 1 files changed, 31 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/thermostat-ng.sh Wed Aug 23 13:56:55 2017 +0200 +++ b/thermostat-ng.sh Tue Aug 22 14:04:45 2017 +0200 @@ -232,16 +232,6 @@ build "$WEB_CLIENT_ROOT" npm_build } -# deploy web-client resources statically, more info at http://icedtea.classpath.org/pipermail/thermostat/2017-May/023164.html -copy_web_client_to_web_gateway() { - local dist_dir="${WEB_CLIENT_ROOT}/dist"; - if [ -d "$dist_dir" ]; then - cp -r $dist_dir $WEB_GATEWAY_ROOT/distribution/target/image/web-client; - echo "Web client copied to web-gateway." - else - fail "Web client could not be copied to web-gateway because the directory web-client/dist/ does not exist. Make sure the web-client has been built correctly." - fi -} # Shuts down everything in reverse order. # Called via trap @@ -355,12 +345,41 @@ esac } +# deploy web-client resources statically, more info at http://icedtea.classpath.org/pipermail/thermostat/2017-May/023164.html +copy_web_client_to_web_gateway() { + local dist_dir="${WEB_CLIENT_ROOT}/dist"; + if [ -d "$dist_dir" ]; then + cp -r $dist_dir $WEB_GATEWAY_ROOT/distribution/target/image/web-client; + echo "Web client copied to web-gateway." + else + fail "Web client could not be copied to web-gateway because the directory web-client/dist/ does not exist. Make sure the web-client has been built correctly." + fi +} + +build_and_copy_web_client() { + build_web_client; copy_web_client_to_web_gateway +} + +ensure_web_client_present_in_gateway() { + local dist_dir="${WEB_CLIENT_ROOT}/dist"; + if [ -d "$dist_dir" ]; then + cp -r $dist_dir $WEB_GATEWAY_ROOT/distribution/target/image/web-client; + echo "Web client copied to web-gateway." + else + # This is in case both web-client and web-gateway are selected for build; + # we do not want to build web-client twice. + WEB_CLIENT=false; + + build_and_copy_web_client; + fi +} + build_all_requested_components() { if [ "$WEB_GATEWAY" = "true" ]; then - build_web_gateway + build_web_gateway; ensure_web_client_present_in_gateway fi if [ "$WEB_CLIENT" = "true" ]; then - build_web_client; copy_web_client_to_web_gateway + build_and_copy_web_client fi if [ "$AGENT" = "true" ]; then build_agent