forked from procrastinate-org/procrastinate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev-env
executable file
·66 lines (55 loc) · 2.18 KB
/
dev-env
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# This file is meant to be sourced, not executed:
# source ./dev-env
# We're doing our best to keep it compatible with bash and zsh.
scripts/bootstrap
if ! which pg_isready; then
# When installing libpq from Homebrew, it's not added to the path automatically.
if [ -e /usr/local/opt/libpq/bin/psql ]; then
export PATH="$PATH:usr/local/opt/libpq/bin:"
else
# It's not a good idea not to install system-wide stuff without asking.
echo "Please install psql and libpq utils on your machine:"
echo "Ubuntu:"
echo " sudo apt install postgresql-client"
echo "MacOS (using Homebrew):"
echo " brew install libpq"
return
fi
fi
export UID=$(id -u)
export GID=$(id -g)
if ! pg_isready ; then
echo "Starting database"
export PGDATABASE=procrastinate PGHOST=127.0.0.1 PGUSER=postgres PGPASSWORD=password
docker-compose up -d postgres || return
sleep 3
fi
echo ""
echo "Database is ready!"
echo ""
export PROCRASTINATE_APP=procrastinate_demos.demo_async.app.app
export PATH="$(pwd)/scripts/:$PATH"
source $(poetry env info -p)/bin/activate
if ! pg_dump --schema-only --table=procrastinate_jobs 1>/dev/null 2>&1; then
echo "Applying migrations"
procrastinate schema --apply || return
fi
echo "Migrations applied!"
echo ""
echo "Welcome to the Procrastinate development environment interactive shell!"
echo ""
echo "You'll find the detailed instructions in the contributing documentation:"
echo " https://procrastinate.readthedocs.io/en/latest/contributing.html"
echo ""
echo "TL;DR: important commands:"
echo "- pytest: Launch the tests"
echo "- tox: Entrypoint for testing multiple python versions as well as docs, linters & formatters"
echo "- procrastinate: Test procrastinate locally."
echo ""
echo "We've gone ahead and set up a few additional commands for you:"
echo "- htmlcov: Opens the test coverage results in your browser"
echo "- htmldoc: Opens the locally built sphinx documentation in your browser"
echo "- lint: Run code formatters & linters"
echo "- docs: Build doc (note: needs 'poetry install --with docs' which needs a recent Python)"
echo ""
echo 'Quit the poetry shell with the command `deactivate`'