Skip to content

Instantly share code, notes, and snippets.

@djanowski
Last active December 14, 2015 17:08
Show Gist options
  • Save djanowski/5119590 to your computer and use it in GitHub Desktop.
Save djanowski/5119590 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Assuming you use gs(1) and dep(1), this program
# implodes your .gs directory and installs all gems
# listed in your .gems file with a single call to gem(1).
#
# gs(1): https://github.com/soveran/gs
# dep(1): https://github.com/cyx/dep
set -e
die() {
echo "$@" >&2
exit 1
}
[[ -f .gems ]] || die "No .gems file found. Are you sure you're in the right directory?"
[[ -d .gs ]] && rm -r .gs
mkdir .gs
if gem -v | grep -q '^2\.'; then
specs=$(sed -e 's/ -v /:/' .gems)
else
specs=$(cat .gems)
fi
specs=$(tr "\n" " " <<< $specs)
echo " gem install $specs"
gs "gem install $specs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment