Skip to content

Instantly share code, notes, and snippets.

@ledbettj
Created January 14, 2014 20:14
Show Gist options
  • Select an option

  • Save ledbettj/8424836 to your computer and use it in GitHub Desktop.

Select an option

Save ledbettj/8424836 to your computer and use it in GitHub Desktop.
find files in app or lib which don't have matching specs in spec/
#!/usr/bin/env bash
TOTAL=0
MISSING=0
for file in $(find lib app -name "*.rb"); do
BASE=$(dirname $file | sed s/app\\///); # no app folder in spec dir
SPEC="spec/$BASE/$(basename $file .rb)_spec.rb"
if [ ! -f "$SPEC" ]; then
echo -ne "$(tput setaf 1)"
let MISSING=MISSING+1
else
echo -n "$(tput setaf 2)"
fi
echo "⬢ $(tput sgr0)$SPEC"
let TOTAL=TOTAL+1
done
echo "Missing $MISSING/$TOTAL files checked."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment