Skip to content

Commit d5643f3

Browse files
authored
feat: add rust setup (#4)
1 parent dcf05e6 commit d5643f3

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ lint:
1818
find . -type f -name "*.sh" -exec shfmt -w -i 6 {} +
1919
find . -type f -name "*.sh" -exec shellcheck {} +
2020
prettier --write "**/*.{json,yaml,yml,md}"
21+
22+
rust_setup_dev:
23+
chmod +x rust/setup_dev.sh
24+
./rust/setup_dev.sh
25+
26+
rust_assert_setup_dev:
27+
chmod +x rust/assert_setup_dev.sh
28+
./rust/assert_setup_dev.sh

rust/assert_setup_dev.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
echo "Rust: $(which rustc)"
6+
echo "Cargo: $(which cargo)"
7+
echo "Rustup: $(which rustup)"
8+
echo "Rustdoc: $(which rustdoc)"
9+
FAILED=0
10+
11+
if ! test "$(which rustc)" = "$HOME/.cargo/bin/rustc"; then
12+
echo "❌ Rust: ERROR - not in ~/.cargo/bin"
13+
FAILED=1
14+
else
15+
echo "✅ Rust: OK"
16+
fi
17+
if ! test "$(which cargo)" = "$HOME/.cargo/bin/cargo"; then
18+
echo "❌ Cargo: ERROR - not in ~/.cargo/bin"
19+
FAILED=1
20+
else
21+
echo "✅ Cargo: OK"
22+
fi
23+
if ! test "$(which rustup)" = "/opt/homebrew/bin/rustup"; then
24+
echo "❌ Rustup: ERROR - not in /opt/homebrew/bin"
25+
FAILED=1
26+
else
27+
echo "✅ Rustup: OK"
28+
fi
29+
if ! test "$(which rustdoc)" = "$HOME/.cargo/bin/rustdoc"; then
30+
echo "❌ Rustdoc: ERROR - not in ~/.cargo/bin"
31+
FAILED=1
32+
else
33+
echo "✅ Rustdoc: OK"
34+
fi
35+
if [ $FAILED -eq 1 ]; then
36+
echo "❌ Setup assertion failed."
37+
exit 1
38+
else
39+
echo "✅ Setup assertion passed."
40+
fi

rust/setup_dev.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
brew install rustup
6+
rustup-init -y
7+
rustup default stable

0 commit comments

Comments
 (0)