summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorLindolfo 'Lorn' Rodrigues <lorn@lornlab.org>2019-02-13 16:40:19 -0200
committerLindolfo 'Lorn' Rodrigues <lorn@lornlab.org>2019-02-13 16:59:20 -0200
commitab206a90b61f7b411dae49e0676cd64165ee10f2 (patch)
tree467b6b9d2624bf1acd3ed9a9215baf295088df9a /script
parentbump version (diff)
Support Elixir-1.8
Also dropped support for elixir < 1.6
Diffstat (limited to 'script')
-rwxr-xr-xscript/clean3
-rw-r--r--script/common.sh8
-rwxr-xr-xscript/coverage5
-rwxr-xr-xscript/credo7
-rwxr-xr-xscript/docs5
-rwxr-xr-xscript/reset3
-rwxr-xr-xscript/run9
-rwxr-xr-xscript/setup6
-rwxr-xr-xscript/test7
9 files changed, 53 insertions, 0 deletions
diff --git a/script/clean b/script/clean
new file mode 100755
index 0000000..a0ac4b3
--- /dev/null
+++ b/script/clean
@@ -0,0 +1,3 @@
+#!/bin/bash
+docker-compose run --rm web rm -fr _build deps
+docker-compose down
diff --git a/script/common.sh b/script/common.sh
new file mode 100644
index 0000000..dffe136
--- /dev/null
+++ b/script/common.sh
@@ -0,0 +1,8 @@
+function power_dnsex_env {
+ local envs=$(env | egrep '^POWER_DNSEX_' | sed 's/^/ -e /')
+ local test_env=$( [[ -n "${BUILD_TAG}" ]] && printf " -e MIX_ENV=test" )
+ printf "%s " "$envs $test_env" | xargs printf " %s"
+}
+
+export WORKDIR="$(dirname "${BASH_SOURCE[0]}")/.."
+export DOCKER_COMPOSE="docker-compose -f $WORKDIR/docker-compose.yml"
diff --git a/script/coverage b/script/coverage
new file mode 100755
index 0000000..4c5cb0f
--- /dev/null
+++ b/script/coverage
@@ -0,0 +1,5 @@
+#!/bin/bash -xe
+
+source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
+
+$DOCKER_COMPOSE run -T -e MIX_ENV=test $(power_dnsex_env) --rm web bash -c "mix coveralls.html </dev/null"
diff --git a/script/credo b/script/credo
new file mode 100755
index 0000000..74aae83
--- /dev/null
+++ b/script/credo
@@ -0,0 +1,7 @@
+#!/bin/bash -xe
+
+source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
+
+CREDO_ARGS="$@"
+
+$DOCKER_COMPOSE run --rm -T $(power_dnsex_env) web mix credo $CREDO_ARGS
diff --git a/script/docs b/script/docs
new file mode 100755
index 0000000..1ad3f35
--- /dev/null
+++ b/script/docs
@@ -0,0 +1,5 @@
+#!/bin/bash -xe
+
+source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
+
+$DOCKER_COMPOSE run --rm -T $(power_dnsex_env) web bash -c "mix docs </dev/null"
diff --git a/script/reset b/script/reset
new file mode 100755
index 0000000..cc60c14
--- /dev/null
+++ b/script/reset
@@ -0,0 +1,3 @@
+#!/bin/bash
+script/clean
+script/setup
diff --git a/script/run b/script/run
new file mode 100755
index 0000000..f62cc36
--- /dev/null
+++ b/script/run
@@ -0,0 +1,9 @@
+#!/bin/bash -xe
+
+source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
+
+if [[ "$#" -gt 0 ]] ; then
+ $DOCKER_COMPOSE run --rm $(power_dnsex_env) web "$@"
+else
+ $DOCKER_COMPOSE run --service-ports --rm $(power_dnsex_env) web iex -S mix do hex.info
+fi
diff --git a/script/setup b/script/setup
new file mode 100755
index 0000000..1b1d49a
--- /dev/null
+++ b/script/setup
@@ -0,0 +1,6 @@
+#!/bin/bash -xe
+
+source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
+
+$DOCKER_COMPOSE build && \
+$DOCKER_COMPOSE run $(power_dnsex_env) --rm -T web bash -c "mix do deps.clean --unused --unlock, deps.get --all, deps.compile </dev/null"
diff --git a/script/test b/script/test
new file mode 100755
index 0000000..cce14e4
--- /dev/null
+++ b/script/test
@@ -0,0 +1,7 @@
+#!/bin/bash -xe
+
+source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
+
+TEST_ARGS="$@"
+
+$DOCKER_COMPOSE run -T -e MIX_ENV=test $(power_dnsex_env) --rm web bash -c "mix test $TEST_ARGS </dev/null"