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-4.0.4 .git_hooks/pre-commit
ohloh_scm-4.0.3 .git_hooks/pre-commit
ohloh_scm-4.0.2 .git_hooks/pre-commit
ohloh_scm-4.0.1 .git_hooks/pre-commit
ohloh_scm-3.0.21 .git_hooks/pre-commit
ohloh_scm-3.0.19 .git_hooks/pre-commit
ohloh_scm-3.0.17 .git_hooks/pre-commit
ohloh_scm-3.0.16 .git_hooks/pre-commit
ohloh_scm-3.0.15 .git_hooks/pre-commit
ohloh_scm-3.0.14 .git_hooks/pre-commit
ohloh_scm-3.0.13 .git_hooks/pre-commit
ohloh_scm-3.0.12 .git_hooks/pre-commit
ohloh_scm-3.0.11 .git_hooks/pre-commit
ohloh_scm-3.0.10 .git_hooks/pre-commit
ohloh_scm-3.0.9 .git_hooks/pre-commit
ohloh_scm-3.0.8 .git_hooks/pre-commit
ohloh_scm-3.0.7 .git_hooks/pre-commit
ohloh_scm-3.0.6 .git_hooks/pre-commit
ohloh_scm-3.0.5 .git_hooks/pre-commit
ohloh_scm-3.0.4 .git_hooks/pre-commit