2019-05-24 10:25:55 +02:00
|
|
|
default: watch
|
|
|
|
|
2020-01-31 10:54:46 +01:00
|
|
|
version := `sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/v\1/p' Cargo.toml | head -1`
|
|
|
|
|
2020-03-31 09:01:40 +02:00
|
|
|
bt := '0'
|
2020-02-14 09:12:49 +01:00
|
|
|
|
|
|
|
export RUST_BACKTRACE := bt
|
|
|
|
|
2020-03-31 09:01:40 +02:00
|
|
|
log := 'warn'
|
2020-03-17 11:02:02 +01:00
|
|
|
|
|
|
|
export RUST_LOG := log
|
|
|
|
|
2019-05-24 10:25:55 +02:00
|
|
|
# watch filesystem for changes and rerun tests
|
2020-03-17 11:02:02 +01:00
|
|
|
watch +ARGS='':
|
|
|
|
cargo watch --clear --exec 'test {{ARGS}}'
|
2019-05-24 10:25:55 +02:00
|
|
|
|
|
|
|
# show stats about torrents at `PATH`
|
|
|
|
stats PATH:
|
|
|
|
cargo build --release
|
|
|
|
time ./target/release/imdl --unstable torrent stats --input {{PATH}}
|
|
|
|
|
2020-02-06 09:12:07 +01:00
|
|
|
push: check
|
|
|
|
! git branch | grep '* master'
|
|
|
|
git push github
|
|
|
|
|
2020-01-05 00:09:36 +01:00
|
|
|
# clean up feature branch BRANCH
|
2020-03-18 08:43:02 +01:00
|
|
|
done BRANCH=`git rev-parse --abbrev-ref HEAD`:
|
2020-01-05 00:09:36 +01:00
|
|
|
git checkout master
|
|
|
|
git diff --no-ext-diff --quiet --exit-code
|
|
|
|
git pull --rebase github master
|
2020-03-20 03:23:17 +01:00
|
|
|
git diff --no-ext-diff --quiet --exit-code {{BRANCH}} --
|
2020-01-05 00:09:36 +01:00
|
|
|
git branch -D {{BRANCH}}
|
|
|
|
|
2020-01-05 03:58:42 +01:00
|
|
|
test:
|
2020-01-31 10:54:46 +01:00
|
|
|
cargo test --all
|
|
|
|
|
|
|
|
clippy:
|
|
|
|
cargo clippy --all
|
2020-01-05 03:58:42 +01:00
|
|
|
|
2020-03-06 07:51:00 +01:00
|
|
|
fmt:
|
|
|
|
cargo +nightly fmt --all
|
|
|
|
|
2020-01-05 03:58:42 +01:00
|
|
|
lint:
|
2020-01-31 10:54:46 +01:00
|
|
|
./bin/lint
|
2020-01-05 03:58:42 +01:00
|
|
|
|
2020-01-17 05:35:23 +01:00
|
|
|
preview-readme:
|
|
|
|
grip -b README.md
|
|
|
|
|
2020-03-11 00:28:08 +01:00
|
|
|
# build and serve the book
|
|
|
|
book:
|
2020-03-20 03:06:05 +01:00
|
|
|
mdbook serve book --open --dest-dir ../www/book
|
2020-03-11 00:28:08 +01:00
|
|
|
|
2020-01-31 10:54:46 +01:00
|
|
|
# add git log messages to changelog
|
|
|
|
changes:
|
|
|
|
git log --pretty=format:%s >> CHANGELOG.md
|
|
|
|
|
2020-01-17 05:35:23 +01:00
|
|
|
dev-deps:
|
|
|
|
brew install grip
|
2020-03-11 00:28:08 +01:00
|
|
|
cargo install mdbook
|
2020-03-22 03:07:05 +01:00
|
|
|
cargo install cargo-watch
|
2020-03-28 11:56:08 +01:00
|
|
|
npm install --global asciicast2gif
|
|
|
|
brew install imagemagick
|
|
|
|
brew install gifsicle
|
2020-01-17 05:35:23 +01:00
|
|
|
|
2020-01-21 06:41:39 +01:00
|
|
|
# update readme table of contents
|
|
|
|
update-toc:
|
|
|
|
cargo run --package update-readme toc
|
|
|
|
|
2020-03-28 06:46:41 +01:00
|
|
|
generate-completions:
|
|
|
|
./bin/generate-completions
|
|
|
|
|
2020-03-28 07:13:36 +01:00
|
|
|
man:
|
|
|
|
cargo build
|
|
|
|
help2man \
|
|
|
|
--name 'BitTorrent metainfo utility' \
|
|
|
|
--manual 'IMDL MANUAL' \
|
|
|
|
--no-info \
|
|
|
|
target/debug/imdl \
|
|
|
|
> man/imdl.1
|
|
|
|
sd '📦 ' "\n" man/imdl.1
|
|
|
|
|
|
|
|
check-man: man
|
|
|
|
git diff --no-ext-diff --quiet --exit-code
|
|
|
|
|
2020-01-31 10:54:46 +01:00
|
|
|
check-minimal-versions:
|
|
|
|
./bin/check-minimal-versions
|
|
|
|
|
|
|
|
check: test clippy lint check-minimal-versions
|
|
|
|
git diff --no-ext-diff --quiet --exit-code
|
2020-03-06 07:51:00 +01:00
|
|
|
cargo +nightly fmt --all -- --check
|
2020-01-21 06:41:39 +01:00
|
|
|
cargo run --package update-readme toc
|
|
|
|
git diff --no-ext-diff --quiet --exit-code
|
2020-01-17 05:35:23 +01:00
|
|
|
|
2020-03-18 07:34:46 +01:00
|
|
|
pr: push
|
|
|
|
hub pull-request -o
|
|
|
|
|
2020-03-28 07:13:36 +01:00
|
|
|
publish-check: check check-man
|
2020-02-04 17:06:29 +01:00
|
|
|
cargo outdated --exit-code 1
|
2020-01-31 10:54:46 +01:00
|
|
|
grep {{version}} CHANGELOG.md
|
|
|
|
|
|
|
|
publish: publish-check
|
2020-03-28 07:36:13 +01:00
|
|
|
git branch | grep '* master'
|
2020-01-31 10:54:46 +01:00
|
|
|
git tag -a {{version}} -m 'Release {{version}}'
|
|
|
|
git push github {{version}}
|
2020-03-28 03:28:34 +01:00
|
|
|
cargo publish
|
2020-01-31 10:54:46 +01:00
|
|
|
|
2020-03-28 11:56:08 +01:00
|
|
|
# record demo animation
|
|
|
|
record:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euxo pipefail
|
|
|
|
cargo build --release --all
|
|
|
|
rm -f tmp/9front.torrent
|
|
|
|
asciinema rec \
|
|
|
|
--command ./target/release/demo \
|
|
|
|
--overwrite \
|
|
|
|
tmp/demo.json
|
|
|
|
asciinema upload tmp/demo.json
|
|
|
|
asciicast2gif tmp/demo.json www/demo.gif
|
|
|
|
|
2020-03-20 03:06:05 +01:00
|
|
|
# open site index
|
|
|
|
www:
|
|
|
|
open www/index.html
|
2020-01-31 17:20:17 +01:00
|
|
|
|
2019-05-24 10:25:55 +02:00
|
|
|
# retrieve large collection of torrents from the Internet Archive
|
|
|
|
get-torrents:
|
|
|
|
aria2c \
|
|
|
|
-d dat \
|
|
|
|
-x 10 \
|
|
|
|
'https://ia802701.us.archive.org/21/items/2014_torrent_archive_organized/torrent_archive_organized.zip'
|
2020-01-17 05:35:23 +01:00
|
|
|
|
|
|
|
# download bittorrent.org repository
|
|
|
|
get-beps:
|
|
|
|
git clone git@github.com:bittorrent/bittorrent.org.git tmp/bittorrent.org
|