Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Made the echo command output colour on a Linux terminal, removed karma and added a crunchbang
cd /path/to/your/repo
curl > .git/hooks/pre-push
chmod u+x .git/hooks/pre-push
#!/bin/env bash
echo "Running RSpec"
bundle exec rspec spec
if [ $spec -eq 0 ] then
echo -en "\\033[32mTests are green, pushing...\\033[0;39m\n"
exit 0
echo -en "\\033[1;31mCannot push, tests are failing. Use --no-verify to force push.\\033[0;39m\n"
exit 1

This comment has been minimized.

Copy link

@dvisockas dvisockas commented Feb 25, 2019

Using this spits out errors:

.git/hooks/pre-push: line 9: syntax error near unexpected token `else'
.git/hooks/pre-push: line 9: `else'

Fixed it by adding a semicolon after the if block:
if [ $spec -eq 0 ]; then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment