Skip to content

Commit

Permalink
chore: init the repository (#1)
Browse files Browse the repository at this point in the history
* feat: deal with dl url

* chore: fix format and shfmt

* chore: add a mdlinter
  • Loading branch information
looztra committed Jul 9, 2023
1 parent dbd0e71 commit 635e6c3
Show file tree
Hide file tree
Showing 19 changed files with 193 additions and 88 deletions.
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ labels: bug
assignees: ""
---

**Describe the bug**
## Describe the bug

<!-- A clear and concise description of what the bug is. -->

**Steps to reproduce**
## Steps to reproduce

<!-- Steps to reproduce the behavior: -->

**Expected behavior**
## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

**Screenshots**
## Screenshots

<!-- If applicable, add screenshots to help explain your problem. -->

**Additional context**
## Additional context

<!-- Add any other context about the problem here. -->
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ labels: enhancement
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
## Is your feature request related to a problem? Please describe

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Describe the solution you'd like**
## Describe the solution you'd like

<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered**
## Describe alternatives you've considered

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**
## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!--- Provide a general summary of your changes in the Title above -->

<!-- markdownlint-disable MD041 -->
## Description

<!--- Describe your changes in detail -->
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- main
pull_request:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
plugin_test:
name: asdf plugin test
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- main
pull_request:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -22,3 +26,9 @@ jobs:
uses: docker://rhysd/actionlint:1.6.23
with:
args: -color

mdlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DavidAnson/markdownlint-cli2-action@v11
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/semantic-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Semantic PR checks

on:
pull_request_target:
Expand All @@ -7,6 +7,10 @@ on:
- edited
- synchronize

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
semantic-pr:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
globs:
- "**/*.md"
19 changes: 19 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# For a list of all rules, see here: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md

# Default state for all rules
default: true

# MD013/line-length - Line length
MD013: false

# MD024/Multiple headings with the same content
MD024: false

# MD026/no-trailing-punctuation - Trailing punctuation in heading
MD026: false

# MD033/no-inline-html - Inline HTML
MD033: false

# MD037/Spaces inside emphasis markers
MD037: false
2 changes: 0 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
TODO: INSERT YOUR NAME COPYRIGHT YEAR (if applicable to your license)

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<div align="center">
# asdf-gofumpt

# asdf-gofumpt [![Build](https://github.com/looztra/asdf-gofumpt/actions/workflows/build.yml/badge.svg)](https://github.com/looztra/asdf-gofumpt/actions/workflows/build.yml) [![Lint](https://github.com/looztra/asdf-gofumpt/actions/workflows/lint.yml/badge.svg)](https://github.com/looztra/asdf-gofumpt/actions/workflows/lint.yml)
[![Build](https://github.com/looztra/asdf-gofumpt/actions/workflows/build.yml/badge.svg)](https://github.com/looztra/asdf-gofumpt/actions/workflows/build.yml)
[![Lint](https://github.com/looztra/asdf-gofumpt/actions/workflows/lint.yml/badge.svg)](https://github.com/looztra/asdf-gofumpt/actions/workflows/lint.yml)

[gofumpt](https://github.com/mvdan/gofumpt) plugin for the [asdf version manager](https://asdf-vm.com).

</div>

# Contents
## Contents

- [Dependencies](#dependencies)
- [Install](#install)
- [Contributing](#contributing)
- [License](#license)
- [asdf-gofumpt](#asdf-gofumpt)
- [Contents](#contents)
- [Dependencies](#dependencies)
- [Install](#install)
- [Contributing](#contributing)
- [License](#license)

# Dependencies

**TODO: adapt this section**
## Dependencies

- `bash`, `curl`, `tar`: generic POSIX utilities.
- `SOME_ENV_VAR`: set this environment variable in your shell config to load the correct version of tool x.
- `GITUB_TOKEN` set this environment variable (must be a valid [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)) in your shell config to load the correct version of tool x.

# Install
## Install

Plugin:

Expand All @@ -34,7 +35,7 @@ gofumpt:

```shell
# Show all installable versions
asdf list-all gofumpt
asdf list all gofumpt

# Install specific version
asdf install gofumpt latest
Expand All @@ -49,12 +50,12 @@ gofumpt --version
Check [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to
install & manage versions.

# Contributing
## Contributing

Contributions of any kind welcome! See the [contributing guide](contributing.md).

[Thanks goes to these contributors](https://github.com/looztra/asdf-gofumpt/graphs/contributors)!

# License
## License

See [LICENSE](LICENSE) © [Christophe Furmaniak](https://github.com/looztra/)
10 changes: 6 additions & 4 deletions bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ set -euo pipefail
current_script_path=${BASH_SOURCE[0]}
plugin_dir=$(dirname "$(dirname "$current_script_path")")

# shellcheck source=../lib/utils.bash
# shellcheck source=/dev/null
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"
# xTODO: Adapt this to proper extension and adapt extracting strategy.
release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION$(get_ext)"

# 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"
#tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file"
cp "$release_file" "$ASDF_DOWNLOAD_PATH/gofumpt"
chmod +x "$ASDF_DOWNLOAD_PATH/gofumpt"

# Remove the tar.gz file since we don't need to keep it
rm "$release_file"
2 changes: 1 addition & 1 deletion bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
current_script_path=${BASH_SOURCE[0]}
plugin_dir=$(dirname "$(dirname "$current_script_path")")

# shellcheck source=../lib/utils.bash
# shellcheck source=/dev/null
source "${plugin_dir}/lib/utils.bash"

install_version "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"
8 changes: 4 additions & 4 deletions bin/latest-stable
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ set -euo pipefail
current_script_path=${BASH_SOURCE[0]}
plugin_dir=$(dirname "$(dirname "$current_script_path")")

# shellcheck source=../lib/utils.bash
# shellcheck source=/dev/null
. "${plugin_dir}/lib/utils.bash"

curl_opts=(-sI)

if [ -n "${GITHUB_API_TOKEN:-}" ]; then
curl_opts=("${curl_opts[@]}" -H "Authorization: token $GITHUB_API_TOKEN")
curl_opts=("${curl_opts[@]}" -H "Authorization: token $GITHUB_API_TOKEN")
fi

# curl of REPO/releases/latest is expected to be a 302 to another URL
Expand All @@ -21,9 +21,9 @@ redirect_url=$(curl "${curl_opts[@]}" "$GH_REPO/releases/latest" | sed -n -e "s|
version=
printf "redirect url: %s\n" "$redirect_url" >&2
if [[ "$redirect_url" == "$GH_REPO/releases" ]]; then
version="$(list_all_versions | sort_versions | tail -n1 | xargs echo)"
version="$(list_all_versions | sort_versions | tail -n1 | xargs echo)"
else
version="$(printf "%s\n" "$redirect_url" | sed 's|.*/tag/v\{0,1\}||')"
version="$(printf "%s\n" "$redirect_url" | sed 's|.*/tag/v\{0,1\}||')"
fi

printf "%s\n" "$version"
2 changes: 1 addition & 1 deletion bin/list-all
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
current_script_path=${BASH_SOURCE[0]}
plugin_dir=$(dirname "$(dirname "$current_script_path")")

# shellcheck source=../lib/utils.bash
# shellcheck source=/dev/null
source "${plugin_dir}/lib/utils.bash"

list_all_versions | sort_versions | xargs echo
1 change: 0 additions & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Testing Locally:
```shell
asdf plugin test <plugin-name> <plugin-url> [--asdf-tool-version <version>] [--asdf-plugin-gitref <git-ref>] [test-command*]

# TODO: adapt this
asdf plugin test gofumpt https://github.com/looztra/asdf-gofumpt.git "gofumpt --version"
```

Expand Down
Loading

0 comments on commit 635e6c3

Please sign in to comment.