Skip to content

Commit

Permalink
Update generate script to generate client in a new subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
mbohlool committed Nov 23, 2016
1 parent 880091d commit aa671e2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 211 deletions.
202 changes: 0 additions & 202 deletions scripts/LICENSE

This file was deleted.

14 changes: 7 additions & 7 deletions scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if ! which mvn > /dev/null 2>&1; then
fi

SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")
CLIENT_ROOT="${SCRIPT_ROOT}/.."
CLIENT_ROOT="${SCRIPT_ROOT}/../kubernetes"

pushd "${SCRIPT_ROOT}" > /dev/null
SCRIPT_ROOT=`pwd`
Expand All @@ -37,7 +37,7 @@ pushd "${CLIENT_ROOT}" > /dev/null
CLIENT_ROOT=`pwd`
popd > /dev/null

PACKAGE_NAME=${PACKAGE_NAME:-k8sclient}
PACKAGE_NAME=${PACKAGE_NAME:-client}

if [[ ! -n ${SWAGGER_FILE-} ]]; then
if [[ ! -n ${KUBE_ROOT-} ]]; then
Expand All @@ -59,9 +59,9 @@ echo "--- Generating client ..."
mvn -f "${SCRIPT_ROOT}/pom.xml" clean generate-sources -Dgenerator.spec.path="${SCRIPT_ROOT}/swagger.json" -Dgenerator.output.path="${CLIENT_ROOT}" -Dgenerator.package.name=${PACKAGE_NAME}

echo "--- Patching generated code..."
cat "${CLIENT_ROOT}/README.prefix" "${CLIENT_ROOT}/README.md" > "${CLIENT_ROOT}/README.new"
rm "${CLIENT_ROOT}/README.md"
mv "${CLIENT_ROOT}/README.new" "${CLIENT_ROOT}/README.md"
cp "${SCRIPT_ROOT}/LICENSE" "${CLIENT_ROOT}"

find "${CLIENT_ROOT}/test" -type f -name \*.py -exec sed -i 's/\bclient/kubernetes.client/g' {} +
find "kubernetes/" -type f -name \*.md -exec sed -i 's/\bclient/kubernetes.client/g' {} +
find "kubernetes/" -type f -name \*.md -exec sed -i 's/kubernetes.client-python/client-python/g' {} +
rm "${CLIENT_ROOT}/LICENSE"
echo "---Done."

4 changes: 2 additions & 2 deletions scripts/update-pep8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if ! which virtualenv > /dev/null 2>&1; then
fi

SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")
CLIENT_ROOT="${SCRIPT_ROOT}/.."
CLIENT_ROOT="${SCRIPT_ROOT}/../kubernetes"

pushd "${SCRIPT_ROOT}" > /dev/null
SCRIPT_ROOT=`pwd`
Expand All @@ -46,7 +46,7 @@ SAVEIFS=$IFS
trap "IFS=$SAVEIFS" EXIT SIGINT
IFS=,

SOURCES="${CLIENT_ROOT}/k8sutil/*.py,${SCRIPT_ROOT}/*.py,${CLIENT_ROOT}/examples/*.py"
SOURCES="${CLIENT_ROOT}/util/*.py,${SCRIPT_ROOT}/*.py,${CLIENT_ROOT}/examples/*.py"

echo "--- Updating tools"
pip install --upgrade pep8
Expand Down

0 comments on commit aa671e2

Please sign in to comment.