Skip to content

Commit

Permalink
fix: deal with version >= 0.26.0 (#6)
Browse files Browse the repository at this point in the history
* refactor: use new scripts

* fix: update for v0.26.x

* fixup

* fixup

* fixup

* chore: cleanup files

* chore: cleanup editorconfig config

* test: add more bats tests
  • Loading branch information
looztra authored May 24, 2024
1 parent 592cf29 commit 10ee87a
Show file tree
Hide file tree
Showing 14 changed files with 431 additions and 254 deletions.
68 changes: 68 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true

# 4 space indentation
# don't check for max_line_length, rely on pylint
[*.py]
indent_style = space
indent_size = 4
max_line_length = unset

[Makefile]
indent_style = tab
max_line_length = unset

[*.mk]
indent_style = tab
max_line_length = unset

[setup.cfg]
indent_style = tab

[*.{tf,tfvars}]
indent_size = 2
indent_style = space
max_line_length = unset

[*.{yml,yaml}]
indent_size = 2
indent_style = space
max_line_length = unset

# Fix for json files
[*.json]
max_line_length = unset

[*.md]
trim_trailing_whitespace = false
max_line_length = unset
indent_size = unset

[*.sh]
max_line_length = unset

[LICENSE]
max_line_length = unset
indent_style = unset
indent_size = unset

[*.txt]
max_line_length = unset

[*.js]
max_line_length = unset

[*.{bats,bash}]
max_line_length = unset
44 changes: 22 additions & 22 deletions .github/workflows/aio.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
---
name: AllInOne

on:
push:
paths-ignore:
- '**.md'
branches:
- master
pull_request:
paths-ignore:
- '**.md'
schedule:
- cron: 0 0 * * 5
branches:
- master
workflow_dispatch:

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

jobs:
plugin_test:
Expand All @@ -20,34 +24,30 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: asdf_plugin_test
uses: asdf-vm/actions/plugin-test@v1
uses: asdf-vm/actions/plugin-test@v3
with:
command: gitui --version

lint_and_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run the sh-checker
uses: luizm/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#SHELLCHECK_OPTS: -e SC1004 # Optional: exclude some shellcheck warnings.
SHFMT_OPTS: -i 2 # Optional: pass arguments to shfmt.
uses: actions/checkout@v4

- name: Install Tools with asdf
uses: asdf-vm/actions/install@v3

- uses: actions/cache@v4
with:
sh_checker_comment: true
- name: Install asdf
run: |
git clone https://github.com/asdf-vm/asdf.git $HOME/asdf
path: ~/.cache/pre-commit
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install bats
- name: Run pre-commit checks
shell: bash
run: |
sudo apt-get install bats
bats --version
pre-commit run --all-files
- name: Test plugin with bats
run: |
. $HOME/asdf/asdf.sh
asdf plugin-add gitui $GITHUB_WORKSPACE
bats test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode/
8 changes: 8 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
globs:
- '**/*.md'
- '!.venv*/**/*.md'
- '!**/.tox/**/*.md'
- '!**/.pytest_cache'
- '!shared/bats-libs/**/*.md'
- '!.github/actions/*/node_modules/**/*.md'
20 changes: 20 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# 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
45 changes: 45 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace # Trims trailing whitespace
exclude: ^shared/bats-libs/.*
- id: check-yaml # Validates YAML files
args:
- --allow-multiple-documents
- id: check-json # Validates JSON files
- id: check-toml # Validates TOML files
- id: check-xml # Validates XML files
- id: check-added-large-files # Checks for files that are added to the repository that are larger than a threshold
- id: check-case-conflict # Checks for files that would conflict in case-insensitive filesystems
- id: check-merge-conflict # Checks for files that contain merge conflict strings
- id: detect-private-key # Check for the existence of private keys
- id: check-executables-have-shebangs # Checks that executables have shebangs
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.6.1
hooks:
- id: editorconfig-checker-system # Check editorconfig compliance
alias: ec
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck # Shell scripts conform to shellcheck
- id: shfmt # Check shell style with shfmt

- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.12.1
hooks:
- id: markdownlint-cli2

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
args: [--config-data, relaxed, --no-warnings]

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '150', --explicit_start]
5 changes: 5 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
editorconfig-checker 2.6.0
shfmt 3.8.0
shellcheck 0.10.0
bats 1.10.0
pre-commit 3.6.2
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,3 @@ asdf plugin-add gitui https://github.com/looztra/asdf-gitui
## Use

Check out the [asdf](https://github.com/asdf-vm/asdf) readme for instructions on how to install and manage versions of gitui.

## Source code

This source code has been generated with :

```bash
cookiecutter --overwrite-if-exists --directory plugins/gitui --no-input https://github.com/looztra/cookiecutter-asdf-plugin

```


23 changes: 23 additions & 0 deletions bin/download
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euo pipefail

current_script_path=${BASH_SOURCE[0]}
plugin_dir=$(dirname "$(dirname "$current_script_path")")

# shellcheck source=./lib/utils.bash
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$(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" || fail "Could not extract $release_file"

# Remove the tar.gz file since we don't need to keep it
rm "$release_file"
Loading

0 comments on commit 10ee87a

Please sign in to comment.