This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ DerivedData/
|
||||
.swiftpm/*
|
||||
./hpa.toml
|
||||
./Version.*
|
||||
/*.json
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Do not set this variable, it is set during the build process.
|
||||
let VERSION: String? = nil
|
||||
let VERSION: String? = "0.1.1"
|
||||
|
||||
26
justfile
26
justfile
@@ -2,11 +2,25 @@ docker_image_name := "swift-hpa"
|
||||
install_path := "~/.local/share/bin/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":
|
||||
swift build -c {{mode}}
|
||||
|
||||
alias b := build
|
||||
|
||||
# Build the docker image.
|
||||
build-docker file="Dockerfile" tag="latest":
|
||||
@docker build \
|
||||
--file docker/{{file}} \
|
||||
@@ -14,32 +28,36 @@ build-docker file="Dockerfile" tag="latest":
|
||||
|
||||
build-docker-test: (build-docker "Dockerfile.test" "test")
|
||||
|
||||
# Build the docker test image used for testing.
|
||||
build-docker-test: (build-docker "Dockerfile.test" "test")
|
||||
|
||||
# Run tests.
|
||||
test *ARGS:
|
||||
swift test {{ARGS}}
|
||||
|
||||
alias t := test
|
||||
|
||||
# Run tests in docker container.
|
||||
test-docker *ARGS: (build-docker-test)
|
||||
@docker run --rm \
|
||||
--network host \
|
||||
{{docker_image_name}}:test \
|
||||
swift test {{ARGS}}
|
||||
|
||||
# Run the application.
|
||||
run *ARGS:
|
||||
swift run hpa {{ARGS}}
|
||||
|
||||
alias r := run
|
||||
|
||||
# Clean the build folder.
|
||||
clean:
|
||||
rm -rf .build
|
||||
|
||||
# Bump the version based on the git tag.
|
||||
update-version:
|
||||
@swift package \
|
||||
--disable-sandbox \
|
||||
--allow-writing-to-package-directory \
|
||||
update-version \
|
||||
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