Skip to content

Instantly share code, notes, and snippets.

@josketres
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josketres/0e90b4e2b4a9e414708c to your computer and use it in GitHub Desktop.
Save josketres/0e90b4e2b4a9e414708c to your computer and use it in GitHub Desktop.
Grunt-cli wrapper
#!/usr/bin/env bash
# Grunt-cli wrapper script for UN*X
# https://gist.github.com/josketres/0e90b4e2b4a9e414708c
grunt_bin=grunt
grunt_check=" --version"
log_prefix="\e[95mgruntw\e[0m -"
command $grunt_bin $grunt_check >/dev/null 2>&1 || {
grunt_bin=$HOME/.gruntw/bin/grunt
echo -e "$log_prefix Global grunt-cli not found, using $grunt_bin"
command $grunt_bin $grunt_check >/dev/null 2>&1 || {
echo -e "$log_prefix $grunt_bin not found, installing it"
npm install grunt-cli -g --prefix $HOME/.gruntw
}
}
command $grunt_bin $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment