Skip to content

Instantly share code, notes, and snippets.

@loranger
Created May 16, 2017 13:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save loranger/348431359375843209a428d59f7ed3b3 to your computer and use it in GitHub Desktop.
Save loranger/348431359375843209a428d59f7ed3b3 to your computer and use it in GitHub Desktop.
Global upgrade
function growl() {
terminal-notifier -activate com.googlecode.iterm2 -sender com.googlecode.iterm2 -title "Hep !!" -subtitle "iTerm2 a un message :" -message "$@" -timeout 3 & say "$@" -v Thomas > /dev/null 2>&1
}
alias upgrade-osx='sudo softwareupdate -i -a && mas outdated && mas upgrade'
alias upgrade-brew='brew update && brew upgrade && brew cleanup --force && brew prune && brew cask cleanup && brew bundle dump --global --force'
alias upgrade-cask='for c in `brew cask list`; do ! brew cask info $c | grep -qF "Not installed" || brew cask install $c; done && brew cask cleanup'
alias dist-upgrade='upgrade-all'
alias distupgrade='upgrade-all'
function upgrade-pip() {
if hash pip 2>/dev/null; then
pip list --outdated --format=legacy | cut -d ' ' -f1 | xargs -n1 pip install -U
fi
if hash pip3 2>/dev/null; then
pip3 list --outdated --format=legacy | cut -d ' ' -f1 | xargs -n1 pip3 install -U
fi
}
function upgrade-gem(){
if hash gem 2>/dev/null; then
gem update --system && gem update && gem cleanup
fi
}
function upgrade-npm() {
if hash npm 2>/dev/null; then
\npm install -g npm@latest --loglevel silent && \npm -g --loglevel silent update
fi
}
function upgrade-composer() {
if hash composer 2>/dev/null; then
composer self-update && composer global update && ansible composer -m shell -a "composer self-update" -s
fi
}
function upgrade-all() {
clear
upgrade-osx
upgrade-brew
upgrade-cask
upgrade-pip
upgrade-gem
upgrade-npm
upgrade-composer
messages=("Ça, c'est fait." "A y'est." "À jour" "Pouce en l'air ! 👍" "Trop cool" "Super génial" "Incroyable" "Et voilà")
growl "$messages[$RANDOM%$#messages+1]"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment