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

Commit

Permalink
refactor: Complete overhaul
Browse files Browse the repository at this point in the history
- remove useless '|| exit' in second bootstrap line
- Add a synthetic stack, showing the trace on error
  • Loading branch information
hyperupcall committed Jun 15, 2021
1 parent b54ebf9 commit a34a5ab
Show file tree
Hide file tree
Showing 71 changed files with 837 additions and 385 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[*]
indent_style = tab
indent_size = 4

[*.{yaml,yml}]
indent_style = space
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# glue-store

My personal store for [glue](https://github.com/eankeen/glue); visit that repository for more information about Glue

TODO

- linter for bootstrapping files and functions
15 changes: 0 additions & 15 deletions actions/do-go-check.sh

This file was deleted.

17 changes: 0 additions & 17 deletions actions/do-nim-build.sh

This file was deleted.

13 changes: 0 additions & 13 deletions actions/do-node-app-build.sh

This file was deleted.

7 changes: 5 additions & 2 deletions actions/do-go-build.sh → actions/effect-deb-package.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit
bootstrap

ensure.cmd 'go'
action() {
:
}

action "$@"
unbootstrap
2 changes: 1 addition & 1 deletion actions/effect-git-tag.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit
bootstrap

action() {
local version="$1"
Expand Down
2 changes: 1 addition & 1 deletion actions/effect-github-release.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit
bootstrap

action() {
local version="$1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit
bootstrap

# makerepropkg *.zst
# repro -f *.zst
Expand Down Expand Up @@ -34,11 +34,11 @@ action() {
ensure.nonZero 'myEmail' "$myEmail"
ensure.nonZero 'myVer' "$myVer"

# glue useConfig(result-pacman-package)
util.get_config "result-pacman-package/dev/PKGBUILD"
pkgbuildFile="$REPLY"
# glue useConfig(effect-pacman-package)
util.get_config "effect-pacman-package/dev/PKGBUILD"
cfgPkgbuild="$REPLY"

generated.in 'result-pacman-package'
bootstrap.generated 'effect-pacman-package'
(
cd "$GENERATED_DIR" || error.cd_failed
mkdir dev
Expand All @@ -47,7 +47,7 @@ action() {
tar --create --directory "$GLUE_WD" --file "$myProject-$myVer.tar.gz" --exclude './.git' \
--exclude "$myProject-$myVer.tar.gz" --transform "s/^\./$myProject-$myVer/" ./

cp "$pkgbuildFile" .
cp "$cfgPkgbuild" .
sed -i -e "s/# Maintainer:.*/# Maintainer: $myName <$myEmail>/g" PKGBUILD
sed -i -e "s/pkgname=.*\$/pkgname='$myProject'/g" PKGBUILD
sed -i -e "s/pkgver=.*\$/pkgver='$myVer'/g" PKGBUILD
Expand All @@ -62,7 +62,7 @@ action() {
makepkg -Cfsrc
namcap ./*.zst
) || exit
generated.out
unbootstrap.generated
}

action "$@"
Expand Down
14 changes: 14 additions & 0 deletions actions/effect-rpm-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap

action() {
# wget https://github.com/eankeen/bash-args/archive/refs/tags/v0.5.0.tar.gz
# mv v0.5.0.tar.gz bash-args_0.5.0.orig.tar.gz
# tar xf bash-args_0.5.0.orig.tar.gz

fedpkg --release f34 local
}

action "$@"
unbootstrap
5 changes: 0 additions & 5 deletions actions/result-deb-package.sh

This file was deleted.

11 changes: 0 additions & 11 deletions actions/result-rpm-package.sh

This file was deleted.

11 changes: 5 additions & 6 deletions actions/tool-bats.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit

ensure.cmd 'bats'
bootstrap

action() {
local -a dirs=()
local exitCode=0

ensure.cmd 'bats'

(
local exitCode=0

if [ -d pkg ]; then
if ! cd pkg; then
error.cd_failed
fi
ensure.cd 'pkg'

dirs=(../test ../tests)
else
dirs=(test tests)
Expand Down
15 changes: 9 additions & 6 deletions actions/tool-checkmake.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit
bootstrap

ensure.cmd 'checkmake'
action() {
ensure.cmd 'checkmake'

for file in **/{Makefile,GNUMakefile,*.mk}; do
checkmake "$file"
done
unset -v file
for file in **/{Makefile,GNUMakefile,*.mk}; do
checkmake "$file"
done
unset -v file
}

action "$@"
unbootstrap
10 changes: 5 additions & 5 deletions actions/tool-conventional-changelog.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit
bootstrap

ensure.cmd 'conventional-changelog'

Expand All @@ -15,16 +15,16 @@ action() {

# glue useConfig(tool-conventional-changelog)
util.get_config 'tool-conventional-changelog/context.json'
local configContextJson="$REPLY"
local cfgContextJson="$REPLY"

toml.get_key 'gitRepoName' 'glue.toml'
local gitRepoName="$REPLY"
ensure.nonZero 'gitRepoName' "$gitRepoName"

generated.in 'tool-conventional-changelog'; (
bootstrap.generated 'tool-conventional-changelog'; (
cd "$GENERATED_DIR" || error.cd_failed

cp "$configContextJson" .
cp "$cfgContextJson" .
sed -i \
-e "s/TEMPLATE_CONTEXT_VERSION/$version/g" \
-e "s/TEMPLATE_CONTEXT_REPOSITORY/$gitRepoName/g" \
Expand All @@ -46,7 +46,7 @@ action() {
--release-count 1 \
--context "context.json" \
--commit-path "$GLUE_WD"
); generated.out
); unbootstrap.generated

REPLY="$GENERATED_DIR/CHANGELOG-CURRENT.md"
}
Expand Down
8 changes: 0 additions & 8 deletions actions/tool-eslint-init.sh

This file was deleted.

12 changes: 12 additions & 0 deletions actions/tool-go-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap

action() {
ensure.cmd 'go'

go build ./...
}

action "$@"
unbootstrap
11 changes: 7 additions & 4 deletions actions/tool-gofmt.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit
bootstrap

ensure.cmd 'gofmt'
action() {
ensure.cmd 'gofmt'

go list -f '{{.Dir}}' ./... \
| xargs gofmt -s -l -w
go list -f '{{.Dir}}' ./... \
| xargs gofmt -s -l -w
}

action "$@"
unbootstrap
13 changes: 8 additions & 5 deletions actions/tool-golangci-lint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit
bootstrap

# glue useConfig(golangci-lint)
util.ln_config "golangci-lint/.golangci.yaml" ".golangci.yaml"
action() {
# glue useConfig(golangci-lint)
util.ln_config "golangci-lint/.golangci.yaml" ".golangci.yaml"

ensure.cmd 'golangci-lint'
ensure.cmd 'golangci-lint'

golangci-lint run --enable-all ./...
golangci-lint run --enable-all ./...
}

action "$@"
unbootstrap
9 changes: 6 additions & 3 deletions actions/tool-govet.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap || exit
bootstrap

ensure.cmd 'go'
action() {
ensure.cmd 'go'

go get ./...
go get ./...
}

action "$@"
unbootstrap
58 changes: 58 additions & 0 deletions actions/tool-mkdocs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
eval "$GLUE_BOOTSTRAP"
bootstrap

action() {
ensure.cmd 'toast'

util.shopt -s globstar

local exitCode=0

toml.get_key 'gitRemoteUser' glue.toml
local gitRemoteUser="$REPLY"

toml.get_key 'gitRemoteRepo' glue.toml
local gitRemoteRepo="$REPLY"

bootstrap.generated 'tool-mkdocs'
ensure.cd "$GENERATED_DIR"

# TODO: only import docs
git clone --depth 1 file://"$GLUE_WD" .

# glue useConfig(tool-mkdocs)
util.get_config 'tool-mkdocs/mkdocs.yml'
local cfgMkdocsYml="$REPLY"

util.get_config 'tool-mkdocs/pyproject.toml'
local cfgPyprojectToml="$REPLY"

util.get_config 'tool-mkdocs/toast.yml'
local cfgToastYml="$REPLY"

cp "$cfgMkdocsYml" "$cfgPyprojectToml" "$cfgToastYml" .

ensure.file "$GLUE_WD/README.md"
cp "$GLUE_WD/README.md" 'docs/index.md'

# Copy specialized files to 'docs' before build
util.run_hook 'hook.tool-mkdocs.copy_docs'

toast mkdocs
cp -r "$GENERATED_DIR/site" "site"

ensure.cd site
git init --initial-branch=main
git add -A
# TODO: commit message
git commit -m 'Update site'
# TODO: rebase or configure merge strategy
git push -f "https://github.com/$gitRemoteUser/$gitRemoteRepo.git" main:gh-pages
unbootstrap.generated

REPLY="$exitCode"
}

action "$@"
unbootstrap
Loading

0 comments on commit a34a5ab

Please sign in to comment.