-
Notifications
You must be signed in to change notification settings - Fork 0
SAMT Wrapper #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
SAMT Wrapper #14
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6d983ed
feat(ci): release cli on tag creation
PascalHonegger bc8908e
feat(wrapper): create basic samtw scripts
PascalHonegger 84b4e66
feat(readme): create initial readme
PascalHonegger f51ff73
fix(wrapper): add . to relative paths
mjossdev 5294c96
fix(wrapper): correct bat file usage to work on Windows 10 and Window…
PascalHonegger 5e939fd
fix(wrapper): fix typo occured => occurred
PascalHonegger 14b716f
feat(readme): add development setup documentation
PascalHonegger 425738f
feat(wrapper): use wrapper as program name within CLI
PascalHonegger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,35 @@ | ||
| name: Publish Release | ||
| on: | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-java@v3 | ||
| with: | ||
| distribution: temurin | ||
| java-version: 17 | ||
| - name: Setup Gradle | ||
| uses: gradle/gradle-build-action@v2 | ||
|
|
||
| - name: Build CLI | ||
| run: ./gradlew --no-daemon :cli:shadowDistZip :cli:shadowDistTar | ||
|
|
||
| - name: Rename cli-shadow to cli | ||
| run: | | ||
| mv cli/build/distributions/cli-shadow.zip cli/build/distributions/cli.zip | ||
| mv cli/build/distributions/cli-shadow.tar cli/build/distributions/cli.tar | ||
|
|
||
| - name: Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| files: | | ||
| cli/build/distributions/cli.zip | ||
| cli/build/distributions/cli.tar | ||
| fail_on_unmatched_files: true |
This file contains hidden or 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,65 @@ | ||
| <h1 align="center">SAMT - Simple API Modeling Toolkit</h1> | ||
|
|
||
| <div align="center"> | ||
|
|
||
| [](https://github.com/samtkit/core/releases/latest) | ||
| [](https://github.com/samtkit/core/releases/latest) | ||
| [](./LICENSE) | ||
|
|
||
| </div> | ||
|
|
||
| <p align="center"> | ||
| <i>Tired of unreadable OpenAPI YAML files and a plethora of different tools? | ||
| <br>SAMT is a developer-focused, extendable and easy-to-learn toolkit for modeling APIs using a business-first approach</i> | ||
| <br> | ||
| </p> | ||
|
|
||
| <hr> | ||
|
|
||
| ## Documentation | ||
|
|
||
| Get started with SAMT, learn fundamental concepts or extend SAMT with a custom generator. | ||
|
|
||
| - [Getting Started](https://github.com/samtkit/core/wiki/Getting-Started) | ||
| - [Modeling Concepts](https://github.com/samtkit/core/wiki/Modeling-Concepts) | ||
| - [Visual Studio Code Plugin](https://marketplace.visualstudio.com/items?itemName=samt.samt) | ||
|
|
||
| ### Advanced | ||
|
|
||
| - [Authoring Generators](https://github.com/samtkit/core/wiki/Authoring-Generators) | ||
| - [Architecture](https://github.com/samtkit/core/wiki/Architecture) | ||
|
|
||
| ## Development Setup | ||
|
|
||
| SAMT is written in [Kotlin](https://kotlinlang.org/) and uses [Gradle](https://gradle.org/) as a build tool, for the best developer experience we recommend using [IntelliJ](https://www.jetbrains.com/idea/). | ||
|
|
||
| If you want to start SAMT locally, simply clone the repository and compile it using Gradle: | ||
|
|
||
| ```shell | ||
| ./gradlew assemble | ||
| ``` | ||
|
|
||
| You can also compile the CLI module locally: | ||
|
|
||
| ```shell | ||
| ./gradlew :cli:shadowJar | ||
| ``` | ||
|
|
||
| And then compile SAMT files using this locally compiled version: | ||
|
|
||
| ```shell | ||
| java -jar ./cli/build/libs/samt-cli.jar ./specification/examples/todo-service/*.samt | ||
| ``` | ||
|
|
||
| If you're more interested in the [SAMT Visual Studio Code plugin](https://github.com/samtkit/vscode) or the related language server, you can also compile it locally as well: | ||
|
|
||
| ```shell | ||
| ./gradlew :language-server:shadowJar | ||
| ``` | ||
|
|
||
| ## Contributing | ||
|
|
||
| Want to report a bug, contribute code, or improve documentation? Excellent! | ||
| Simply create an [issue](https://github.com/samtkit/core/issues), | ||
| open a [pull request](https://github.com/samtkit/core/pulls) or | ||
| start a [discussion](https://github.com/samtkit/core/discussions). | ||
This file contains hidden or 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 hidden or 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,2 @@ | ||
| samtVersion=v0.0.1 | ||
| distributionUrl=https\://github.com/samtkit/core/releases/download/$samtVersion/cli.tar |
This file contains hidden or 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,42 @@ | ||
| #!/usr/bin/env sh | ||
|
|
||
| if [ ! -f ./samt-wrapper.properties ]; then | ||
| echo "samt-wrapper.properties file not found." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| . ./samt-wrapper.properties | ||
|
|
||
| if ! command -v tar > /dev/null; then | ||
| echo "This script requires 'tar' to be installed." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p .samt/cli | ||
|
|
||
| if [ ! -f .samt/.gitignore ]; then | ||
| echo "*" > .samt/.gitignore | ||
| fi | ||
|
|
||
| currentVersion=$(cat .samt/cli/version.txt 2> /dev/null || echo "0.0.0") | ||
|
|
||
| if [ "$currentVersion" != "$samtVersion" ]; then | ||
| echo "Downloading samt $samtVersion from '$distributionUrl'..." | ||
| if command -v curl > /dev/null; then | ||
| if ! curl -s -L "$distributionUrl" | tar x -C .samt/cli; then | ||
| echo "An error occurred while downloading '$distributionUrl' archive using curl." >&2 | ||
| exit 1 | ||
| fi | ||
| echo "$samtVersion" > .samt/cli/version.txt | ||
| elif command -v curl > /dev/null; then | ||
| if ! wget -qO- "$distributionUrl" | tar x -C .samt/cli; then | ||
| echo "An error occurred while downloading '$distributionUrl' archive using wget." >&2 | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "samtw requires either 'curl' or 'wget' to be installed." >&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| exec ".samt/cli/cli-shadow/bin/cli" "$@" |
This file contains hidden or 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,59 @@ | ||
| @echo off | ||
|
|
||
| setlocal EnableDelayedExpansion | ||
|
|
||
| if not exist samt-wrapper.properties ( | ||
| echo "samt-wrapper.properties not found." | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| for /f "tokens=1,2 delims==" %%G in (samt-wrapper.properties) do ( | ||
| if "%%G"=="samtVersion" ( | ||
| set "samtVersion=%%H" | ||
| ) | ||
| if "%%G"=="distributionUrl" ( | ||
| set distributionUrlPattern=%%H | ||
| ) | ||
| ) | ||
|
|
||
| set distributionUrl=%distributionUrlPattern:$samtVersion=!samtVersion!% | ||
| set distributionUrl=%distributionUrl:\:=:% | ||
|
|
||
| where tar >nul || ( | ||
| echo "This script requires 'tar' to be installed." >&2 | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| if not exist .samt\cli mkdir .samt\cli | ||
|
|
||
| if not exist .samt\.gitignore echo *> .samt\.gitignore | ||
|
|
||
| set "currentVersion=0.0.0" | ||
|
|
||
| if exist .samt\cli\version.txt ( | ||
| set /p currentVersion=<.samt\cli\version.txt | ||
| ) | ||
|
|
||
| if "%currentVersion%" neq "%samtVersion%" ( | ||
| echo Downloading samt %samtVersion% from '%distributionUrl%'... | ||
| WHERE /q curl | ||
| if %ERRORLEVEL% EQU 0 ( | ||
| curl -L -o .samt\cli\cli.tar "%distributionUrl%" || ( | ||
| echo An error occurred while downloading '%distributionUrl%' archive using curl. >&2 | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| ) else ( | ||
| echo samtw requires 'curl' to be installed. >&2 | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| tar xf .samt\cli\cli.tar -C .samt\cli || ( | ||
| echo An error occurred while unpacking .samt\cli\cli.tar using tar. >&2 | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| echo %samtVersion%> .samt\cli\version.txt | ||
| ) | ||
|
|
||
| call ".samt\cli\cli-shadow\bin\cli.bat" %* |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.