source: src/mapservice/codegen/openapi-generator-cli@ 0200f6c

debian/bullseye
Last change on this file since 0200f6c was 5e4cb73, checked in by Joachim Langenbach <joachim.langenbach@…>, 8 years ago

Refactored mapservice

  • mapservice is a connexion python webservice with openapi defined api
  • mapservice-webclient is a angular app, consuming the openapi webservice mapservice
  • Property mode set to 100755
File size: 2.0 KB
Line 
1#!/usr/bin/env bash
2####
3# Save as openapi-generator-cli on your PATH. chmod u+x. Enjoy.
4#
5# This script will query github on every invocation to pull the latest released version
6# of openapi-generator.
7#
8# If you want repeatable executions, you can explicitly set a version via
9# OPENAPI_GENERATOR_VERSION
10# e.g. (in Bash)
11# export OPENAPI_GENERATOR_VERSION=3.1.0
12# openapi-generator-cli.sh
13# or
14# OPENAPI_GENERATOR_VERSION=3.1.0 openapi-generator-cli.sh
15#
16# This is also helpful, for example, if you want want to evaluate a SNAPSHOT version.
17#
18# NOTE: Jars are downloaded on demand from maven into the same directory as this script
19# for every 'latest' version pulled from github. Consider putting this under its own directory.
20####
21set -o pipefail
22
23for cmd in {mvn,jq,curl}; do
24 if ! command -v ${cmd} > /dev/null; then
25 >&2 echo "This script requires '${cmd}' to be installed."
26 exit 1
27 fi
28done
29
30function latest.tag {
31 local uri="https://api.github.com/repos/${1}/releases"
32 local ver=$(curl -s ${uri} | jq -r 'first(.[]|select(.prerelease==false)).tag_name')
33 if [[ $ver == v* ]]; then
34 ver=${ver:1}
35 fi
36 echo $ver
37}
38
39ghrepo=openapitools/openapi-generator
40groupid=org.openapitools
41artifactid=openapi-generator-cli
42ver=${OPENAPI_GENERATOR_VERSION:-$(latest.tag $ghrepo)}
43
44jar=${artifactid}-${ver}.jar
45DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
46
47if [ ! -f ${DIR}/${jar} ]; then
48 repo="central::default::https://repo1.maven.org/maven2/"
49 if [[ ${ver} =~ ^.*-SNAPSHOT$ ]]; then
50 repo="central::default::https://oss.sonatype.org/content/repositories/snapshots"
51 fi
52 mvn org.apache.maven.plugins:maven-dependency-plugin:2.9:get \
53 -DremoteRepositories=${repo} \
54 -Dartifact=${groupid}:${artifactid}:${ver} \
55 -Dtransitive=false \
56 -Ddest=${DIR}/${jar}
57fi
58
59java -ea \
60 ${JAVA_OPTS} \
61 -Xms512M \
62 -Xmx1024M \
63 -server \
64 -jar ${DIR}/${jar} "$@"
Note: See TracBrowser for help on using the repository browser.