Skip to content

Instantly share code, notes, and snippets.

@zakiya
Created September 9, 2020 01:02
Show Gist options
  • Save zakiya/ad28c01e5889f23c2598c81d1d100885 to your computer and use it in GitHub Desktop.
Save zakiya/ad28c01e5889f23c2598c81d1d100885 to your computer and use it in GitHub Desktop.
Update local
#!/bin/bash
COLOR_RED="\033[0;31m"
COLOR_YELLOW="\033[0;33m"
COLOR_GREEN="\033[0;32m"
COLOR_OCHRE="\033[38;5;95m"
COLOR_BLUE="\033[0;34m"
COLOR_WHITE="\033[0;37m"
COLOR_RESET="\033[0m"
# To set a crontab for this script:
# crontab -e (opens vim)
# 0 12 * * * ~/.zeescripts/localupdater.sh
# crontab -l (lists crontabs)
directory=$PWD
cd $directory
printf '\n'
printf "$COLOR_BLUE"
printf " -- Update taps & packages ---------------------------------------------\n"
printf "$COLOR_WHITE"
printf '\n'
brew list && brew list --cask
brew update
brew upgrade --formula
# Requires cask-upgrade
# To install:
# brew tap buo/cask-upgrade
printf '\n'
printf "$COLOR_BLUE"
printf ' -- Cask upgrade -------------------------------------------------------\n'
printf "$COLOR_WHITE"
printf '\n'
brew cu -a
printf '\n'
brew cleanup
printf '\n'
printf "$COLOR_GREEN"
printf ' -- Update composer & packages -----------------------------------------\n'
printf "$COLOR_WHITE"
printf '\n'
composer self-update
printf '\n'
cd $HOME/.composer
files=$(find . -name composer.json -maxdepth 2)
for file in $files
do
file=${file##*( )}
printf "Updating: '$file'"
composer update -d $(echo $file | sed 's/composer\.json//')
printf ''
done
cd $directory
# Requires npm-check
# To install:
# npm install -g npm-check
printf '\n'
printf "$COLOR_BLUE"
printf ' -- Update global node packages ----------------------------------------\n'
printf "$COLOR_WHITE"
printf '\n'
npm-check -gu
cd $directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment