This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ DerivedData/
|
|||||||
.swiftpm/*
|
.swiftpm/*
|
||||||
./hpa.toml
|
./hpa.toml
|
||||||
./Version.*
|
./Version.*
|
||||||
|
/*.json
|
||||||
|
|||||||
24
justfile
24
justfile
@@ -2,44 +2,60 @@ docker_image_name := "swift-hpa"
|
|||||||
install_path := "~/.local/share/bin/hpa"
|
install_path := "~/.local/share/bin/hpa"
|
||||||
completion_path := "~/.local/share/zsh/completions/_hpa"
|
completion_path := "~/.local/share/zsh/completions/_hpa"
|
||||||
|
|
||||||
|
tap_url := "https://git.housh.dev/michael/homebrew-formula"
|
||||||
|
tap := "michael/formula"
|
||||||
|
formula := "hpa"
|
||||||
|
|
||||||
|
# Build and bottle homebrew formula.
|
||||||
|
bottle:
|
||||||
|
@brew uninstall {{formula}} || true
|
||||||
|
@brew tap {{tap}} {{tap_url}}
|
||||||
|
@brew install --build-bottle {{formula}}
|
||||||
|
@brew bottle {{formula}} --json
|
||||||
|
bottle="$(ls *.gz)" && mv "${bottle}" "${bottle/--/-}"
|
||||||
|
|
||||||
|
# Build the command-line tool.
|
||||||
build mode="debug":
|
build mode="debug":
|
||||||
swift build -c {{mode}}
|
swift build -c {{mode}}
|
||||||
|
|
||||||
alias b := build
|
alias b := build
|
||||||
|
|
||||||
|
# Build the docker image.
|
||||||
build-docker file="Dockerfile" tag="latest":
|
build-docker file="Dockerfile" tag="latest":
|
||||||
@docker build \
|
@docker build \
|
||||||
--file docker/{{file}} \
|
--file docker/{{file}} \
|
||||||
--tag {{docker_image_name}}:{{tag}} .
|
--tag {{docker_image_name}}:{{tag}} .
|
||||||
|
|
||||||
|
# Build the docker test image used for testing.
|
||||||
build-docker-test: (build-docker "Dockerfile.test" "test")
|
build-docker-test: (build-docker "Dockerfile.test" "test")
|
||||||
|
|
||||||
|
# Run tests.
|
||||||
test *ARGS:
|
test *ARGS:
|
||||||
swift test {{ARGS}}
|
swift test {{ARGS}}
|
||||||
|
|
||||||
alias t := test
|
alias t := test
|
||||||
|
|
||||||
|
# Run tests in docker container.
|
||||||
test-docker *ARGS: (build-docker-test)
|
test-docker *ARGS: (build-docker-test)
|
||||||
@docker run --rm \
|
@docker run --rm \
|
||||||
--network host \
|
--network host \
|
||||||
{{docker_image_name}}:test \
|
{{docker_image_name}}:test \
|
||||||
swift test {{ARGS}}
|
swift test {{ARGS}}
|
||||||
|
|
||||||
|
# Run the application.
|
||||||
run *ARGS:
|
run *ARGS:
|
||||||
swift run hpa {{ARGS}}
|
swift run hpa {{ARGS}}
|
||||||
|
|
||||||
alias r := run
|
alias r := run
|
||||||
|
|
||||||
|
# Clean the build folder.
|
||||||
clean:
|
clean:
|
||||||
rm -rf .build
|
rm -rf .build
|
||||||
|
|
||||||
|
# Bump the version based on the git tag.
|
||||||
update-version:
|
update-version:
|
||||||
@swift package \
|
@swift package \
|
||||||
--disable-sandbox \
|
--disable-sandbox \
|
||||||
--allow-writing-to-package-directory \
|
--allow-writing-to-package-directory \
|
||||||
update-version \
|
update-version \
|
||||||
hpa
|
hpa
|
||||||
|
|
||||||
install: (build "release")
|
|
||||||
@cp .build/release/hpa {{install_path}}
|
|
||||||
@{{install_path}} --generate-completion-script zsh > {{completion_path}}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user