2019-04-08 21:28:17 +00:00
|
|
|
#!/usr/bin/env just --justfile
|
|
|
|
# ^ A shebang isn't required, but allows a justfile to be executed
|
|
|
|
# like a script, with `./justfile test`, for example.
|
|
|
|
|
2019-05-08 03:15:22 +00:00
|
|
|
alias t := test
|
2017-11-17 07:30:08 +00:00
|
|
|
|
2019-05-08 03:15:22 +00:00
|
|
|
alias c := check
|
2017-11-17 07:30:08 +00:00
|
|
|
|
2019-05-08 03:15:22 +00:00
|
|
|
bt := '0'
|
2019-04-12 08:42:05 +00:00
|
|
|
|
2019-05-08 03:15:22 +00:00
|
|
|
export RUST_BACKTRACE := bt
|
2019-04-12 08:42:05 +00:00
|
|
|
|
2019-04-11 22:23:14 +00:00
|
|
|
test:
|
2017-11-17 07:30:08 +00:00
|
|
|
cargo test
|
|
|
|
|
2018-10-13 10:12:35 +00:00
|
|
|
fuzz:
|
|
|
|
cargo +nightly fuzz run fuzz-compiler
|
|
|
|
|
2017-11-17 07:30:08 +00:00
|
|
|
@spam:
|
|
|
|
{ \
|
|
|
|
figlet test; \
|
|
|
|
cargo build --color always 2>&1; \
|
|
|
|
cargo test --color always -- --color always 2>&1; \
|
|
|
|
} | less
|
2016-10-23 02:36:54 +00:00
|
|
|
|
2016-11-11 21:04:47 +00:00
|
|
|
# only run tests matching PATTERN
|
2019-04-11 22:23:14 +00:00
|
|
|
filter PATTERN:
|
2017-11-17 07:30:08 +00:00
|
|
|
cargo test {{PATTERN}}
|
2016-11-05 06:56:15 +00:00
|
|
|
|
2016-10-28 22:25:59 +00:00
|
|
|
build:
|
|
|
|
cargo build
|
|
|
|
|
2016-10-30 04:51:39 +00:00
|
|
|
check:
|
|
|
|
cargo check
|
|
|
|
|
2019-05-15 21:30:47 +00:00
|
|
|
watch +COMMAND='test':
|
|
|
|
cargo watch --clear --exec "{{COMMAND}}"
|
2016-11-12 18:28:47 +00:00
|
|
|
|
2019-07-19 04:58:06 +00:00
|
|
|
man:
|
|
|
|
cargo build --features help4help2man
|
|
|
|
help2man \
|
|
|
|
--name 'save and run commands' \
|
|
|
|
--manual 'JUST MANUAL' \
|
|
|
|
--no-info \
|
|
|
|
target/debug/just \
|
|
|
|
> man/just.1
|
|
|
|
man man/just.1
|
|
|
|
|
2019-05-08 03:15:22 +00:00
|
|
|
version := `sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/v\1/p' Cargo.toml | head -1`
|
2016-11-02 07:18:09 +00:00
|
|
|
|
2016-11-13 07:31:19 +00:00
|
|
|
# publish to crates.io
|
2019-04-16 06:39:18 +00:00
|
|
|
publish-check: lint clippy test
|
2016-11-02 07:18:09 +00:00
|
|
|
git branch | grep '* master'
|
2016-10-29 03:48:53 +00:00
|
|
|
git diff --no-ext-diff --quiet --exit-code
|
2018-11-06 09:00:34 +00:00
|
|
|
grep {{version}} CHANGELOG.md
|
2019-10-09 05:17:22 +00:00
|
|
|
cargo +nightly generate-lockfile -Z minimal-versions
|
|
|
|
cargo test
|
2019-11-01 02:19:01 +00:00
|
|
|
git checkout Cargo.lock
|
2019-04-16 06:39:18 +00:00
|
|
|
|
|
|
|
publish: publish-check
|
2016-10-09 00:55:17 +00:00
|
|
|
cargo publish
|
2017-05-13 04:06:48 +00:00
|
|
|
git tag -a {{version}} -m 'Release {{version}}'
|
|
|
|
git push github {{version}}
|
2016-10-09 00:55:17 +00:00
|
|
|
|
2016-11-13 07:31:19 +00:00
|
|
|
# clean up feature branch BRANCH
|
2016-11-12 02:52:27 +00:00
|
|
|
done BRANCH:
|
|
|
|
git checkout master
|
2019-05-15 20:07:41 +00:00
|
|
|
git diff --no-ext-diff --quiet --exit-code
|
2016-11-12 02:52:27 +00:00
|
|
|
git pull --rebase github master
|
2019-05-15 20:07:41 +00:00
|
|
|
git diff --no-ext-diff --quiet --exit-code {{BRANCH}}
|
|
|
|
git branch -D {{BRANCH}}
|
2016-11-12 02:52:27 +00:00
|
|
|
|
2016-11-13 07:31:19 +00:00
|
|
|
# install just from crates.io
|
2016-11-12 19:47:49 +00:00
|
|
|
install:
|
|
|
|
cargo install -f just
|
|
|
|
|
2016-11-13 07:31:19 +00:00
|
|
|
# install development dependencies
|
2016-11-12 18:28:47 +00:00
|
|
|
install-dev-deps:
|
|
|
|
rustup install nightly
|
|
|
|
rustup update nightly
|
|
|
|
rustup run nightly cargo install -f clippy
|
|
|
|
cargo install -f cargo-watch
|
|
|
|
cargo install -f cargo-check
|
2018-10-13 10:12:35 +00:00
|
|
|
cargo +nightly install cargo-fuzz
|
2016-11-12 18:28:47 +00:00
|
|
|
|
2019-07-19 04:58:06 +00:00
|
|
|
# install system development dependencies with homebrew
|
|
|
|
install-dev-deps-homebrew:
|
|
|
|
brew install help2man
|
|
|
|
|
2016-11-13 07:31:19 +00:00
|
|
|
# everyone's favorite animate paper clip
|
2017-11-30 17:13:13 +00:00
|
|
|
clippy:
|
2019-04-11 22:23:14 +00:00
|
|
|
cargo clippy
|
2016-10-24 03:39:50 +00:00
|
|
|
|
2016-11-13 07:31:19 +00:00
|
|
|
# count non-empty lines of code
|
2016-10-27 16:50:06 +00:00
|
|
|
sloc:
|
2016-11-13 07:31:19 +00:00
|
|
|
@cat src/*.rs | sed '/^\s*$/d' | wc -l
|
2016-10-27 16:50:06 +00:00
|
|
|
|
2016-11-13 08:08:14 +00:00
|
|
|
@lint:
|
2016-11-13 07:31:19 +00:00
|
|
|
echo Checking for FIXME/TODO...
|
2016-11-12 15:56:13 +00:00
|
|
|
! grep --color -En 'FIXME|TODO' src/*.rs
|
2016-11-13 07:31:19 +00:00
|
|
|
echo Checking for long lines...
|
2017-05-13 02:09:47 +00:00
|
|
|
! grep --color -En '.{101}' src/*.rs
|
2016-11-08 05:01:27 +00:00
|
|
|
|
2017-11-17 07:30:08 +00:00
|
|
|
replace FROM TO:
|
2019-04-16 05:40:02 +00:00
|
|
|
sd -i '{{FROM}}' '{{TO}}' src/*.rs
|
2017-11-16 21:25:24 +00:00
|
|
|
|
2016-11-13 07:31:19 +00:00
|
|
|
test-quine:
|
2016-11-24 04:20:32 +00:00
|
|
|
cargo run -- quine
|
2016-11-13 07:31:19 +00:00
|
|
|
|
2016-10-04 06:55:55 +00:00
|
|
|
# make a quine, compile it, and verify it
|
2016-11-24 04:20:32 +00:00
|
|
|
quine:
|
2017-11-20 07:16:55 +00:00
|
|
|
mkdir -p tmp
|
2016-11-24 04:20:32 +00:00
|
|
|
@echo '{{quine-text}}' > tmp/gen0.c
|
2016-09-28 05:49:17 +00:00
|
|
|
cc tmp/gen0.c -o tmp/gen0
|
|
|
|
./tmp/gen0 > tmp/gen1.c
|
|
|
|
cc tmp/gen1.c -o tmp/gen1
|
|
|
|
./tmp/gen1 > tmp/gen2.c
|
|
|
|
diff tmp/gen1.c tmp/gen2.c
|
2017-11-20 07:16:55 +00:00
|
|
|
rm -r tmp
|
2016-09-28 05:49:17 +00:00
|
|
|
@echo 'It was a quine!'
|
|
|
|
|
2019-05-08 03:15:22 +00:00
|
|
|
quine-text := '
|
2016-11-13 22:33:41 +00:00
|
|
|
int printf(const char*, ...);
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
char *s =
|
|
|
|
"int printf(const char*, ...);"
|
|
|
|
"int main() {"
|
|
|
|
" char *s = %c%s%c;"
|
|
|
|
" printf(s, 34, s, 34);"
|
|
|
|
" return 0;"
|
2017-05-13 22:34:26 +00:00
|
|
|
"}";
|
2016-11-13 22:33:41 +00:00
|
|
|
printf(s, 34, s, 34);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
'
|
2016-10-28 07:10:19 +00:00
|
|
|
|
2017-10-12 23:12:23 +00:00
|
|
|
render-readme:
|
|
|
|
#!/usr/bin/env ruby
|
|
|
|
require 'github/markup'
|
2018-02-04 04:27:07 +00:00
|
|
|
$rendered = GitHub::Markup.render("README.adoc", File.read("README.adoc"))
|
2017-10-12 23:12:23 +00:00
|
|
|
File.write('tmp/README.html', $rendered)
|
|
|
|
|
|
|
|
watch-readme:
|
|
|
|
just render-readme
|
2018-02-04 04:27:07 +00:00
|
|
|
fswatch -ro README.adoc | xargs -n1 -I{} just render-readme
|
2017-10-12 23:12:23 +00:00
|
|
|
|
2016-10-24 04:25:23 +00:00
|
|
|
# run all polyglot recipes
|
2019-04-12 08:42:05 +00:00
|
|
|
polyglot: _python _js _perl _sh _ruby
|
|
|
|
# (recipes that start with `_` are hidden from --list)
|
2016-10-09 07:30:33 +00:00
|
|
|
|
2019-04-12 08:42:05 +00:00
|
|
|
_python:
|
2016-10-08 00:56:39 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
print('Hello from python!')
|
|
|
|
|
2019-04-12 08:42:05 +00:00
|
|
|
_js:
|
2016-10-08 00:56:39 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
console.log('Greetings from JavaScript!')
|
|
|
|
|
2019-04-12 08:42:05 +00:00
|
|
|
_perl:
|
2016-10-08 00:56:39 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
print "Larry Wall says Hi!\n";
|
|
|
|
|
2019-04-12 08:42:05 +00:00
|
|
|
_sh:
|
2016-10-08 00:56:39 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
hello='Yo'
|
|
|
|
echo "$hello from a shell script!"
|
|
|
|
|
2019-04-12 08:42:05 +00:00
|
|
|
_ruby:
|
2016-10-08 00:56:39 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
puts "Hello from ruby!"
|
2017-03-13 02:17:52 +00:00
|
|
|
|
2018-06-19 17:04:03 +00:00
|
|
|
# Print working directory, for demonstration purposes!
|
|
|
|
pwd:
|
|
|
|
echo {{invocation_directory()}}
|
|
|
|
|
2017-03-13 02:17:52 +00:00
|
|
|
# Local Variables:
|
|
|
|
# mode: makefile
|
|
|
|
# End:
|
|
|
|
# vim: set ft=make :
|