diff --git a/.gitignore b/.gitignore index 395e764..20b419b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ shard.lock .vscode/ .crystal/ venv/ +.croupier diff --git a/Hacefile.yml b/Hacefile.yml new file mode 100644 index 0000000..359ae4c --- /dev/null +++ b/Hacefile.yml @@ -0,0 +1,115 @@ +variables: + FLAGS: "-d --error-trace" + NAME: "tartrazine" + +tasks: + build: + default: true + dependencies: + - src + - shard.lock + - shard.yml + - Hacefile.yml + - lexers/*xml + - styles/*xml + outputs: + - bin/{{NAME}} + commands: | + shards build {{FLAGS}} + + get-deps: + dependencies: + - shard.yml + outputs: + - shard.lock + commands: | + shards install + + build-release: + phony: true + always_run: true + commands: | + hace build FLAGS="--release" + + install: + phony: true + always_run: true + dependencies: + - bin/hace + commands: | + rm ${HOME}/.local/bin/{{name}} + cp bin/hace ${HOME}/.local/bin/{{name}} + + static: + outputs: + - bin/{{name}}-static-linux-amd64 + - bin/{{name}}-static-linux-arm64 + commands: | + hace clean + ./build_static.sh + + test: + dependencies: + - src + - spec + - shard.lock + - shard.yml + commands: | + crystal spec -v --error-trace + phony: true + always_run: true + + lint: + dependencies: + - src + - spec + - shard.lock + - shard.yml + commands: | + crystal tool format src/*.cr spec/*.cr + bin/ameba --fix + always_run: true + phony: true + + docs: + dependencies: + - src + - shard.lock + - shard.yml + - README.md + commands: | + crystal docs + outputs: + - docs/index.html + + pre-commit: + default: true + outputs: + - .git/hooks/commit-msg + - .git/hooks/pre-commit + dependencies: + - .pre-commit-config.yaml + commands: | + pre-commit install --hook-type commit-msg + pre-commit install + + clean: + phony: true + always_run: true + commands: | + rm -rf shard.lock bin lib + + coverage: + dependencies: + - src + - spec + - shard.lock + - shard.yml + commands: | + shards install + crystal build -o bin/run_tests src/run_tests.cr + rm -rf coverage/ + mkdir coverage + kcov --clean --include-path=./src ${PWD}/coverage ./bin/run_tests + outputs: + - coverage/index.html diff --git a/Makefile b/Makefile deleted file mode 100644 index adf11bb..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -all: build - -build: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml - shards build -Dstrict_multi_assign -Dno_number_autocast -d --error-trace -release: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml - shards build --release -static: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml - shards build --release --static - strip bin/tartrazine - - -clean: - rm -rf bin lib shard.lock - -test: - crystal spec - -lint: - ameba --fix src spec - -.PHONY: clean all test bin lint diff --git a/src/run_tests.cr b/src/run_tests.cr new file mode 100644 index 0000000..a567ffd --- /dev/null +++ b/src/run_tests.cr @@ -0,0 +1 @@ +require "../spec/**"