Skip to content

Commit a143f5e

Browse files
committed
feat: Add plugin for jet
0 parents  commit a143f5e

26 files changed

+1062
-0
lines changed

.circleci/config.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
version: 2.1
2+
3+
orbs:
4+
# orb info: https://circleci.com/developer/orbs/orb/rynkowsg/asdf
5+
asdf: rynkowsg/[email protected]
6+
# orb info: https://circleci.com/developer/orbs/orb/rynkowsg/checkout
7+
checkout: rynkowsg/[email protected]
8+
# orb info: https://circleci.com/developer/orbs/orb/rynkowsg/rynkowsg
9+
rynkowsg: rynkowsg/[email protected]
10+
11+
jobs:
12+
checks:
13+
executor: rynkowsg/docker_x86_cimg_base
14+
steps:
15+
- checkout/checkout: {depth: 1}
16+
- asdf/install: {version: 0.14.0}
17+
- restore_cache:
18+
name: asdf - restore cache (partial)
19+
keys:
20+
- asdf-{{ checksum ".tool-versions" }}
21+
- run:
22+
name: asdf - add plugin
23+
command: |
24+
set -x
25+
cd /tmp
26+
git config --global advice.detachedHead false
27+
asdf plugin add babashka https://github.com/fredZen/asdf-babashka.git
28+
asdf plugin add java https://github.com/halcyon/asdf-java.git
29+
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git
30+
asdf plugin add shfmt https://github.com/luizm/asdf-shfmt.git
31+
- run:
32+
name: asdf - install tools
33+
command: |
34+
set -x
35+
bash --version
36+
asdf install
37+
bb --version
38+
java --version
39+
shellcheck --version
40+
shfmt --version
41+
- save_cache:
42+
name: asdf - save cache (partial)
43+
key: asdf-{{ checksum ".tool-versions" }}
44+
paths:
45+
- ~/.asdf/installs
46+
- ~/.asdf/plugins
47+
- ~/.asdf/shims
48+
- rynkowsg/install_sosh: { version: "v0.2.0" }
49+
- run: make lint
50+
- run: make format-check
51+
52+
workflows:
53+
lint_and_format:
54+
jobs:
55+
- checks

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.{md,yml,yaml}]
11+
indent_style = space
12+
indent_size = 2

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/lint-pr.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint PR
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
semantic-pr:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: amannn/[email protected] # https://github.com/amannn/action-semantic-pull-request/releases
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
with:
18+
validateSingleCommit: true

.github/workflows/lint.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
10+
jobs:
11+
actionlint:
12+
runs-on: ubuntu-22.04 # https://github.com/actions/runner-images?tab=readme-ov-file#available-images
13+
steps:
14+
- uses: actions/[email protected] # https://github.com/actions/checkout/releases
15+
- name: Check workflow files
16+
uses: docker://rhysd/actionlint:1.7.1 # https://hub.docker.com/r/rhysd/actionlint/tags
17+
with:
18+
args: -color

.github/workflows/test.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
10+
jobs:
11+
plugin_test:
12+
name: plugin test
13+
strategy:
14+
matrix:
15+
os:
16+
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
17+
- ubuntu-22.04
18+
- macos-12 # x86_64
19+
- macos-14 # arm64
20+
runs-on: ${{ matrix.os }}
21+
steps:
22+
- name: asdf_plugin_test
23+
uses: asdf-vm/actions/[email protected] # https://github.com/asdf-vm/actions/releases
24+
with:
25+
command: jet --help

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# JetBrains IDEs
2+
/.idea/*
3+
!/.idea/codeStyles/
4+
!/.idea/copyright/
5+
!/.idea/dictionaries/
6+
!/.idea/fileTemplates/
7+
!/.idea/repl-commands.xml
8+
!/.idea/runConfigurations/
9+
*.iml
10+
11+
# MacOS
12+
.DS_Store
13+
14+
# sosh
15+
/.github_deps

.tool-versions

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# PLUGIN: https://github.com/fredZen/asdf-babashka
2+
# RELEASES: https://github.com/babashka/babashka/releases
3+
babashka 1.3.191
4+
5+
# required for: sosh
6+
# PLUGIN: https://github.com/halcyon/asdf-java
7+
java temurin-17.0.11+9
8+
9+
# PLUGIN: https://github.com/luizm/asdf-shellcheck
10+
# RELEASES: https://github.com/koalaman/shellcheck/releases
11+
shellcheck 0.10.0
12+
13+
# PLUGIN: https://github.com/luizm/asdf-shfmt
14+
# RELEASES: https://github.com/mvdan/sh/releases
15+
shfmt 3.8.0

@bin/format.bash

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) 2024 Greg Rynkowski. All rights reserved.
3+
# License: MIT License
4+
5+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6+
#
7+
# Validates/corrects format
8+
#
9+
# Example:
10+
#
11+
# - check: @bin/format.bash check
12+
# - apply: @bin/format.bash apply
13+
#
14+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15+
16+
# Bash Strict Mode Settings
17+
set -euo pipefail
18+
# Path Initialization
19+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P || exit 1)"
20+
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd -P || exit 1)"
21+
export SHELL_GR_DIR="${ROOT_DIR}/.github_deps/rynkowsg/shell-gr@e5a1b73" # needed for shell-gr to resolve paths
22+
# Library Sourcing
23+
source "${ROOT_DIR}/.github_deps/rynkowsg/shell-gr@e5a1b73/lib/tool/format.bash" # format_with_env
24+
25+
main() {
26+
local format_cmd_type="${1:-"apply"}"
27+
local error=0
28+
format_with_env "${format_cmd_type}" bash \
29+
< <(
30+
find "${ROOT_DIR}" \( -type f \( -name '*.bash' -o -name '*.sh' \) -o -path '*/bin/*' \) \
31+
| grep -v -E '(.github_deps|/gen/)' \
32+
| sort
33+
) \
34+
|| ((error += $?))
35+
format_with_env "${format_cmd_type}" bats < <(find "${ROOT_DIR}" -type f -name '*.bats' | sort) || ((error += $?))
36+
if ((error > 0)); then
37+
exit "$error"
38+
fi
39+
}
40+
41+
main "$@"

@bin/lint.bash

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) 2024 Greg Rynkowski. All rights reserved.
3+
# License: MIT License
4+
5+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6+
#
7+
# Lint bash source files
8+
#
9+
# Example:
10+
#
11+
# @bin/lint.bash
12+
#
13+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14+
15+
# Bash Strict Mode Settings
16+
set -euo pipefail
17+
# Path Initialization
18+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P || exit 1)"
19+
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd -P || exit 1)"
20+
export SHELL_GR_DIR="${ROOT_DIR}/.github_deps/rynkowsg/shell-gr@e5a1b73" # needed for shell-gr to resolve paths
21+
# Library Sourcing
22+
source "${ROOT_DIR}/.github_deps/rynkowsg/shell-gr@e5a1b73/lib/tool/lint.bash" # lint
23+
24+
main() {
25+
local error=0
26+
lint bash \
27+
< <(
28+
find "${ROOT_DIR}" \( -type f \( -name '*.bash' -o -name '*.sh' \) -o -path '*/bin/*' \) \
29+
| grep -v -E '(.github_deps|/gen/)' \
30+
| sort
31+
) \
32+
|| ((error += $?))
33+
lint bats < <(find "${ROOT_DIR}" -type f -name '*.bats' | sort) || ((error += $?))
34+
if ((error > 0)); then
35+
exit "$error"
36+
fi
37+
}
38+
39+
main

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 Greg Rynkowski
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.PHONY: deps-clean _format_deps format-check format _lint_deps lint
2+
3+
SCRIPTS := $(wildcard bin/*)
4+
deps: $(SCRIPTS)
5+
@$(foreach script,$^,echo "Fetching for $(script)"; sosh fetch $(script);)
6+
7+
deps-clean:
8+
rm -rf lib/.github_deps
9+
make deps
10+
11+
_format_deps: @bin/format.bash
12+
sosh fetch @bin/format.bash
13+
14+
format-check: _format_deps
15+
\@bin/format.bash check
16+
17+
format: _format_deps
18+
\@bin/format.bash apply
19+
20+
_lint_deps: @bin/lint.bash
21+
sosh fetch @bin/lint.bash
22+
23+
lint: _format_deps _lint_deps deps
24+
\@bin/lint.bash

README.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<div align="center">
2+
3+
# asdf-jet
4+
[![GitHub Actions Test Status][ci-actions-test-badge]][ci-actions-test]
5+
[![GitHub Actions Lint Status][ci-actions-lint-badge]][ci-actions-lint]
6+
[![CircleCI Lint Status][ci-circleci-lint-badge]][ci-circleci-lint]
7+
[![License][license-badge]][license]
8+
9+
[jet] plugin for the [asdf version manager][asdf-website].
10+
11+
</div>
12+
13+
## Contents
14+
15+
- [Dependencies](#dependencies)
16+
- [Install](#install)
17+
- [License](#license)
18+
19+
## Dependencies
20+
21+
- `bash`, `curl`, `tar`: generic POSIX utilities.
22+
23+
## Install
24+
25+
Install the plugin:
26+
27+
```shell
28+
asdf plugin add jet https://github.com/rynkowsg/asdf-jet.git
29+
```
30+
31+
Install jet:
32+
33+
```shell
34+
# Show all installable versions
35+
asdf list-all jet
36+
37+
# Install specific version
38+
asdf install jet latest
39+
40+
# Set a version globally (on your ~/.tool-versions file)
41+
asdf global jet latest
42+
43+
# Now jet tool is available
44+
jet --help
45+
```
46+
47+
Check [asdf][asdf-repo] readme for more instructions on how to install & manage versions.
48+
49+
## License
50+
51+
See [LICENSE](LICENSE) © [Grzegorz Rynkowski][gh-profile-rynkowsg]
52+
53+
[asdf-repo]: https://github.com/asdf-vm/asdf
54+
[asdf-website]: https://asdf-vm.com
55+
[ci-actions-lint-badge]: https://github.com/rynkowsg/asdf-jet/actions/workflows/lint.yml/badge.svg
56+
[ci-actions-lint]: https://github.com/rynkowsg/asdf-jet/actions/workflows/lint.yml
57+
[ci-actions-test-badge]: https://github.com/rynkowsg/asdf-jet/actions/workflows/test.yml/badge.svg
58+
[ci-actions-test]: https://github.com/rynkowsg/asdf-jet/actions/workflows/test.yml
59+
[ci-circleci-lint-badge]: https://circleci.com/gh/rynkowsg/asdf-jet.svg?style=shield
60+
[ci-circleci-lint]: https://circleci.com/gh/rynkowsg/asdf-jet
61+
[gh-profile-rynkowsg]: https://github.com/rynkowsg
62+
[jet-repo]: https://github.com/borkdude/jet
63+
[license-badge]: https://img.shields.io/badge/license-MIT-lightgrey.svg
64+
[license]: LICENSE

0 commit comments

Comments
 (0)