Skip to content

Instantly share code, notes, and snippets.

@ernie
Last active July 18, 2020 10:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ernie/3c4a92dc507f373ce9fd to your computer and use it in GitHub Desktop.
Save ernie/3c4a92dc507f373ce9fd to your computer and use it in GitHub Desktop.
Here's a little something to run in your Rails app's directory
#!/bin/sh
echo $(
find app/controllers -path app/controllers/concerns -prune -o -type f | wc -l
) / $((
$(egrep -r -l '<\s*ActiveRecord::Base' app/models | wc -l)
+ $(
(
[ -d app/models/concerns ] &&
find app/models/concerns -type f | wc -l
) || echo 0
)
+ $(
(
[ -d app/controllers/concerns ] &&
find app/controllers/concerns -type f | wc -l
) || echo 0
)
)) | bc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment