chore(scripts): tweak cargo updates

This commit is contained in:
2024-06-25 01:15:15 +03:00
parent 0e109c3da3
commit 383bc2b052

View File

@@ -21,12 +21,21 @@ source "$CARGO_HOME/env"
exit 1 exit 1
} }
rustup default system rustup default stable
# If we have cargo install-update, use it first
x-have cargo-install-update && {
msg_run "Updating cargo packages with cargo install-update"
cargo install-update -a
msg_done "Done with cargo install-update"
}
packages=( packages=(
# A cargo subcommand for checking and applying
# updates to installed executables
"cargo-update"
# Cargo cache management utility
"cargo-cache" "cargo-cache"
# starship.rs
# "starship"
# An incremental parsing system for programming tools # An incremental parsing system for programming tools
"tree-sitter-cli" "tree-sitter-cli"
# a subprocess caching utility # a subprocess caching utility
@@ -37,9 +46,6 @@ packages=(
"eza" "eza"
# A simple, fast and user-friendly alternative to 'find' # A simple, fast and user-friendly alternative to 'find'
"fd-find" "fd-find"
# A cargo subcommand for checking and applying
# updates to installed executables
"cargo-update"
# recursively searches directories for a # recursively searches directories for a
# regex pattern while respecting your gitignore # regex pattern while respecting your gitignore
"ripgrep" "ripgrep"
@@ -48,6 +54,9 @@ packages=(
"bottom" "bottom"
) )
# Number of jobs to run in parallel, this helps to keep the system responsive
BUILD_JOBS=$(nproc --ignore=2)
for pkg in "${packages[@]}"; do for pkg in "${packages[@]}"; do
# Trim spaces # Trim spaces
pkg=${pkg// /} pkg=${pkg// /}
@@ -55,7 +64,7 @@ for pkg in "${packages[@]}"; do
if [[ ${pkg:0:1} == "#" ]]; then continue; fi if [[ ${pkg:0:1} == "#" ]]; then continue; fi
msg_run "Installing cargo package $pkg" msg_run "Installing cargo package $pkg"
cargo install "$pkg" cargo install --jobs $BUILD_JOBS "$pkg"
echo "" echo ""
done done
@@ -64,10 +73,12 @@ msg_done "Installed cargo packages!"
msg_run "Now doing the next steps for cargo packages" msg_run "Now doing the next steps for cargo packages"
# use bob to install nvim # use bob to install latest stable nvim
x-have bob && { x-have bob && {
bob use stable && x-path-append "$XDG_DATA_HOME/bob/nvim-bin" bob use stable && x-path-append "$XDG_DATA_HOME/bob/nvim-bin"
} }
msg_run "Removing cargo cache" msg_run "Removing cargo cache"
cargo cache --autoclean cargo cache --autoclean
msg_done "Done removing cargo cache"