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?
出于法律需要,我需要在我们的实例上记录所有已安装的宝石及其许可证。 gem list命令列出了所有的gem。有没有一种程序化的方式来列出许可证?
3 个解决方案
#1
11
From the Rails console:
从Rails控制台:
For some Gems, which have its license information included inside its spec, you can display them running this from the rails console:
对于某些Gems,它的许可证信息包含在其规范中,您可以显示它们从rails控制台运行它:
Gem.loaded_specs.each do |name, spec|
puts "#{name}: #{spec.license}"
end
or From your linux bash terminal:
或者从你的linux bash终端:
for i in `gem list | cut -d" " -f1`; do echo "$i :" ; gem spec $i license; done
#2
2
You can often find licensing information either on rubygems.org (derived from the gemspec data) or on the developer's source code repository.
您经常可以在rubygems.org(从gemspec数据派生)或开发人员的源代码库中找到许可信息。
Good Luck!
祝你好运!
#3
1
I know this is a bit late, but I googled it and this gem comes up and even supports CSV so if you're doing this business people it'll be great because then you can just send the spreadsheet up stream in your org.
我知道这有点晚了,但我用谷歌搜索了这个宝石,甚至支持CSV,所以如果你正在做这个业务的人,它会很棒,因为那时你可以在你的组织中向上发送电子表格。
Source: https://rubygems.org/gems/license-list/versions/1.0.1
资料来源:https://rubygems.org/gems/license-list/versions/1.0.1
#1
11
From the Rails console:
从Rails控制台:
For some Gems, which have its license information included inside its spec, you can display them running this from the rails console:
对于某些Gems,它的许可证信息包含在其规范中,您可以显示它们从rails控制台运行它:
Gem.loaded_specs.each do |name, spec|
puts "#{name}: #{spec.license}"
end
or From your linux bash terminal:
或者从你的linux bash终端:
for i in `gem list | cut -d" " -f1`; do echo "$i :" ; gem spec $i license; done
#2
2
You can often find licensing information either on rubygems.org (derived from the gemspec data) or on the developer's source code repository.
您经常可以在rubygems.org(从gemspec数据派生)或开发人员的源代码库中找到许可信息。
Good Luck!
祝你好运!
#3
1
I know this is a bit late, but I googled it and this gem comes up and even supports CSV so if you're doing this business people it'll be great because then you can just send the spreadsheet up stream in your org.
我知道这有点晚了,但我用谷歌搜索了这个宝石,甚至支持CSV,所以如果你正在做这个业务的人,它会很棒,因为那时你可以在你的组织中向上发送电子表格。
Source: https://rubygems.org/gems/license-list/versions/1.0.1
资料来源:https://rubygems.org/gems/license-list/versions/1.0.1