Skip to content

Instantly share code, notes, and snippets.

@Nyholm
Last active August 15, 2023 21:16
Show Gist options
  • Save Nyholm/317df136ded2087649d0c9c464285cb1 to your computer and use it in GitHub Desktop.
Save Nyholm/317df136ded2087649d0c9c464285cb1 to your computer and use it in GitHub Desktop.
Show who contributed to your vendors folder
# Install git fame
gem install git_fame
# Install all vendors with source
rm -rf vendor/*
composer update --prefer-source
# Do the calculations. This might take 30 minutes to complete.
rm output.txt
find ./vendor -type d -depth 2 ! -path "./vendor/composer" -exec echo {} \; -exec git fame --sort=loc --hide-progressbar --repository={} \; >> output.txt
# Print the result
awk -F "|" '/\|.*\| [0-9]/ {gsub(/[ \t]+$/, "", $2); print $2 "|" $3}' output.txt | awk -F "|" '{ arr[$1]+=$2 } END { for (key in arr) printf("%s\t%s\n", arr[key], key) }' | sort -r -g > output_sorted.txt
cat output_sorted.txt | grep Nyholm
@ausi
Copy link

ausi commented Mar 17, 2018

Wouldn’t it be better to do a composer install --prefer-source instead of an update? Otherwise the composer.lock file will be ignored and overwritten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment