Skip to content

Instantly share code, notes, and snippets.

@debugwand
Created August 29, 2013 13:59
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 debugwand/6378438 to your computer and use it in GitHub Desktop.
Save debugwand/6378438 to your computer and use it in GitHub Desktop.
Running guard-jasmine from a git pre-commit hook with workaround for rvm problems
#!/bin/sh
#
#Run JS tests before commit
echo "LOCAL PRE-COMMIT HOOKS"
if [ -d "$HOME/.rvm/bin" ]; then
PATH="$HOME/.rvm/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
if [ -f ".ruby-version" ]; then
rvm use "$(cat .ruby-version)"
fi
if [ -f ".ruby-gemset" ]; then
rvm gemset use "$(cat .ruby-gemset)"
fi
fi
ruby "bin/hooks/$(basename "$0").rb"
source "$HOME/.rvm/scripts/rvm"
rvm reload > /dev/null
guard-jasmine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment