Skip to content

Instantly share code, notes, and snippets.

@mainej
Created December 30, 2014 06:59
Show Gist options
  • Save mainej/1a4d61a92234c5cebeab to your computer and use it in GitHub Desktop.
Save mainej/1a4d61a92234c5cebeab to your computer and use it in GitHub Desktop.
Re-generate license_finder reports in rake task or pre-commit hook
#!/bin/bash
HTML_REPORT=doc/dependencies.html
STATUS_REPORT=doc/dependencies.csv
checksum_before=$(md5 -q < $STATUS_REPORT)
checksum_after=$(license_finder report --format csv --columns approved name version licenses | tee $STATUS_REPORT | md5 -q)
# # Alternatively
# CHECKSUM_FILE=doc/dependencies_status.md5
# checksum_before=$(cat $CHECKSUM_FILE)
# checksum_after=$(license_finder report --format csv --columns approved name version licenses | md5 -q | tee $CHECKSUM_FILE)
if [ "$checksum_before" != "$checksum_after" ]
then
license_finder report --format html > $HTML_REPORT;
exit 1
fi
@flavorjones
Copy link

Maybe we should provide something like this as a supported rake task in, e.g., lib/license_finder/rake_tasks.rb?

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