For legal needs, I need to document all the installed gems and their licences on our instances. The gem list
command lists all the gems. Is there a programmatic way to also list the licenses?
Listing Installed Gems The list command shows your locally installed gems: $ gem list *** LOCAL GEMS *** abbrev (default: 0.1. 0) awesome_print (1.9. 2) base64 (default: 0.1.
The list command is used to view the gems you have installed locally.
To check if a specific version is installed, just add --version , e.g.: gem list -i compass --version 0.12.
By default, binaries installed by gem will be placed into: /usr/local/lib/ruby/gems/3.1. 0/bin You may want to add this to your PATH.
From the Rails console:
For some Gems, which have its license information included inside its spec, you can display them running this from the rails console:
Gem.loaded_specs.each do |name, spec|
puts "#{name}: #{spec.license}"
end
or From your linux bash terminal:
for i in `gem list | cut -d" " -f1`; do echo "$i :" ; gem spec $i license; done
You can often find licensing information either on rubygems.org (derived from the gemspec data) or on the developer's source code repository.
Good Luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With