Skip to content

Instantly share code, notes, and snippets.

@steveh
Created September 7, 2017 21:17
Show Gist options
  • Save steveh/d202598d6a36113321106fe5b70db177 to your computer and use it in GitHub Desktop.
Save steveh/d202598d6a36113321106fe5b70db177 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Installation: save to /usr/local/bin/update
# and chmod +x /usr/local/bin/update
# Usage: update
set -euo pipefail
if [ -d ".git" ]; then
dirty=$(git status --porcelain)
if [ -n "$dirty" ]; then
git add .
git stash
fi
git pull --rebase || true
if [ -n "$dirty" ]; then
git stash pop
fi
fi
if [ -f "Gemfile.lock" ]; then
bundle update
fi
if [ -f "yarn.lock" ]; then
yarn upgrade
elif [ -f "package.json" ]; then
npm update
fi
if [ -f "bower.json" ]; then
bower update
fi
if [ -f "composer.lock" ]; then
composer update
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment