-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJustfile
203 lines (159 loc) · 4.22 KB
/
Justfile
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Set project-wide variables
command_name := "toggle"
args := " "
# Text colors
BLACK := '\033[30m'
RED := '\033[31m'
GREEN := '\033[32m'
YELLOW := '\033[33m'
BLUE := '\033[34m'
MAGENTA := '\033[35m'
CYAN := '\033[36m'
WHITE := '\033[37m'
GRAY := '\033[90m'
# Background colors
BG_BLACK := '\033[40m'
BG_RED := '\033[41m'
BG_GREEN := '\033[42m'
BG_YELLOW := '\033[43m'
BG_BLUE := '\033[44m'
BG_MAGENTA := '\033[45m'
BG_CYAN := '\033[46m'
BG_WHITE := '\033[47m'
# Text styles
BOLD := '\033[1m'
DIM := '\033[2m'
ITALIC := '\033[3m'
UNDERLINE := '\033[4m'
# Reset all styles
NC := '\033[0m'
# Display a symbol
CHECK := "$(GREEN)✓$(NC)"
CROSS := "$(RED)✗$(NC)"
DASH := "$(GRAY)-$(NC)"
# List all available recipes
@default:
just --list --unsorted
# Check if required tools are installed
[group('check')]
@check-deps:
@#!/usr/bin/env sh
if ! command -v just >/dev/null 2>&1; then echo "just is not installed"; exit 1; fi
if ! command -v cargo >/dev/null 2>&1; then echo "cargo is not installed"; exit 1; fi
if ! command -v rustc >/dev/null 2>&1; then echo "rust is not installed"; exit 1; fi
echo "All required tools are installed"
alias c := check-deps
# Format code
[group('check')]
@format:
echo "Running formatter..."
echo " rustfmt"
cargo fmt --all
alias f := format
# Run linter (code style and quality checks)
[group('check')]
@lint:
echo "Running linter..."
echo " clippy"
cargo clippy -- -D warnings
alias l := lint
# Run tests
[group('check')]
@test *options:
cargo test {{options}}
alias t := test
# Run all checks
[group('check')]
@check: test lint
echo "All checks passed!"
alias ca := check
# Run package command.
[group('run')]
@run-debug *args=args:
cargo run -- {{args}}
alias rd := run-debug
@run-release *args=args:
cargo run --release -- {{args}}
alias rr := run-release
# Build package
[group('build')]
@build: check
cargo build
alias b := build
# Set up pre-commit hooks
[group('pre-commit')]
@pre-commit-setup:
cargo install cargo-husky
cargo husky install
# Run all pre-commit Hooks
[group('pre-commit')]
@pre-commit-run:
cargo husky run --all
alias pc := pre-commit-run
# Check installed package version
[group('check')]
@version cmd=command_name:
{{cmd}} --version
# Clean up temporary files and caches
[group('clean')]
@clean:
cargo clean
rm -rf target/
rm -rf Cargo.lock
rm -rf **/*.rs.bk
rm -rf .cargo-cache/
rm -rf .rustc_info.json
# Install Sphinx and any necessary extensions
[group('docs')]
@install-docs:
@#!/usr/bin/env sh
if ! command -v cargo >/dev/null 2>&1; then echo "cargo is not installed"; exit 1; fi
echo "Installing mdBook..."
cargo install mdbook
echo "Installing required mdBook components..."
cargo install mdbook-linkcheck
cargo install mdbook-mermaid
echo "{{GREEN}} Documentation dependencies installed"
# Not usually needed, Initialize docs only if you are starting a new project
[group('docs')]
@init-docs:
cargo doc --document-private-items --open
# Show help for documentation
[group('docs')]
@docs-help:
cargo doc --help
# Build documentation
[group('docs')]
@docs target:
@#!/usr/bin/env sh
if ! command -v mdbook >/dev/null 2>&1; then \
echo "mdBook is not installed. Run 'just install-docs' first"; \
exit 1; \
fi
echo "Building documentation..."
mdbook build docs
echo "{{GREEN}}Documentation built successfully{{NC}}"
# Run documentation server with hot reloading
[group('docs')]
@docs-dev:
cargo doc --document-private-items --open --watch
# Clean documentation build files
[group('docs')]
@docs-clean:
cargo clean
rm -rf docs/build
rm -rf docs/source
# Build release version and install locally
[group('build')]
@build-release:
cargo build --release
@echo "{{GREEN}}Built release binary at target/release/{{command_name}}{{NC}}"
@echo "To make it available system-wide, copy it to a directory in your PATH:"
@echo "cp target/release/{{command_name}} ~/.local/bin/ # or another directory in your PATH"
alias br := build-release
# Run the simple Python test case
[group('test')]
@test-python:
@echo "Running Python test case..."
./tests/test_simple_python.sh
alias tp := test-python