mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-03 15:58:50 +01:00
Add Docker documentation to the installation docs; update and create the ”Scripts To Rule Them All” scripts for easy use of the Docker Composer environment.
Fixes #2425.
This commit is contained in:
parent
b57a62b72d
commit
d145640ead
8 changed files with 172 additions and 16 deletions
47
script/test
Executable file
47
script/test
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
# script/test: Run test suite for application. Optionally pass in a path to an
|
||||
# individual test file to run a single test.
|
||||
|
||||
set -e
|
||||
|
||||
docker_compose="docker-compose --file docker-compose.yml"
|
||||
|
||||
function cleanup() {
|
||||
$docker_compose down
|
||||
}
|
||||
|
||||
function die() {
|
||||
echo $@
|
||||
exit 1
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
script/poll-for-db
|
||||
|
||||
if [ "$RAILS_ENV" = "test" ] || [ "$RACK_ENV" = "test" ]; then
|
||||
# if executed and the environment is already set to `test`, then we want a
|
||||
# clean from scratch application. This almost always means a ci environment,
|
||||
# since we set the environment to `test` directly in `script/cibuild`.
|
||||
script/setup
|
||||
else
|
||||
# if the environment isn't set to `test`, set it to `test` and update the
|
||||
# application to ensure all dependencies are met as well as any other things
|
||||
# that need to be up to date, like db migrations. The environment not having
|
||||
# already been set to `test` almost always means this is being called on its
|
||||
# own from a `development` environment.
|
||||
export RAILS_ENV="test" RACK_ENV="test"
|
||||
|
||||
script/update
|
||||
fi
|
||||
|
||||
echo "==> Running tests…"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
# pass arguments to test call. This is useful for calling a single test.
|
||||
$docker_compose run web bin/rake test "$1"
|
||||
else
|
||||
$docker_compose run web bin/rake test
|
||||
fi
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue