Merge pull request #47 from dod-ccpo/pipenv_optional

Make using a pipenv environment optional
This commit is contained in:
Devon 2018-07-02 14:00:27 -04:00 committed by GitHub
commit 863d323319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 9 deletions

View File

@ -9,13 +9,24 @@ set -e
# Ensure we are in the app root directory (not the /script directory) # Ensure we are in the app root directory (not the /script directory)
cd "$(dirname "${0}")/.." cd "$(dirname "${0}")/.."
if [ -z "${CIBUILD+xxxx}" ]; then
CMD_PREFIX='pipenv run '
fi
PIP_CMD="${CMD_PREFIX}pip"
WEBASSETS_CMD="${CMD_PREFIX}webassets"
PIPENV_INSTALL_FLAGS='--dev'
if ${CIBUILD}; then
PIPENV_INSTALL_FLAGS+=' --system --ignore-pipfile'
fi
# Install Python dependencies # Install Python dependencies
pipenv --python 3.6 pipenv --python 3.6
pipenv run pip install --upgrade pip ${PIP_CMD} install --upgrade pip
pipenv install --dev pipenv install ${PIPENV_INSTALL_FLAGS}
# Install uswds node module and dependencies # Install uswds node module and dependencies
npm install npm install
# Precompile assets for deployment # Precompile assets for deployment
pipenv run webassets -m atst.assets build ${WEBASSETS_CMD} -m atst.assets build

View File

@ -14,8 +14,13 @@ set -e
# Ensure we are in the app root directory (not the /script directory) # Ensure we are in the app root directory (not the /script directory)
cd "$(dirname "${0}")/.." cd "$(dirname "${0}")/.."
if [ -z "${SKIP_PIPENV+xxxx}" ]; then
CMD_PREFIX='pipenv run '
fi
PYTHON_CMD="${CMD_PREFIX}python"
# Launch the app # Launch the app
pipenv run python app.py ${@} & ${PYTHON_CMD} app.py ${@} &
child=$! child=$!
wait $child wait $child

View File

@ -12,9 +12,6 @@ cd "$(dirname "${0}")/.."
# Install virtualenv # Install virtualenv
pip install pipenv pip install pipenv
# Update npm
npm install -g npm
if ! type sass > /dev/null; then if ! type sass > /dev/null; then
if type gem > /dev/null; then if type gem > /dev/null; then
echo 'installing a sass compiler...' echo 'installing a sass compiler...'

View File

@ -1,12 +1,23 @@
#!/bin/bash #!/bin/bash
# script/test: Run static code checks and unit tests
# If a command fails, exit the script # If a command fails, exit the script
set -e set -e
# Ensure we are in the app root directory (not the /script directory) # Ensure we are in the app root directory (not the /script directory)
cd "$(dirname "${0}")/.." cd "$(dirname "${0}")/.."
pipenv run pylint app.py atst/ tests/ if [ -z "${SKIP_PIPENV+xxxx}" ]; then
CMD_PREFIX='pipenv run '
fi
PYLINT_CMD="${CMD_PREFIX}pylint"
PYTHON_CMD="${CMD_PREFIX}python"
# Run lint check
echo "Running lint..."
${PYLINT_CMD} app.py atst/ tests/
# Run unit tests # Run unit tests
pipenv run python -m pytest -s $* echo "Running unit tests..."
${PYTHON_CMD} -m pytest -s $*