diff --git a/.github/PULL_REQUEST/pull_request_template.md b/.github/PULL_REQUEST/pull_request_template.md index 6d98686..a32de42 100644 --- a/.github/PULL_REQUEST/pull_request_template.md +++ b/.github/PULL_REQUEST/pull_request_template.md @@ -25,7 +25,7 @@ -## Checklist: +## Checklist diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4a10457..5ace460 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,6 @@ version: 2 updates: - # dependabot for GitHub Actions for this repo - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" - # dependabot for GitHub Actions for the template - - package-ecosystem: "github-actions" - directory: "template/.github/" - schedule: - interval: "weekly" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af3c89a..97ae66a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,8 @@ on: pull_request: jobs: - test: - name: template setup test + plugin_test: + name: asdf plugin test strategy: matrix: os: @@ -16,32 +16,7 @@ jobs: - macos-latest runs-on: ${{ matrix.os }} steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Run Template Setup - run: | - git config user.name "Foo Bearer" - ./setup.bash \ - "asdf-foo" \ - "foo --help" \ - "asdf-community" \ - "ASDF Community" \ - "https://github.com/asdf-vm/asdf" \ - "https://asdf-vm.com" \ - "Apache-2.0" \ - "yes" - - - name: Check setup result - run: | - set -xe - ls -la . - git log - test ! -d template/ - grep "Apache" LICENSE - test "main" = "$(git rev-parse --abbrev-ref HEAD)" - ! git grep -F -e "" \ - --or -e "" \ - --or -e "" \ - --or -e "" \ - --or -e "" \ - --or -e"" + - name: asdf_plugin_test + uses: asdf-vm/actions/plugin-test@v2 + with: + command: mirrord --version diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f45659d..5c3ffed 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,14 +10,14 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: asdf-vm/actions/install@v3 + - uses: actions/checkout@v3 + - uses: asdf-vm/actions/install@v2 - run: scripts/lint.bash actionlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Check workflow files uses: docker://rhysd/actionlint:1.6.23 with: diff --git a/template/.github/workflows/release.yml b/.github/workflows/release.yml similarity index 100% rename from template/.github/workflows/release.yml rename to .github/workflows/release.yml diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml index e6b3c9d..8b26fa4 100644 --- a/.github/workflows/semantic-pr.yml +++ b/.github/workflows/semantic-pr.yml @@ -11,7 +11,7 @@ jobs: semantic-pr: runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v5.4.0 + - uses: amannn/action-semantic-pull-request@v5.2.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/LICENSE b/LICENSE index 0d6f2e1..2d9b1d1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ + MIT License -Copyright (c) 2020 The asdf-vm core AUTHORS +Copyright (c) 2024 MetalBear Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 85f6a99..c144d79 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,59 @@ -# 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) +
-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). +# asdf-mirrord [![Build](https://github.com/infiniteregrets/asdf-mirrord/actions/workflows/build.yml/badge.svg)](https://github.com/infiniteregrets/asdf-mirrord/actions/workflows/build.yml) [![Lint](https://github.com/infiniteregrets/asdf-mirrord/actions/workflows/lint.yml/badge.svg)](https://github.com/infiniteregrets/asdf-mirrord/actions/workflows/lint.yml) -## Usage +[mirrord](https://mirrord.dev/) plugin for the [asdf version manager](https://asdf-vm.com). -1. [Generate](https://github.com/asdf-vm/asdf-plugin-template/generate) a new repository based on this template. -1. Clone it and run `bash setup.bash`. -1. Force push to your repo: `git push --force-with-lease`. -1. Adapt your code at the TODO markers. To find the markers: `git grep TODO`. -1. To develop your plugin further, please read [the plugins create section of the docs](https://asdf-vm.com/plugins/create.html). +
->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). +# Contents -## Contributing +- [asdf-mirrord](#asdf-mirrord--) +- [Dependencies](#dependencies) +- [Install](#install) +- [Contributing](#contributing) +- [License](#license) -Contributions welcome! +# Dependencies -1. Install `asdf` tools +- `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html). +- mirrord has OS specific binaries and are downloaded on the basis `OSTYPE` for determining the OS and `uname` for the architecture. - ```shell - asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git - asdf plugin add shfmt https://github.com/luizm/asdf-shfmt.git - asdf install - ``` +# Install -1. Develop! +Plugin: -1. Lint & Format +```shell +asdf plugin add mirrord +# or +asdf plugin add mirrord https://github.com/infiniteregrets/asdf-mirrord.git +``` - ```shell - ./scripts/format.bash - ./scripts/lint.bash - ``` +mirrord: -1. PR changes +```shell +# Show all installable versions +asdf list-all mirrord + +# Install specific version +asdf install mirrord latest + +# Set a version globally (on your ~/.tool-versions file) +asdf global mirrord latest + +# Now mirrord commands are available +mirrord --version +``` + +Check [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to +install & manage versions. + +# Contributing + +Contributions of any kind welcome! See the [contributing guide](contributing.md). + +[Thanks goes to these contributors](https://github.com/infiniteregrets/asdf-mirrord/graphs/contributors)! + +# License + +See [LICENSE](LICENSE) © [MetalBear](https://github.com/metalbear-co/) diff --git a/template/bin/download b/bin/download similarity index 55% rename from template/bin/download rename to bin/download index c11ee53..8d1e01b 100755 --- a/template/bin/download +++ b/bin/download @@ -11,13 +11,15 @@ source "${plugin_dir}/lib/utils.bash" mkdir -p "$ASDF_DOWNLOAD_PATH" # TODO: Adapt this to proper extension and adapt extracting strategy. -release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz" +release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME" # Download tar.gz file to the download directory download_release "$ASDF_INSTALL_VERSION" "$release_file" -# Extract contents of tar.gz file into the download directory -tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file" +echo "asdf download path is $ASDF_DOWNLOAD_PATH" -# Remove the tar.gz file since we don't need to keep it -rm "$release_file" +# # Extract contents of tar.gz file into the download directory +# cp "$release_file" "$ASDF_DOWNLOAD_PATH" || fail "Could not copy $release_file to $ASDF_DOWNLOAD_PATH" + +# # Remove the tar.gz file since we don't need to keep it +# rm "$release_file" diff --git a/template/bin/install b/bin/install similarity index 100% rename from template/bin/install rename to bin/install diff --git a/template/bin/latest-stable b/bin/latest-stable similarity index 100% rename from template/bin/latest-stable rename to bin/latest-stable diff --git a/template/bin/list-all b/bin/list-all similarity index 100% rename from template/bin/list-all rename to bin/list-all diff --git a/template/contributing-github.md b/contributing.md similarity index 65% rename from template/contributing-github.md rename to contributing.md index 3e3e4be..1611647 100644 --- a/template/contributing-github.md +++ b/contributing.md @@ -5,8 +5,7 @@ Testing Locally: ```shell asdf plugin test [--asdf-tool-version ] [--asdf-plugin-gitref ] [test-command*] -# TODO: adapt this -asdf plugin test https://github.com//asdf-.git "" +asdf plugin test mirrord https://github.com/infiniteregrets/asdf-mirrord.git "mirrord --version" ``` Tests are automatically run in GitHub Actions on push and PR. diff --git a/template/lib/utils.bash b/lib/utils.bash old mode 100755 new mode 100644 similarity index 55% rename from template/lib/utils.bash rename to lib/utils.bash index 887708c..0b53ec9 --- a/template/lib/utils.bash +++ b/lib/utils.bash @@ -2,10 +2,9 @@ set -euo pipefail -# TODO: Ensure this is the correct GitHub homepage where releases can be downloaded for . -GH_REPO="" -TOOL_NAME="" -TOOL_TEST="" +GH_REPO="https://github.com/metalbear-co/mirrord" +TOOL_NAME="mirrord" +TOOL_TEST="mirrord --version" fail() { echo -e "asdf-$TOOL_NAME: $*" @@ -14,11 +13,6 @@ fail() { curl_opts=(-fsSL) -# NOTE: You might want to remove this if is not hosted on GitHub releases. -if [ -n "${GITHUB_API_TOKEN:-}" ]; then - curl_opts=("${curl_opts[@]}" -H "Authorization: token $GITHUB_API_TOKEN") -fi - sort_versions() { sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' | LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}' @@ -27,25 +21,36 @@ sort_versions() { list_github_tags() { git ls-remote --tags --refs "$GH_REPO" | grep -o 'refs/tags/.*' | cut -d/ -f3- | - sed 's/^v//' # NOTE: You might want to adapt this sed to remove non-version strings from tags + sed 's/^v//' } list_all_versions() { - # TODO: Adapt this. By default we simply list the tag names from GitHub releases. - # Change this function if has other means of determining installable versions. list_github_tags } download_release() { - local version filename url + local version filename version="$1" filename="$2" - # TODO: Adapt the release URL convention for - url="$GH_REPO/archive/v${version}.tar.gz" - echo "* Downloading $TOOL_NAME release $version..." - curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url" + if [[ "$OSTYPE" == "linux"* ]]; then + ARCH=$(uname -m) + OS="linux" + if [[ "$ARCH" != "x86_64" && "$ARCH" != "aarch64" ]]; then + echo "mirrord is only available for linux x86_64/aarch64 architecture" + file_issue_prompt + exit 1 + fi + elif [[ "$OSTYPE" == "darwin"* ]]; then + ARCH="universal" + OS="mac" + else + echo "mirrord isn't supported for your platform - $OSTYPE" + file_issue_prompt + exit 1 + fi + curl "${curl_opts[@]}" -o "$filename" -C - https://github.com/metalbear-co/mirrord/releases/download/"$version"/mirrord_$OS\_"$ARCH" || fail "Could not download mirrord" } install_version() { @@ -56,14 +61,13 @@ install_version() { if [ "$install_type" != "version" ]; then fail "asdf-$TOOL_NAME supports release installs only" fi - ( mkdir -p "$install_path" cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path" - # TODO: Assert executable exists. local tool_cmd tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)" + chmod +x "$install_path/$tool_cmd" test -x "$install_path/$tool_cmd" || fail "Expected $install_path/$tool_cmd to be executable." echo "$TOOL_NAME $version installation was successful!" diff --git a/scripts/format.bash b/scripts/format.bash index bbeed6c..1a216ea 100755 --- a/scripts/format.bash +++ b/scripts/format.bash @@ -1,10 +1,4 @@ #!/usr/bin/env bash -# format this repo shfmt --language-dialect bash --write \ - setup.bash \ - scripts/*.bash - -# format the template/ -shfmt --language-dialect bash --write \ - template/**/* + ./**/* diff --git a/scripts/lint.bash b/scripts/lint.bash index fbd0c5c..3451a05 100755 --- a/scripts/lint.bash +++ b/scripts/lint.bash @@ -1,19 +1,9 @@ #!/usr/bin/env bash -# lint this repo shellcheck --shell=bash --external-sources \ - setup.bash \ + bin/* --source-path=template/lib/ \ + lib/* \ scripts/* shfmt --language-dialect bash --diff \ - setup.bash \ - scripts/* - -# lint the template/ -shellcheck --shell=bash --external-sources \ - template/bin/* --source-path=template/lib/ \ - template/lib/* \ - template/scripts/* - -shfmt --language-dialect bash --diff \ - template/**/* + ./**/* diff --git a/setup.bash b/setup.bash deleted file mode 100755 index bfa2884..0000000 --- a/setup.bash +++ /dev/null @@ -1,314 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -HELP=" -Usage: - -bash [--github | --gitlab] $0 PLUGIN_NAME TOOL_TEST GH_USER AUTHOR_NAME TOOL_GH TOOL_PAGE LICENSE - -All arguments are optional and will be interactively prompted when not given. - -PLUGIN_NAME. - A name for your new plugin always starting with \`asdf-\` prefix. - -TOOL_TEST. - A shell command used to test correct installation. - Normally this command is something taking \`--version\` or \`--help\`. - -GH_USER. - Your GitHub/GitLab username. - -AUTHOR_NAME. - Your name, used for licensing. - -TOOL_GH. - The tool's GitHub homepage. Default installation process will try to use - this to access GitHub releases. - -TOOL_PAGE. - Documentation site for tool usage, mostly informative for users. - -LICENSE. - A license keyword. - https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository#searching-github-by-license-type -" -HELP_PLUGIN_NAME="Name for your plugin, starting with \`asdf-\`, eg. \`asdf-foo\`" -HELP_TOOL_CHECK="Shell command for testing correct tool installation. eg. \`foo --version\` or \`foo --help\`" -HELP_TOOL_REPO="The tool's GitHub homepage." -HELP_TOOL_HOMEPAGE="The tool's documentation homepage if necessary." - -ask_for() { - local prompt="$1" - local default_value="${2:-}" - local alternatives="${3:-"[$default_value]"}" - local value="" - - while [ -z "$value" ]; do - echo "$prompt" >&2 - if [ "[]" != "$alternatives" ]; then - echo -n "$alternatives " >&2 - fi - echo -n "> " >&2 - read -r value - echo >&2 - if [ -z "$value" ] && [ -n "$default_value" ]; then - value="$default_value" - fi - done - - printf "%s\n" "$value" -} - -download_license() { - local keyword file - keyword="$1" - file="$2" - - curl -qsL "https://raw.githubusercontent.com/github/choosealicense.com/gh-pages/_licenses/${keyword}.txt" | - extract_license >"$file" -} - -extract_license() { - awk '/^---/{f=1+f} f==2 && /^$/ {f=3} f==3' -} - -test_url() { - curl -fqsL -I "$1" | head -n 1 | grep 200 >/dev/null -} - -ask_license() { - local license keyword - - printf "%s\n" "Please choose a LICENSE keyword." >&2 - printf "%s\n" "See available license keywords at" >&2 - printf "%s\n" "https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository#searching-github-by-license-type" >&2 - - while true; do - license="$(ask_for "License keyword:" "APACHE-2.0" "MIT/APACHE-2.0/MPL-2.0/AGPL-3.0")" - keyword=$(echo "$license" | tr '[:upper:]' '[:lower:]') - - url="https://choosealicense.com/licenses/$keyword/" - if test_url "$url"; then - break - else - printf "Invalid license keyword: %s\n" "$license" - fi - done - - printf "%s\n" "$keyword" -} - -set_placeholder() { - local name value out file tmpfile - name="$1" - value="$2" - out="$3" - - git grep -P -l -F --untracked "$name" -- "$out" | - while IFS=$'\n' read -r file; do - tmpfile="$file.sed" - sed "s#$name#$value#g" "$file" >"$tmpfile" && mv "$tmpfile" "$file" - done -} - -setup_github() { - local cwd out tool_name tool_repo check_command author_name github_username tool_homepage ok primary_branch - - cwd="$PWD" - out="$cwd/out" - - # ask for arguments not given via CLI - tool_name="${1:-$(ask_for "$HELP_PLUGIN_NAME")}" - tool_name="${tool_name/asdf-/}" - check_command="${2:-$(ask_for "$HELP_TOOL_CHECK" "$tool_name --help")}" - - github_username="${3:-$(ask_for "Your GitHub username")}" - author_name="${4:-$(ask_for "Your name" "$(git config user.name 2>/dev/null)")}" - - tool_repo="${5:-$(ask_for "$HELP_TOOL_REPO" "https://github.com/$github_username/$tool_name")}" - tool_homepage="${6:-$(ask_for "$HELP_TOOL_HOMEPAGE" "$tool_repo")}" - license_keyword="${7:-$(ask_license)}" - license_keyword="$(echo "$license_keyword" | tr '[:upper:]' '[:lower:]')" - - primary_branch="main" - - cat <<-EOF - Setting up plugin: asdf-$tool_name - - author: $author_name - plugin repo: https://github.com/$github_username/asdf-$tool_name - license: https://choosealicense.com/licenses/$license_keyword/ - - - $tool_name github: $tool_repo - $tool_name docs: $tool_homepage - $tool_name test: \`$check_command\` - - After confirmation, the \`$primary_branch\` will be replaced with the generated - template using the above information. Please ensure all seems correct. - EOF - - ok="${8:-$(ask_for "Type \`yes\` if you want to continue.")}" - if [ "yes" != "$ok" ]; then - printf "Nothing done.\n" - else - ( - set -e - # previous cleanup to ensure we can run this program many times - git branch template 2>/dev/null || true - git checkout -f template - git worktree remove -f out 2>/dev/null || true - git branch -D out 2>/dev/null || true - - # checkout a new worktree and replace placeholders there - git worktree add --detach out - - cd "$out" - git checkout --orphan out - git rm -rf "$out" >/dev/null - git read-tree --prefix="" -u template:template/ - - download_license "$license_keyword" "$out/LICENSE" - sed -i '1s;^;TODO: INSERT YOUR NAME & COPYRIGHT YEAR (if applicable to your license)\n;g' "$out/LICENSE" - - set_placeholder "" "$tool_name" "$out" - set_placeholder "" "$tool_homepage" "$out" - set_placeholder "" "$tool_repo" "$out" - set_placeholder "" "$check_command" "$out" - set_placeholder "" "$author_name" "$out" - set_placeholder "" "$github_username" "$out" - set_placeholder "" "$primary_branch" "$out" - - git add "$out" - # remove GitLab specific files - git rm -rf "$out/.gitlab" "$out/.gitlab-ci.yml" "$out/README-gitlab.md" "$out/contributing-gitlab.md" - # rename GitHub specific files to final filenames - git mv "$out/README-github.md" "$out/README.md" - git mv "$out/contributing-github.md" "$out/contributing.md" - git commit -m "Generate asdf-$tool_name plugin from template." - - cd "$cwd" - git branch -M out "$primary_branch" - git worktree remove -f out - git checkout -f "$primary_branch" - - printf "All done.\n" - printf "Your %s branch has been reset to an initial commit.\n" "$primary_branch" - printf "Push to origin/%s with \`git push --force-with-lease\`\n" "$primary_branch" - - printf "Review these TODO items:\n" - git grep -P -n -C 3 "TODO" - ) || cd "$cwd" - fi -} - -setup_gitlab() { - local cwd out tool_name tool_repo check_command author_name github_username gitlab_username tool_homepage ok primary_branch - - cwd="$PWD" - out="$cwd/out" - - # ask for arguments not given via CLI - tool_name="${1:-$(ask_for "$HELP_PLUGIN_NAME")}" - tool_name="${tool_name/asdf-/}" - check_command="${2:-$(ask_for "$HELP_TOOL_CHECK" "$tool_name --help")}" - - gitlab_username="$(ask_for "Your GitLab username")" - author_name="${4:-$(ask_for "Your name" "$(git config user.name 2>/dev/null)")}" - - github_username="${3:-$(ask_for "Tool GitHub username")}" - tool_repo="${5:-$(ask_for "$HELP_TOOL_REPO" "https://github.com/$github_username/$tool_name")}" - tool_homepage="${6:-$(ask_for "$HELP_TOOL_HOMEPAGE" "$tool_repo")}" - license_keyword="${7:-$(ask_license)}" - license_keyword="$(echo "$license_keyword" | tr '[:upper:]' '[:lower:]')" - - primary_branch="main" - - cat <<-EOF - Setting up plugin: asdf-$tool_name - - author: $author_name - plugin repo: https://gitlab.com/$gitlab_username/asdf-$tool_name - license: https://choosealicense.com/licenses/$license_keyword/ - - - $tool_name github: $tool_repo - $tool_name docs: $tool_homepage - $tool_name test: \`$check_command\` - - After confirmation, the \`$primary_branch\` will be replaced with the generated - template using the above information. Please ensure all seems correct. - EOF - - ok="${8:-$(ask_for "Type \`yes\` if you want to continue.")}" - if [ "yes" != "$ok" ]; then - printf "Nothing done.\n" - else - ( - set -e - # previous cleanup to ensure we can run this program many times - git branch template 2>/dev/null || true - git checkout -f template - git worktree remove -f out 2>/dev/null || true - git branch -D out 2>/dev/null || true - - # checkout a new worktree and replace placeholders there - git worktree add --detach out - - cd "$out" - git checkout --orphan out - git rm -rf "$out" >/dev/null - git read-tree --prefix=/ -u template:template/ - - download_license "$license_keyword" "$out/LICENSE" - - set_placeholder "" "$tool_name" "$out" - set_placeholder "" "$tool_homepage" "$out" - set_placeholder "" "$tool_repo" "$out" - set_placeholder "" "$check_command" "$out" - set_placeholder "" "$author_name" "$out" - set_placeholder "" "$github_username" "$out" - set_placeholder "" "$gitlab_username" "$out" - set_placeholder "" "$primary_branch" "$out" - - git add "$out" - # remove GitHub specific files - git rm -rf "$out/.github" "$out/README-github.md" "$out/contributing-github.md" - # rename GitLab specific files to final filenames - git mv "$out/README-gitlab.md" "$out/README.md" - git mv "$out/contributing-gitlab.md" "$out/contributing.md" - git commit -m "Generate asdf-$tool_name plugin from template." - - cd "$cwd" - git branch -M out "$primary_branch" - git worktree remove -f out - git checkout -f "$primary_branch" - - printf "All done.\n" - printf "Your %s branch has been reset to an initial commit.\n" "$primary_branch" - printf "You might want to push using \`--force-with-lease\` to origin/%s\n" "$primary_branch" - - printf "Showing pending TODO tags that you might want to review\n" - git grep -P -n -C 3 "TODO" - ) || cd "$cwd" - fi -} - -case "${1:-}" in -"-h" | "--help" | "help") - printf "%s\n" "$HELP" - exit 0 - ;; -"--gitlab") - shift - setup_gitlab "$@" - ;; -"--github") - shift - setup_github "$@" - ;; -*) - setup_github "$@" - ;; -esac diff --git a/template/.editorconfig b/template/.editorconfig deleted file mode 100644 index 16bec6a..0000000 --- a/template/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*] -indent_style = tab -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.{md,yml,yaml}] -indent_style = space -indent_size = 2 diff --git a/template/.github/ISSUE_TEMPLATE/bug_report.md b/template/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 83f93ac..0000000 --- a/template/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "" -labels: bug -assignees: "" ---- - -**Describe the bug** - - - -**Steps to reproduce** - - - -**Expected behavior** - - - -**Screenshots** - - - -**Additional context** - - diff --git a/template/.github/ISSUE_TEMPLATE/feature_request.md b/template/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index f52b3b9..0000000 --- a/template/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "" -labels: enhancement -assignees: "" ---- - -**Is your feature request related to a problem? Please describe.** - - - -**Describe the solution you'd like** - - - -**Describe alternatives you've considered** - - - -**Additional context** - - diff --git a/template/.github/PULL_REQUEST/pull_request_template.md b/template/.github/PULL_REQUEST/pull_request_template.md deleted file mode 100644 index a32de42..0000000 --- a/template/.github/PULL_REQUEST/pull_request_template.md +++ /dev/null @@ -1,34 +0,0 @@ - - -## Description - - - -## Motivation and Context - - - - -## Types of changes - - - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to change) - -## Usage examples - - - -## How Has This Been Tested? - - - -## Checklist - - - - -- [ ] I have updated the documentation accordingly. -- [ ] I have added tests to cover my changes. diff --git a/template/.github/dependabot.yml b/template/.github/dependabot.yml deleted file mode 100644 index 5ace460..0000000 --- a/template/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" diff --git a/template/.github/workflows/build.yml b/template/.github/workflows/build.yml deleted file mode 100644 index d58fe52..0000000 --- a/template/.github/workflows/build.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Build - -on: - push: - branches: - - main - pull_request: - -jobs: - plugin_test: - name: asdf plugin test - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest - runs-on: ${{ matrix.os }} - steps: - - name: asdf_plugin_test - uses: asdf-vm/actions/plugin-test@v2 - with: - command: diff --git a/template/.github/workflows/lint.yml b/template/.github/workflows/lint.yml deleted file mode 100644 index 5c3ffed..0000000 --- a/template/.github/workflows/lint.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Lint - -on: - push: - branches: - - main - pull_request: - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: asdf-vm/actions/install@v2 - - run: scripts/lint.bash - - actionlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Check workflow files - uses: docker://rhysd/actionlint:1.6.23 - with: - args: -color diff --git a/template/.github/workflows/semantic-pr.yml b/template/.github/workflows/semantic-pr.yml deleted file mode 100644 index 8b26fa4..0000000 --- a/template/.github/workflows/semantic-pr.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Lint - -on: - pull_request_target: - types: - - opened - - edited - - synchronize - -jobs: - semantic-pr: - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@v5.2.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - validateSingleCommit: true diff --git a/template/.gitlab-ci.yml b/template/.gitlab-ci.yml deleted file mode 100644 index dc3617c..0000000 --- a/template/.gitlab-ci.yml +++ /dev/null @@ -1,30 +0,0 @@ -image: debian:10 - -stages: - - lint - - test - -variables: - PLUGIN_NAME: asdf- - TOOL_CHECK: - SHELLCHECK_VERSION: stable - -asdf-plugin-lint: - stage: lint - before_script: - - apt update && apt install -y xz-utils wget - - wget -qO- https://github.com/koalaman/shellcheck/releases/download/$SHELLCHECK_VERSION/shellcheck-$SHELLCHECK_VERSION.linux.x86_64.tar.xz | tar xJv - - cp shellcheck-$SHELLCHECK_VERSION/shellcheck /usr/bin - script: - - shellcheck -x bin/* -P lib/ - -asdf-plugin-test: - stage: test - before_script: - - apt update && apt install -y git curl bsdmainutils file - - git clone https://github.com/asdf-vm/asdf.git - - . asdf/asdf.sh - script: - - asdf plugin-add $PLUGIN_NAME $CI_REPOSITORY_URL - - asdf list-all $PLUGIN_NAME - - asdf plugin test $PLUGIN_NAME $CI_REPOSITORY_URL --asdf-plugin-gitref $CI_COMMIT_REF_NAME "$TOOL_CHECK" || exit 1 diff --git a/template/.gitlab/issue_templates/Bug_Report.md b/template/.gitlab/issue_templates/Bug_Report.md deleted file mode 100644 index c42f6c9..0000000 --- a/template/.gitlab/issue_templates/Bug_Report.md +++ /dev/null @@ -1,21 +0,0 @@ -## Describe the bug - - - -## Steps to reproduce - - - -## Expected behavior - - - -## Screenshots - - - -## Additional context - - - -/label ~bug diff --git a/template/.gitlab/issue_templates/Feature_Request.md b/template/.gitlab/issue_templates/Feature_Request.md deleted file mode 100644 index 759f534..0000000 --- a/template/.gitlab/issue_templates/Feature_Request.md +++ /dev/null @@ -1,18 +0,0 @@ -## Feature description - -- [ ] Is this feature the result of a problem? - - -## Desired solution - - - -## Alternatives considered - - - -## Additional context - - - -/label ~"feature request" diff --git a/template/.gitlab/merge_request_templates/Merge_Request.md b/template/.gitlab/merge_request_templates/Merge_Request.md deleted file mode 100644 index a32de42..0000000 --- a/template/.gitlab/merge_request_templates/Merge_Request.md +++ /dev/null @@ -1,34 +0,0 @@ - - -## Description - - - -## Motivation and Context - - - - -## Types of changes - - - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to change) - -## Usage examples - - - -## How Has This Been Tested? - - - -## Checklist - - - - -- [ ] I have updated the documentation accordingly. -- [ ] I have added tests to cover my changes. diff --git a/template/.tool-versions b/template/.tool-versions deleted file mode 100644 index 3d11f88..0000000 --- a/template/.tool-versions +++ /dev/null @@ -1,2 +0,0 @@ -shellcheck 0.9.0 -shfmt 3.6.0 diff --git a/template/README-github.md b/template/README-github.md deleted file mode 100644 index 30a471f..0000000 --- a/template/README-github.md +++ /dev/null @@ -1,60 +0,0 @@ -
- -# asdf- [![Build](https://github.com//asdf-/actions/workflows/build.yml/badge.svg)](https://github.com//asdf-/actions/workflows/build.yml) [![Lint](https://github.com//asdf-/actions/workflows/lint.yml/badge.svg)](https://github.com//asdf-/actions/workflows/lint.yml) - -[]() plugin for the [asdf version manager](https://asdf-vm.com). - -
- -# Contents - -- [Dependencies](#dependencies) -- [Install](#install) -- [Contributing](#contributing) -- [License](#license) - -# Dependencies - -**TODO: adapt this section** - -- `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html). -- `SOME_ENV_VAR`: set this environment variable in your shell config to load the correct version of tool x. - -# Install - -Plugin: - -```shell -asdf plugin add -# or -asdf plugin add https://github.com//asdf-.git -``` - -: - -```shell -# Show all installable versions -asdf list-all - -# Install specific version -asdf install latest - -# Set a version globally (on your ~/.tool-versions file) -asdf global latest - -# Now commands are available - -``` - -Check [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to -install & manage versions. - -# Contributing - -Contributions of any kind welcome! See the [contributing guide](contributing.md). - -[Thanks goes to these contributors](https://github.com//asdf-/graphs/contributors)! - -# License - -See [LICENSE](LICENSE) © [](https://github.com//) diff --git a/template/README-gitlab.md b/template/README-gitlab.md deleted file mode 100644 index 367bb6a..0000000 --- a/template/README-gitlab.md +++ /dev/null @@ -1,60 +0,0 @@ -
- -# asdf- ![Build Status](https://gitlab.com//asdf-/badges//pipeline.svg) - -[]() plugin for the [asdf version manager](https://asdf-vm.com). - -
- -# Contents - -- [Dependencies](#dependencies) -- [Install](#install) -- [Contributing](#contributing) -- [License](#license) - -# Dependencies - -**TODO: adapt this section** - -- `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html). -- `SOME_ENV_VAR`: set this environment variable in your shell config to load the correct version of tool x. - -# Install - -Plugin: - -```shell -asdf plugin add -# or -asdf plugin add https://gitlab.com//asdf-.git -``` - -: - -```shell -# Show all installable versions -asdf list-all - -# Install specific version -asdf install latest - -# Set a version globally (on your ~/.tool-versions file) -asdf global latest - -# Now commands are available - -``` - -Check [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to -install & manage versions. - -# Contributing - -Contributions of any kind welcome! See the [contributing guide](contributing.md). - -[Thanks goes to these contributors](https://gitlab.com//asdf-/-/graphs/)! - -# License - -See [LICENSE](LICENSE) © [](https://gitlab.com//) diff --git a/template/contributing-gitlab.md b/template/contributing-gitlab.md deleted file mode 100644 index 551901d..0000000 --- a/template/contributing-gitlab.md +++ /dev/null @@ -1,12 +0,0 @@ -# Contributing - -Testing Locally: - -```shell -asdf plugin test [--asdf-tool-version ] [--asdf-plugin-gitref ] [test-command*] - -# TODO: adapt this -asdf plugin test https://gitlab.com//asdf-.git "" -``` - -Tests are automatically run in GitLab CI on push and merge request. diff --git a/template/scripts/format.bash b/template/scripts/format.bash deleted file mode 100755 index 1a216ea..0000000 --- a/template/scripts/format.bash +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -shfmt --language-dialect bash --write \ - ./**/* diff --git a/template/scripts/lint.bash b/template/scripts/lint.bash deleted file mode 100755 index 3451a05..0000000 --- a/template/scripts/lint.bash +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -shellcheck --shell=bash --external-sources \ - bin/* --source-path=template/lib/ \ - lib/* \ - scripts/* - -shfmt --language-dialect bash --diff \ - ./**/* diff --git a/template/version.txt b/template/version.txt deleted file mode 100644 index e69de29..0000000