Skip to content

Instantly share code, notes, and snippets.

@danlo
Last active April 27, 2020 19:55
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 danlo/74d40a947bbddce0ca73487f18712e74 to your computer and use it in GitHub Desktop.
Save danlo/74d40a947bbddce0ca73487f18712e74 to your computer and use it in GitHub Desktop.
EXCLUDE="--exclude-dir=docs --exclude-dir=test --exclude-dir=spec"
for CONST in `grep --include=*.rb $EXCLUDE --no-filename --only-matching --perl --recursive '[A-Z][A-Za-z0-9]+(::[A-Z][A-Za-z0-9]+)+' . | grep -v 'Controller$' | grep -v '^AASM\|AbstractController\|Action\|Active\|Algolia\|Aws\|BigDecimal\|ConnectionPool\|CoreExt\|Devise\|Digest\|Dir\|Dry\|Faker\|Hashie\|OpenSSL\|Postmark\|Rails\|Rake\|Resque\|Rollbar\|Sinatra\|Slim\|URI\|Unicorn\|Zlib\|GraphQL' | sort -u`
do
COUNT=`grep --include=*.rb $EXCLUDE --no-filename --recursive $CONST . | grep -v '^ *#' | wc -l`
if [[ $COUNT -eq 1 ]]
then
echo "########### $CONST ($COUNT)"
echo "grep --include=*.rb -r $CONST . "
grep --include=*.rb $EXCLUDE --recursive --color $CONST .
echo
echo
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment