Skip to content

Instantly share code, notes, and snippets.

@thurt
Forked from jimschubert/swagger.sh
Created January 28, 2018 23:38
Show Gist options
  • Save thurt/82664e4a16847c5ebb7a8b438b463c9b to your computer and use it in GitHub Desktop.
Save thurt/82664e4a16847c5ebb7a8b438b463c9b to your computer and use it in GitHub Desktop.
Quick script for running swagger codegen cli directly
#!/bin/bash
ver=2.2.0
jar=swagger-codegen-cli-$ver.jar
md5=57e673eb334364ab614cc6083b0f4b27
repo="http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/$ver/$jar"
if [ ! -f $jar ]; then
echo "[info] downloading $PWD/$jar from $repo" 1>&2
if ! curl --location --silent --fail --remote-name $repo -o $jar; then
exit 1
fi
fi
checksum=`openssl dgst -md5 $jar | awk '{ print $2 }'`
if [ "$checksum" != $md5 ]; then
echo "[error] Bad $PWD/$jar. Delete $PWD/$jar and run $0 again."
exit 1
fi
java -ea \
$JAVA_OPTS \
-Xms512M \
-Xmx1024M \
-server \
-jar $jar "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment