generated from devcontainers/feature-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add feature: OpenAPI Generator CLI (#3)
- Loading branch information
1 parent
63077f7
commit 09a1ecb
Showing
19 changed files
with
201 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ | |
"problemMatcher": [] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env -S make -f | ||
|
||
MAKEFLAGS += --warn-undefined-variable | ||
MAKEFLAGS += --no-builtin-rules | ||
MAKEFLAGS += --silent | ||
|
||
SHELL := bash | ||
.ONESHELL: | ||
.SHELLFLAGS := -eu -o pipefail -c | ||
.DELETE_ON_ERROR: | ||
.DEFAULT_GOAL := help | ||
|
||
help: Makefile ## Show help | ||
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' | ||
|
||
|
||
# ============================================================================= | ||
# Common | ||
# ============================================================================= | ||
install: ## Install deps | ||
npm install -g @devcontainers/cli | ||
pre-commit install --install-hooks | ||
.PHONY: install | ||
|
||
update: ## Update deps and tools | ||
pre-commit autoupdate | ||
.PHONY: update | ||
|
||
|
||
# ============================================================================= | ||
# CI | ||
# ============================================================================= | ||
ci: lint test ## Run CI tasks | ||
.PHONY: ci | ||
|
||
format: ## Run autoformatters | ||
|
||
.PHONY: format | ||
|
||
lint: ## Run all linters | ||
|
||
.PHONY: lint | ||
|
||
test: ## Run tests | ||
devcontainer features test | ||
.PHONY: test | ||
|
||
|
||
# ============================================================================= | ||
# Handy Scripts | ||
# ============================================================================= | ||
clean: ## Remove temporary files | ||
|
||
.PHONY: clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
# My Favorite Color (color) | ||
|
||
A feature to remind you of your favorite color | ||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/devcontainers/feature-starter/color:1": { | ||
"version": "latest" | ||
} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
|-----|-----|-----|-----| | ||
| favorite | Choose your favorite color. | string | red | | ||
|
||
|
||
|
||
--- | ||
|
||
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/feature-starter/blob/main/src/color/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "OpenAPI Generator CLI", | ||
"id": "openapi-generator-cli", | ||
"version": "0.1.0", | ||
"description": "A feature to install OpenAPI Generator CLI. Java is required but not included in this feature.", | ||
"options": { | ||
"version": { | ||
"type": "string", | ||
"default": "latest", | ||
"description": "The version of OpenAPI Generator CLI to install." | ||
} | ||
}, | ||
"installsAfter": [ | ||
"ghcr.io/devcontainers/features/java" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
apt-get update && apt-get install -y curl | ||
|
||
if [ "$VERSION" = 'latest' ]; then | ||
echo "Resolving latest version of OpenAPI Generator CLI" | ||
VERSION=$( | ||
curl https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/maven-metadata.xml \ | ||
| grep -Eo '<latest>(.+)</latest>' \ | ||
| sed -E 's/<latest>(.+)<\/latest>/\1/' | ||
) | ||
fi | ||
|
||
echo "Installing OpenAPI Generator CLI with version ${VERSION}" | ||
|
||
curl -o /usr/local/lib/openapi-generator-cli.jar \ | ||
"https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${VERSION}/openapi-generator-cli-${VERSION}.jar" | ||
|
||
echo "Creating wrapper script for OpenAPI Generator CLI" | ||
|
||
cat <<EOF > /usr/local/bin/openapi-generator-cli | ||
#!/bin/sh | ||
java -jar /usr/local/lib/openapi-generator-cli.jar "\$@" | ||
EOF | ||
chmod +x /usr/local/bin/openapi-generator-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{} | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# shellcheck source=/dev/null | ||
source dev-container-features-test-lib | ||
|
||
check "verify OpenAPI Generator CLI installation" openapi-generator-cli --version | grep -Eo '^openapi-generator-cli .+$' | ||
|
||
reportResults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"latest": { | ||
"image": "mcr.microsoft.com/devcontainers/base:bookworm", | ||
"features": { | ||
"ghcr.io/devcontainers/features/java:1": {}, | ||
"openapi-generator-cli": {} | ||
} | ||
}, | ||
"specific-version": { | ||
"image": "mcr.microsoft.com/devcontainers/base:bookworm", | ||
"features": { | ||
"ghcr.io/devcontainers/features/java:1": {}, | ||
"openapi-generator-cli": { | ||
"version": "7.8.0" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# shellcheck source=/dev/null | ||
source dev-container-features-test-lib | ||
|
||
check "verify OpenAPI Generator CLI installation" openapi-generator-cli --version | grep -Eo '^openapi-generator-cli 7\.8\.0$' | ||
|
||
reportResults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# shellcheck source=/dev/null | ||
source dev-container-features-test-lib | ||
|
||
check "can be installed even java not installed" openapi-generator-cli --version 2>&1 | grep 'java: not found' | ||
|
||
reportResults |