opexxx
7/19/2018 - 8:09 AM

Global upgrade

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]"
}