Sha256: d1430c00dc38ee0d94ec45224486a06317451ff37b2a284fad0a0450f158a28a

Contents?: true

Size: 584 Bytes

Versions: 23

Compression:

Stored size: 584 Bytes

Contents

#! /usr/bin/env bash

echo-color() { echo " $@ "; }
modified_files=$(git diff --cached --name-only | grep '.*.rb$')

# Run Rubocop
[ -z "$modified_files" ] && exit 0
echo-color 'Running rubocop on cached ruby files:'
bundle exec rubocop $modified_files || exit 1

test_files=()
for filepath in $modified_files; do
  testpath=$(echo $filepath | sed 's/^lib/spec/' | sed 's/\.rb$/_spec.rb/')
  [ -e $testpath ] && test_files+=($testpath)
done

# Run tests
[ -z "$test_files" ] && exit 0
echo-color 'Running related tests for cached ruby files:'
.bin/run-tests $test_files

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ohloh_scm-3.0.3 .git_hooks/pre-commit
ohloh_scm-3.0.2 .git_hooks/pre-commit
ohloh_scm-3.0.1 .git_hooks/pre-commit