mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 18:05:37 +00:00
49 lines
1.0 KiB
Bash
Executable File
49 lines
1.0 KiB
Bash
Executable File
#!/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
|
|
curl -s -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-mac -o $rust_analyzer_bin
|
|
chmod +x $rust_analyzer_bin
|
|
fi
|
|
|
|
echo "rust-analyzer ✓"
|
|
}
|
|
|
|
install_cargos() {
|
|
set -- \
|
|
'cargo-edit'
|
|
'cargo-whatfeatures' \
|
|
'jql' \
|
|
'toml-cli'
|
|
for program do
|
|
cargo install "$program"
|
|
done
|
|
|
|
echo "cargos ✓"
|
|
}
|
|
|
|
install_rust
|
|
update_rust
|
|
download_rust_analyzer
|
|
install_cargos
|