Last active
March 17, 2021 16:44
-
-
Save deevis/3211023e2b14e85df6ca908dbc642a2d to your computer and use it in GitHub Desktop.
Build a list of Gems used by a (bundle-backed) rails project
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
| # Build an informative list of all Gems used by the project - this will take a minute to run | |
| echo "Calling 'gem info' for every gem in the project...patience is a virtue..." | |
| for gem in `bundle list | sed 's/ \* \(.*\) (.*/\1/g' | grep -v " "` | |
| do echo "--------------------------------------------------------------------" | |
| gem info $gem | grep -v "Installed at" | |
| done | tee gem_info.txt | |
| echo "Building License Counts" | |
| echo "#---#---#---#---#---#---#---#---#---#---#---#---#---#---#" | tee -a gem_info.txt | |
| echo " Licenses " | tee -a gem_info.txt | |
| echo "#---#---#---#---#---#---#---#---#---#---#---#---#---#---#" | tee -a gem_info.txt | |
| grep "License[s]*" gem_info.txt | sed 's/.*License[s]*: \(.*\)/\1/g' | sort | uniq -c | sort -n -r | tee -a gem_info.txt | |
| echo "Building Prolific Author Counts" | |
| echo "#---#---#---#---#---#---#---#---#---#---#---#---#---#---#" | tee -a gem_info.txt | |
| echo " Top Gem Authors " | tee -a gem_info.txt | |
| echo "#---#---#---#---#---#---#---#---#---#---#---#---#---#---#" | tee -a gem_info.txt | |
| grep "Author[s]*:" gem_info.txt | sed 's/.*Author[s]*: \(.*\)/\1/g' | sort | uniq -c | sort -n -r | head -n 15 | tee -a gem_info.txt | |
| echo "#---#---#---#---#---#---#---#---#---#---#---#---#---#---#" | tee -a gem_info.txt | |
| echo " Total Gem Count " | tee -a gem_info.txt | |
| echo "#---#---#---#---#---#---#---#---#---#---#---#---#---#---#" | tee -a gem_info.txt | |
| grep "Author[s]*:" gem_info.txt | wc -l | tee -a gem_info.txt | |
| echo "We done - check out gem_info.txt for results" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment