Created
August 8, 2016 17:01
-
-
Save Adzz/c41c338623e562a4c69c86d2ce9aa47c to your computer and use it in GitHub Desktop.
This is lifted from Gary Bernhardt here: https://www.youtube.com/watch?v=sCZJblyT_XM It shows the number of times a class is referenced within an app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep -rh '^[[:space:]]*\(class\|module\)\b' api/app api/lib --include='*.rb' | sed 's/^[[:space:]]*//' | cut -d ' ' -f 2 | while read class; do echo "`grep -rl "\b$class\b" api/app api/lib --include="*.rb" | wc -l` $class"; done | sort -n |
```grep -rh '^[[:space:]](class|module)\b' app lib --include='.rb' | sed 's/^[[:space:]]*//' | cut -d ' ' -f 2 | while read class; do echo "grep -rl "\b$class\b" app lib --include="*.rb" | wc -l
$class"; done | sort -n
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently searches within
api/app
andapi/lib
but those paths can be edited to whichever we need.