Skip to content

Instantly share code, notes, and snippets.

@ipoval
Created March 31, 2015 17: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 ipoval/b30d4313a9af74ddc9f2 to your computer and use it in GitHub Desktop.
Save ipoval/b30d4313a9af74ddc9f2 to your computer and use it in GitHub Desktop.
rails find unused libs
#
find lib/ -name "*.rb" | xargs grep -h --color -e ^class | cut -d ' ' -f 2 | sort | uniq | egrep -v "^Time" | egrep -v "^Hash" | egrep -v "^UserMailer" | while read k; do echo lib class: "$k"; grep -r -l -w -m 1 --color "$k" ./app ./config ./lib ./script --exclude-dir=*assets* | head -n 2 | wc -l | grep 1; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment