From 4ca772eea336adf8017531bc3a357b762b40b1cb Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Tue, 7 Mar 2017 11:36:41 +0200 Subject: [PATCH] refactor(aio): move scripts into `scripts/` directory --- aio/aio-builds-setup/build.sh | 18 ------------------ aio/aio-builds-setup/scripts/build.sh | 16 ++++++++++++++++ aio/aio-builds-setup/scripts/env.sh | 5 +++++ aio/aio-builds-setup/{ => scripts}/test.sh | 5 ++--- scripts/ci/test-aio.sh | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) delete mode 100755 aio/aio-builds-setup/build.sh create mode 100755 aio/aio-builds-setup/scripts/build.sh create mode 100755 aio/aio-builds-setup/scripts/env.sh rename aio/aio-builds-setup/{ => scripts}/test.sh (61%) diff --git a/aio/aio-builds-setup/build.sh b/aio/aio-builds-setup/build.sh deleted file mode 100755 index 8a21874c96..0000000000 --- a/aio/aio-builds-setup/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -eux -o pipefail - -# Constants -DOCKERBUILD_DIR="`dirname $0`/dockerbuild" -SCRIPTS_JS_DIR="$DOCKERBUILD_DIR/scripts-js" -DEFAULT_IMAGE_NAME_AND_TAG="aio-builds:latest" - -# Build `scripts-js/` -cd "$SCRIPTS_JS_DIR" -yarn install -yarn run build -cd - - -# Create docker image -nameAndOptionalTag=$([ $# -eq 0 ] && echo $DEFAULT_IMAGE_NAME_AND_TAG || echo $1) -sudo docker build --tag $nameAndOptionalTag ${@:2} $DOCKERBUILD_DIR diff --git a/aio/aio-builds-setup/scripts/build.sh b/aio/aio-builds-setup/scripts/build.sh new file mode 100755 index 0000000000..3d1fce9695 --- /dev/null +++ b/aio/aio-builds-setup/scripts/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -eux -o pipefail + +# Set up env +source "`dirname $0`/env.sh" +readonly defaultImageNameAndTag="aio-builds:latest" + +# Build `scripts-js/` +cd "$SCRIPTS_JS_DIR" +yarn install +yarn run build +cd - + +# Create docker image +readonly nameAndOptionalTag=${1:-$defaultImageNameAndTag} +sudo docker build --tag $nameAndOptionalTag ${@:2} $DOCKERBUILD_DIR diff --git a/aio/aio-builds-setup/scripts/env.sh b/aio/aio-builds-setup/scripts/env.sh new file mode 100755 index 0000000000..e0d5ef4c37 --- /dev/null +++ b/aio/aio-builds-setup/scripts/env.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +readonly THIS_DIR=$(cd $(dirname $0); pwd) +readonly DOCKERBUILD_DIR="$THIS_DIR/../dockerbuild" +readonly SCRIPTS_JS_DIR="$DOCKERBUILD_DIR/scripts-js" diff --git a/aio/aio-builds-setup/test.sh b/aio/aio-builds-setup/scripts/test.sh similarity index 61% rename from aio/aio-builds-setup/test.sh rename to aio/aio-builds-setup/scripts/test.sh index ff0913d075..1fbe75298f 100755 --- a/aio/aio-builds-setup/test.sh +++ b/aio/aio-builds-setup/scripts/test.sh @@ -1,9 +1,8 @@ #!/bin/bash - set -eux -o pipefail -# Constants -SCRIPTS_JS_DIR="`dirname $0`/dockerbuild/scripts-js" +# Set up env +source "`dirname $0`/env.sh" # Test `scripts-js/` cd "$SCRIPTS_JS_DIR" diff --git a/scripts/ci/test-aio.sh b/scripts/ci/test-aio.sh index 9ab6d3ceee..febeefb1e3 100755 --- a/scripts/ci/test-aio.sh +++ b/scripts/ci/test-aio.sh @@ -40,6 +40,6 @@ source ${thisDir}/_travis-fold.sh # Run unit tests for aio/aio-builds-setup travisFoldStart "test.aio.aio-builds-setup" - ./aio-builds-setup/test.sh + ./aio-builds-setup/scripts/test.sh travisFoldEnd "test.aio.aio-builds-setup" )