Browse Source

Refactor shell script syntax and consistency

- Add a missing space for styling
- Replace legacy "\`...\`" with `$(...)`
- Quote variable to prevent word splitting
- Use builtin `command -v` instead of non-standard `which`
- Add two missing `>&2` redirection for error/warning message
pull/338/head
Peter Dave Hello 7 years ago
parent
commit
a516f2ca7c
4 changed files with 13 additions and 13 deletions
  1. +3
    -3
      script/bootstrap
  2. +3
    -3
      script/coverage
  3. +4
    -4
      script/release
  4. +3
    -3
      script/sdist

+ 3
- 3
script/bootstrap View File

@ -4,7 +4,7 @@
set -e set -e
cd "$(dirname $0)"/..
cd "$(dirname "$0")"/..
ROOT=$(pwd) ROOT=$(pwd)
if [ -z "$VENV_NAME" ]; then if [ -z "$VENV_NAME" ]; then
@ -13,9 +13,9 @@ fi
if [ ! -d "$VENV_NAME" ]; then if [ ! -d "$VENV_NAME" ]; then
if [ -z "$VENV_PYTHON" ]; then if [ -z "$VENV_PYTHON" ]; then
VENV_PYTHON=`which python`
VENV_PYTHON=$(command -v python)
fi fi
virtualenv --python=$VENV_PYTHON $VENV_NAME
virtualenv --python="$VENV_PYTHON" "$VENV_NAME"
fi fi
. "$VENV_NAME/bin/activate" . "$VENV_NAME/bin/activate"


+ 3
- 3
script/coverage View File

@ -26,11 +26,11 @@ export DYN_PASSWORD=
export DYN_USERNAME= export DYN_USERNAME=
export GOOGLE_APPLICATION_CREDENTIALS= export GOOGLE_APPLICATION_CREDENTIALS=
coverage run --branch --source=octodns --omit=octodns/cmds/* `which nosetests` --with-xunit "$@"
coverage run --branch --source=octodns --omit=octodns/cmds/* "$(command -v nosetests)" --with-xunit "$@"
coverage html coverage html
coverage xml coverage xml
coverage report coverage report
coverage report | grep ^TOTAL| grep -qv 100% && {
echo "Incomplete code coverage"
coverage report | grep ^TOTAL | grep -qv 100% && {
echo "Incomplete code coverage" >&2
exit 1 exit 1
} || echo "Code coverage 100%" } || echo "Code coverage 100%"

+ 4
- 4
script/release View File

@ -2,7 +2,7 @@
set -e set -e
cd "$(dirname $0)"/..
cd "$(dirname "$0")"/..
ROOT=$(pwd) ROOT=$(pwd)
if [ -z "$VENV_NAME" ]; then if [ -z "$VENV_NAME" ]; then
@ -16,10 +16,10 @@ if [ ! -f "$ACTIVATE" ]; then
fi fi
. "$ACTIVATE" . "$ACTIVATE"
VERSION=$(grep __VERSION__ $ROOT/octodns/__init__.py | sed -e "s/.* = '//" -e "s/'$//")
VERSION="$(grep __VERSION__ "$ROOT/octodns/__init__.py" | sed -e "s/.* = '//" -e "s/'$//")"
git tag -s v$VERSION -m "Release $VERSION"
git push origin v$VERSION
git tag -s "v$VERSION" -m "Release $VERSION"
git push origin "v$VERSION"
echo "Tagged and pushed v$VERSION" echo "Tagged and pushed v$VERSION"
python setup.py sdist python setup.py sdist
twine upload dist/*$VERSION.tar.gz twine upload dist/*$VERSION.tar.gz


+ 3
- 3
script/sdist View File

@ -3,13 +3,13 @@
set -e set -e
if ! git diff-index --quiet HEAD --; then if ! git diff-index --quiet HEAD --; then
echo "Changes in local directory, commit or clear"
echo "Changes in local directory, commit or clear" >&2
exit 1 exit 1
fi fi
SHA=$(git rev-parse HEAD) SHA=$(git rev-parse HEAD)
python setup.py sdist python setup.py sdist
TARBALL=dist/octodns-$SHA.tar.gz
mv dist/octodns-0.*.tar.gz $TARBALL
TARBALL="dist/octodns-$SHA.tar.gz"
mv dist/octodns-0.*.tar.gz "$TARBALL"
echo "Created $TARBALL" echo "Created $TARBALL"

Loading…
Cancel
Save