1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

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
This commit is contained in:
Peter Dave Hello
2019-04-07 00:53:55 +08:00
parent a0bd756c09
commit a516f2ca7c
4 changed files with 13 additions and 13 deletions

View File

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

View File

@@ -26,11 +26,11 @@ export DYN_PASSWORD=
export DYN_USERNAME=
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 xml
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
} || echo "Code coverage 100%"

View File

@@ -2,7 +2,7 @@
set -e
cd "$(dirname $0)"/..
cd "$(dirname "$0")"/..
ROOT=$(pwd)
if [ -z "$VENV_NAME" ]; then
@@ -16,10 +16,10 @@ if [ ! -f "$ACTIVATE" ]; then
fi
. "$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"
python setup.py sdist
twine upload dist/*$VERSION.tar.gz

View File

@@ -3,13 +3,13 @@
set -e
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
fi
SHA=$(git rev-parse HEAD)
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"