Created
June 25, 2015 00:41
-
-
Save mislav/14fa0888dcbce8879efa to your computer and use it in GitHub Desktop.
Simple tool to do rudimentary dependency license auditing using Licensee library.
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
#!/bin/bash | |
# Usage: license-audit [<project-dir>] | |
# | |
# Scans gems from the current project's bundle, Bower components and npm | |
# packages, and prints their license. | |
# | |
# Requires: | |
# - licensee >= 4.5.0 | |
# - ruby with Bundler (for Gemfiles) | |
set -e | |
{ [ ! -e Gemfile ] || ruby -rbundler -e 'puts Bundler.load.specs.map(&:gem_dir)' | |
ls -d node_modules/* bower_components/* 2>/dev/null | |
} | while read dir; do | |
[ -d "$dir" ] || continue | |
echo -n "${dir##*/}: " | |
licensee "$dir" 2>/dev/null | grep 'License:\|Unknown' | sed 's/License: //' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment