Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Commit c3f9c36

Browse files
committed
initial commit after template migration
1 parent 1c25f32 commit c3f9c36

38 files changed

+213
-935
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,16 @@ on:
77
pull_request:
88

99
jobs:
10-
test:
11-
name: template setup test
10+
plugin_test:
11+
name: asdf plugin test
1212
strategy:
1313
matrix:
1414
os:
1515
- ubuntu-latest
1616
- macos-latest
1717
runs-on: ${{ matrix.os }}
1818
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v4
21-
- name: Run Template Setup
22-
run: |
23-
git config user.name "Foo Bearer"
24-
./setup.bash \
25-
"asdf-foo" \
26-
"foo --help" \
27-
"asdf-community" \
28-
"ASDF Community" \
29-
"https://github.com/asdf-vm/asdf" \
30-
"https://asdf-vm.com" \
31-
"Apache-2.0" \
32-
"yes"
33-
34-
- name: Check setup result
35-
run: |
36-
set -xe
37-
ls -la .
38-
git log
39-
test ! -d template/
40-
grep "Apache" LICENSE
41-
test "main" = "$(git rev-parse --abbrev-ref HEAD)"
42-
! git grep -F -e "<YOUR TOOL>" \
43-
--or -e "<TOOL HOMEPAGE>" \
44-
--or -e "<TOOL REPO>" \
45-
--or -e "<TOOL CHECK>" \
46-
--or -e "<YOUR NAME>" \
47-
--or -e"<YOUR GITHUB USERNAME>"
19+
- name: asdf_plugin_test
20+
uses: asdf-vm/actions/plugin-test@v4
21+
with:
22+
command: <TOOL CHECK>

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- uses: asdf-vm/actions/install@v3
14+
- uses: asdf-vm/actions/install@v4
1515
- run: scripts/lint.bash
1616

1717
actionlint:

.github/workflows/semantic-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
semantic-pr:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: amannn/action-semantic-pull-request@v5.4.0
14+
- uses: amannn/action-semantic-pull-request@v5.5.3
1515
env:
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1717
with:

README.md

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,58 @@
1-
# asdf-plugin-template [![Build](https://github.com/asdf-vm/asdf-plugin-template/actions/workflows/build.yml/badge.svg)](https://github.com/asdf-vm/asdf-plugin-template/actions/workflows/build.yml) [![Lint](https://github.com/asdf-vm/asdf-plugin-template/actions/workflows/lint.yml/badge.svg)](https://github.com/asdf-vm/asdf-plugin-template/actions/workflows/lint.yml)
1+
<div align="center">
22

3-
This is an [asdf-vm plugin](https://asdf-vm.com/#/plugins-create) template with CI to run [Shellcheck](https://github.com/koalaman/shellcheck) and testing with the [asdf test GitHub Action](https://github.com/asdf-vm/actions).
3+
# asdf-zig [![Build](https://github.com/jiacai2050/asdf-zig/actions/workflows/build.yml/badge.svg)](https://github.com/jiacai2050/asdf-zig/actions/workflows/build.yml) [![Lint](https://github.com/jiacai2050/asdf-zig/actions/workflows/lint.yml/badge.svg)](https://github.com/jiacai2050/asdf-zig/actions/workflows/lint.yml)
44

5-
## Usage
5+
[asdf-zig](https://github.com/jiacai2050/asdf-zig) plugin for the [asdf version manager](https://asdf-vm.com).
66

7-
1. [Generate](https://github.com/asdf-vm/asdf-plugin-template/generate) a new repository based on this template.
8-
1. Clone it and run `bash setup.bash`.
9-
1. Force push to your repo: `git push --force-with-lease`.
10-
1. Adapt your code at the TODO markers. To find the markers: `git grep TODO`.
11-
1. To develop your plugin further, please read [the plugins create section of the docs](https://asdf-vm.com/plugins/create.html).
7+
</div>
128

13-
>A feature of this plugin-template when hosted on GitHub is the use of [release-please](https://github.com/googleapis/release-please), an automated release tool. It leverages [Conventional Commit messages](https://www.conventionalcommits.org/) to determine semver release type, see the [documentation](https://github.com/googleapis/release-please).
9+
# Contents
1410

15-
## Contributing
11+
- [Dependencies](#dependencies)
12+
- [Install](#install)
13+
- [Contributing](#contributing)
14+
- [License](#license)
1615

17-
Contributions welcome!
16+
# Dependencies
1817

19-
1. Install `asdf` tools
18+
**TODO: adapt this section**
2019

21-
```shell
22-
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git
23-
asdf plugin add shfmt https://github.com/luizm/asdf-shfmt.git
24-
asdf install
25-
```
20+
- `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html).
21+
- `SOME_ENV_VAR`: set this environment variable in your shell config to load the correct version of tool x.
2622

27-
1. Develop!
23+
# Install
2824

29-
1. Lint & Format
25+
Plugin:
3026

31-
```shell
32-
./scripts/format.bash
33-
./scripts/lint.bash
34-
```
27+
```shell
28+
asdf plugin add zig https://github.com/jiacai2050/asdf-zig.git
29+
```
3530

36-
1. PR changes
31+
asdf-zig:
32+
33+
```shell
34+
# Show all installable versions
35+
asdf list-all zig
36+
37+
# Install specific version
38+
asdf install zig latest
39+
40+
# Set a version globally (on your ~/.tool-versions file)
41+
asdf global zig latest
42+
43+
# Now asdf-zig commands are available
44+
zig version
45+
```
46+
47+
Check [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to
48+
install & manage versions.
49+
50+
# Contributing
51+
52+
Contributions of any kind welcome! See the [contributing guide](contributing.md).
53+
54+
[Thanks goes to these contributors](https://github.com/jiacai2050/asdf-zig/graphs/contributors)!
55+
56+
# License
57+
58+
See [LICENSE](LICENSE) © [jiacai2050](https://github.com/jiacai2050/)

template/bin/download renamed to bin/download

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ source "${plugin_dir}/lib/utils.bash"
1010

1111
mkdir -p "$ASDF_DOWNLOAD_PATH"
1212

13-
# TODO: Adapt this to proper extension and adapt extracting strategy.
14-
release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"
13+
release_file="${ASDF_DOWNLOAD_PATH}/${TOOL_NAME}-${ASDF_INSTALL_VERSION}.tar.xz"
1514

1615
# Download tar.gz file to the download directory
17-
download_release "$ASDF_INSTALL_VERSION" "$release_file"
16+
"${plugin_dir}/lib/utils.py" "${ASDF_INSTALL_VERSION}" "${release_file}"
1817

1918
# Extract contents of tar.gz file into the download directory
2019
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file"

bin/install

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
current_script_path=${BASH_SOURCE[0]}
6+
plugin_dir=$(dirname "$(dirname "$current_script_path")")
7+
8+
# shellcheck source=./lib/utils.bash
9+
source "${plugin_dir}/lib/utils.bash"
10+
11+
install_version() {
12+
local install_type="$1"
13+
local version="$2"
14+
local install_path="${3%/bin}/bin"
15+
16+
if [ "$install_type" != "version" ]; then
17+
fail "asdf-$TOOL_NAME supports release installs only"
18+
fi
19+
20+
(
21+
mkdir -p "$install_path"
22+
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"
23+
24+
# TODO: Assert <YOUR TOOL> executable exists.
25+
local tool_cmd
26+
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"
27+
test -x "$install_path/$tool_cmd" || fail "Expected $install_path/$tool_cmd to be executable."
28+
29+
echo "$TOOL_NAME $version installation was successful!"
30+
) || (
31+
rm -rf "$install_path"
32+
fail "An error occurred while installing $TOOL_NAME $version."
33+
)
34+
}
35+
36+
install_version "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"

bin/latest-stable

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
6+
"${SCRIPT_DIR}/../lib/utils.py" latest-version

bin/list-all

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
6+
"${SCRIPT_DIR}/../lib/utils.py" all-versions
File renamed without changes.

0 commit comments

Comments
 (0)