Skip to content

Instantly share code, notes, and snippets.

@ybur-yug
Last active May 17, 2017 06:46
Show Gist options
  • Save ybur-yug/c63cd41a10fb611a4e4936a641a5480d to your computer and use it in GitHub Desktop.
Save ybur-yug/c63cd41a10fb611a4e4936a641a5480d to your computer and use it in GitHub Desktop.
#!/bin/bash
function calculate_stats() {
mkdir priv
mkdir priv/scripts
echo "Gathering stats for umbrella project..."
echo
APPS_COUNT=$(ls apps | wc -l)
echo $(echo "$APPS_COUNT Apps")
echo
find apps -name '*.ex' | xargs wc -l > priv/scripts/out.txt
GROSS_LOC=$(echo "$(tail -1 priv/scripts/out.txt) Lines of Code")
echo $GROSS_LOC
echo
find apps -name '*.exs' | xargs wc -l > priv/scripts/out2.txt
GROSS_LOT=$(echo "$(tail -1 priv/scripts/out2.txt) Lines of Tests/Config")
echo $GROSS_LOT
echo
echo $(echo "$(grep -r 'defmodule' apps/ | wc -l) Modules")
find apps -name '*.ex' | xargs wc -l | sort > priv/scripts/out3.txt
echo "Longest Modules:"
echo
for module in $(tail -4 priv/scripts/out3.txt | head -3 | sort); do
echo $module
done
echo
find apps -name '*.exs' | xargs wc -l | sort > priv/scripts/out4.txt
echo "Longest Tests:"
echo
for module in $(tail -4 priv/scripts/out4.txt | head -3 | sort); do
echo $module
done
}
calculate_stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment