Last active
May 10, 2019 07:59
-
-
Save rkallensee/102a08fbae1a38efe10fa0246c92807a to your computer and use it in GitHub Desktop.
Write all Ruby gem dependencies with their licenses into a CSV file
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
require 'csv' | |
csv_path = Rails.root.join("#{Rails.application.class.parent.name.underscore.dasherize}_licenses.csv") | |
CSV.open(csv_path, 'wb') do |csv| | |
csv << ['Gem', 'Licenses'] | |
Gem.loaded_specs.each do |gem_name, spec| | |
csv << [gem_name, spec.licenses.join(', ')] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment