dotfiles/scripts/install_rust

48 lines
1.0 KiB
Plaintext
Raw Normal View History

2020-06-03 14:31:58 +00:00
#!/bin/sh
install_rust() {
if ! (which ~/.cargo/bin/rustup > /dev/null)
then
echo "installing rustup"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
fi
echo "rustup ✓"
}
update_rust() {
~/.cargo/bin/rustup update > /dev/null 2>&1
rust_version=$(~/.cargo/bin/rustc --version | awk '{print $2}')
echo "latest rust: $rust_version ✓"
}
download_rust_analyzer() {
if ! (which rust-analyzer > /dev/null)
then
echo "downloading rust analyzer"
rust_analyzer_bin=/usr/local/bin/rust-analyzer
2020-08-02 14:20:25 +00:00
curl -s -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-mac -o $rust_analyzer_bin
2020-06-03 14:31:58 +00:00
chmod +x $rust_analyzer_bin
fi
echo "rust-analyzer ✓"
}
2020-08-02 14:20:25 +00:00
install_cargos() {
programs=(
cargo-edit
cargo-whatfeatures
jql
toml-cli
)
for i in "${programs[@]}"; do
cargo install "$i"
done
2020-06-03 14:31:58 +00:00
}
install_rust
update_rust
download_rust_analyzer
2020-08-02 14:20:25 +00:00
install_cargos