A command-line tool for crate registry backup/export https://shipyard.rs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.6 KiB

2 years ago
set dotenv-load := true
rustc-version := "nightly"
publish-registry := "shipyard-rs-public"
repository := "https://git.shipyard.rs/jstrong/registry-backup"
2 years ago
# complicated/ugly one-liner to use lld linker if it's available
export RUSTFLAGS := `LLD=$(which lld) && test $? -eq "0" && echo "-C link-arg=-fuse-ld=lld" || echo ''`
2 years ago
# cargo wrapper; executes a cargo command using the settings in justfile (RUSTFLAGS, etc.)
2 years ago
cargo +args='':
cargo +{{rustc-version}} {{args}}
# cargo check wrapper
2 years ago
check +args='':
@just cargo check {{args}}
# cargo test wrapper
2 years ago
test +args='':
just cargo test {{args}}
# cargo build wrapper - builds registry-backup in debug mode
2 years ago
debug-build +args='':
@just cargo build --bin registry-backup {{args}}
# cargo build --release wrapper - builds registry-backup in release mode
2 years ago
release-build +args='':
@just cargo build --bin registry-backup --release {{args}}
# generate updated README.md
generate-readme:
just debug-build
./target/debug/registry-backup --help > doc/cli-menu.txt
just --list > doc/just-commands.txt
just cargo run --bin generate-readme --features docs
# check, run tests, check non-error output for clippy, run rustfmt
pre-release:
just cargo check \
&& just cargo test \
&& just cargo clippy \
&& just cargo fmt
2 years ago
# verify no uncommitted changes
verify-clean-git:
test "$(echo `git status --porcelain` | wc -c)" -eq "1"
2 years ago
get-crate-version:
@cat Cargo.toml | rg '^version =' | sed -e 's/^version\s*=\s*//' | tr -d '"'
2 years ago
# re-generate README.md and overwrite existing file with output
update-readme:
just generate-readme > README.md
# re-generate, overwrite, and stage changes
update-readme-and-stage: update-readme
git add README.md doc/*.txt
# re-generate, overwrite, stage, and commit
update-readme-and-commit: update-readme-and-stage
git commit -m 're-generate docs'
2 years ago
# get everything all ready for release
release-prep:
just pre-release
just verify-clean-git
VERSION=$(just get-crate-version) \
&& test -z "$(git tag | rg \"v${VERSION}\")" # Error: tag appears to exist already
just update-readme-and-commit
# release version (regenerate docs, git tag v0.0.0)
release: release-prep
git tag "v$(just get-crate-version)"
git push && git push --tags
# diagnostic command for viewing value of build variables at runtime
show-build-env:
@echo "registry-backup v$(just get-crate-version)"
@echo "rustc-version={{rustc-version}}"
@echo "publish-registry={{publish-registry}}"
@env | rg RUST --color never
# cargo install registry-backup via git dep
install:
just cargo install registry-backup --git {{repository}}