chore(config): add automated Rust install to make setup
Adds tooling/install-rust script that installs Rust via rustup if not present, with clippy and rustfmt components. Idempotent — skips when already installed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# tooling/install-rust — Install Rust via rustup and add required components
|
||||
#
|
||||
# Usage:
|
||||
# ./tooling/install-rust
|
||||
#
|
||||
# Installs rustup + stable toolchain if not present, then ensures
|
||||
# clippy and rustfmt components are installed. Idempotent.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if command -v rustup >/dev/null 2>&1; then
|
||||
echo "Rust already installed: $(rustc --version)"
|
||||
rustup component add clippy rustfmt 2>/dev/null
|
||||
echo "Components verified: clippy, rustfmt"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Installing Rust via rustup..."
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
echo "Error: curl is required to install Rust."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --component clippy rustfmt
|
||||
|
||||
# Source cargo env for the rest of this script
|
||||
# shellcheck source=/dev/null
|
||||
. "$HOME/.cargo/env"
|
||||
|
||||
echo "Rust installed: $(rustc --version)"
|
||||
echo "Components: clippy, rustfmt"
|
||||
Reference in New Issue
Block a user