From 62c36cd51650008c164bf7ff09227c1983e5477c Mon Sep 17 00:00:00 2001 From: Devon Mackay Date: Wed, 30 May 2018 15:10:31 -0400 Subject: [PATCH 1/6] Add virtual environment activation --- script/bootstrap | 3 +++ script/server | 3 +++ script/test | 3 +++ script/update | 3 +++ 4 files changed, 12 insertions(+) diff --git a/script/bootstrap b/script/bootstrap index b845e1ea..a8e9be6c 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -6,6 +6,9 @@ set -e # Ensure we are in the app root directory (not the /script directory) cd "$(dirname "$0")/.." +# Activate virtual environment +source .venv/bin/activate + # Install Python dependencies pip install -r requirements.txt diff --git a/script/server b/script/server index a7006aa9..bf55d6c4 100755 --- a/script/server +++ b/script/server @@ -6,5 +6,8 @@ set -e # Ensure we are in the app root directory (not the /script directory) cd "$(dirname "$0")/.." +# Activate virtual environment +source .venv/bin/activate + # Launch the app python3 app.py diff --git a/script/test b/script/test index 29918052..7c92f24e 100755 --- a/script/test +++ b/script/test @@ -6,5 +6,8 @@ set -e # Ensure we are in the app root directory (not the /script directory) cd "$(dirname "$0")/.." +# Activate virtual environment +source .venv/bin/activate + # Run unit tests python3 -m pytest diff --git a/script/update b/script/update index d8d785f1..d8f9af45 100755 --- a/script/update +++ b/script/update @@ -6,5 +6,8 @@ set -e # Ensure we are in the app root directory (not the /script directory) cd "$(dirname "$0")/.." +# Activate virtual environment +source .venv/bin/activate + # Update dependencies script/bootstrap From 2c2ffea1a2c15a6dcdd7caf85a0d04abbc3aa5ef Mon Sep 17 00:00:00 2001 From: Devon Mackay Date: Wed, 30 May 2018 15:15:08 -0400 Subject: [PATCH 2/6] Ensure any command line parameters are passed on to the app --- script/server | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/server b/script/server index bf55d6c4..0bd415e0 100755 --- a/script/server +++ b/script/server @@ -10,4 +10,4 @@ cd "$(dirname "$0")/.." source .venv/bin/activate # Launch the app -python3 app.py +python3 app.py $@ From a2f69005ed983838b600ac7be52dea0736949677 Mon Sep 17 00:00:00 2001 From: Devon Mackay Date: Wed, 30 May 2018 15:18:02 -0400 Subject: [PATCH 3/6] Just being picky; I like to consisently use braces for bash vars --- script/bootstrap | 2 +- script/server | 4 ++-- script/setup | 2 +- script/test | 2 +- script/update | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index a8e9be6c..aee63a27 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -4,7 +4,7 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." # Activate virtual environment source .venv/bin/activate diff --git a/script/server b/script/server index 0bd415e0..ce8dd094 100755 --- a/script/server +++ b/script/server @@ -4,10 +4,10 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." # Activate virtual environment source .venv/bin/activate # Launch the app -python3 app.py $@ +python3 app.py ${@} diff --git a/script/setup b/script/setup index 19a8e225..ca645716 100755 --- a/script/setup +++ b/script/setup @@ -4,7 +4,7 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." # Install virtualenv pip install virtualenv diff --git a/script/test b/script/test index 7c92f24e..9a910fa4 100755 --- a/script/test +++ b/script/test @@ -4,7 +4,7 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." # Activate virtual environment source .venv/bin/activate diff --git a/script/update b/script/update index d8f9af45..db23ee2d 100755 --- a/script/update +++ b/script/update @@ -4,7 +4,7 @@ set -e # Ensure we are in the app root directory (not the /script directory) -cd "$(dirname "$0")/.." +cd "$(dirname "${0}")/.." # Activate virtual environment source .venv/bin/activate From 56a061350586bcac60c653dcebbf5b4a92dca18e Mon Sep 17 00:00:00 2001 From: Devon Mackay Date: Wed, 30 May 2018 15:35:41 -0400 Subject: [PATCH 4/6] Add virtual env info and update app launch command --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a50ce22..70a643f6 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,16 @@ ./script/setup +The setup script will create a new Python virtual environment for the application to use. All of the scripts will activate this virutal envirnment automatically, but you can also manually activate it like this: + source .venv/bin/activate + +If you want to automatically load the virtual environment whenever you enter the project directory, take a look at [direnv](https://direnv.net/) + ## Running (development) To start the app and watch for changes: - DEBUG=1 ./app.py + DEBUG=1 ./script/server ## Testing From 0dd4fd66d3ee190d9b19f881d2d27f30fa27cc61 Mon Sep 17 00:00:00 2001 From: Devon Mackay Date: Wed, 30 May 2018 15:38:56 -0400 Subject: [PATCH 5/6] Add blank line to fix formatting --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 70a643f6..de7f0cbe 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ ./script/setup The setup script will create a new Python virtual environment for the application to use. All of the scripts will activate this virutal envirnment automatically, but you can also manually activate it like this: + source .venv/bin/activate If you want to automatically load the virtual environment whenever you enter the project directory, take a look at [direnv](https://direnv.net/) From bf66cd5ef3a87ba7f080fc9eb344d1e4cc973b40 Mon Sep 17 00:00:00 2001 From: Devon Mackay Date: Wed, 30 May 2018 15:39:46 -0400 Subject: [PATCH 6/6] Add fonts symlink to ignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index d2876f81..189378da 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ scss/assets .pytest_cache/ .venv/ __pycache__ + +# Ignore static/fonts for now, since it is just symlink +static/fonts