-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathJustfile
More file actions
62 lines (50 loc) · 1.91 KB
/
Justfile
File metadata and controls
62 lines (50 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
set quiet := true
emulator_dir := 'coinkite/coinkite-tap-proto/emulator'
# list of recipes
default:
just --list
# format the project code
fmt:
cargo +nightly fmt --all
# lint the project
clippy: fmt
cargo clippy --all-features --all-targets
# build the project
build: fmt
cargo build --all-features --all-targets
# setup the cktap emulator venv
setup:
(test -d emulator_env || python3 -m venv emulator_env) && \
source emulator_env/bin/activate; pip install -r {{emulator_dir}}/requirements.txt > /dev/null 2>&1
# get cktap emulator options help
help:
source emulator_env/bin/activate; python3 coinkite/coinkite-tap-proto/emulator/ecard.py emulate --help
# start the cktap emulator on /tmp/ecard-pipe
start *OPTS: setup
if [ -f emulator_env/ecard.pid ]; then \
echo "Emulator already running, pid:" `cat emulator_env/ecard.pid`; \
else \
source emulator_env/bin/activate; python3 coinkite/coinkite-tap-proto/emulator/ecard.py emulate {{OPTS}} &> emulator_env/output.log & \
echo $! > emulator_env/ecard.pid; \
echo "started emulator, pid:" `cat emulator_env/ecard.pid`; \
fi
# stop the cktap emulator
stop:
if [ -f emulator_env/ecard.pid ]; then \
echo "killing emulator, pid:" `cat emulator_env/ecard.pid`; \
kill `cat emulator_env/ecard.pid` && rm emulator_env/ecard.pid; \
else \
echo "emulator pid file not found."; \
fi
# test the rust-cktap lib with the coinkite cktap card emulator
test: fmt setup
source emulator_env/bin/activate && cargo test -p rust-cktap --features emulator -- --nocapture
# clean the project target directory
clean:
cargo clean
# run the cli locally with a usb pcsc card reader (HID OMNIKEY 5022 CL Rev:C)
run *CMD:
cargo run -p cktap-cli {{CMD}}
# run the cli locally with an emulated satscard (see start and stop recipes)
run_emu *CMD:
cargo run -p cktap-cli --features emulator -- {{CMD}}