diff --git a/README.md b/README.md index 8f8e2b53..1a50ce22 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,7 @@ ## Installation - brew install python3 - python3 -m venv .venv - . .venv/bin/activate - pip install --upgrade pip - pip install -r requirements.txt - npm install - gem install sass + ./script/setup ## Running (development) @@ -23,6 +17,10 @@ To start the app and watch for changes: To run unit tests: + ./script/test + +or + python -m pytest or diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 00000000..b845e1ea --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,13 @@ +#!/bin/bash + +# If a command fails, exit the script +set -e + +# Ensure we are in the app root directory (not the /script directory) +cd "$(dirname "$0")/.." + +# Install Python dependencies +pip install -r requirements.txt + +# Install uswds node module and dependencies +npm install diff --git a/script/server b/script/server new file mode 100755 index 00000000..a7006aa9 --- /dev/null +++ b/script/server @@ -0,0 +1,10 @@ +#!/bin/bash + +# If a command fails, exit the script +set -e + +# Ensure we are in the app root directory (not the /script directory) +cd "$(dirname "$0")/.." + +# Launch the app +python3 app.py diff --git a/script/setup b/script/setup new file mode 100755 index 00000000..19a8e225 --- /dev/null +++ b/script/setup @@ -0,0 +1,26 @@ +#!/bin/bash + +# If a command fails, exit the script +set -e + +# Ensure we are in the app root directory (not the /script directory) +cd "$(dirname "$0")/.." + +# Install virtualenv +pip install virtualenv + +# Create and activate virtual environment +python3 -m venv .venv +source .venv/bin/activate + +# Install/update pip +pip install --upgrade pip + +# Update npm +npm install -g npm + +# Install application dependencies +script/bootstrap + +# Symlink uswds fonts into the /static directory +ln -s ../node_modules/uswds/src/fonts ./static/fonts diff --git a/script/test b/script/test new file mode 100755 index 00000000..29918052 --- /dev/null +++ b/script/test @@ -0,0 +1,10 @@ +#!/bin/bash + +# If a command fails, exit the script +set -e + +# Ensure we are in the app root directory (not the /script directory) +cd "$(dirname "$0")/.." + +# Run unit tests +python3 -m pytest diff --git a/script/update b/script/update new file mode 100755 index 00000000..d8d785f1 --- /dev/null +++ b/script/update @@ -0,0 +1,10 @@ +#!/bin/bash + +# If a command fails, exit the script +set -e + +# Ensure we are in the app root directory (not the /script directory) +cd "$(dirname "$0")/.." + +# Update dependencies +script/bootstrap