Merge pull request #280 from mlinksva/bin-spdx-only

command line only output SPDX ID not name
This commit is contained in:
Mike Linksvayer 2018-03-26 08:46:28 -07:00 committed by GitHub
commit aba6425b18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -21,9 +21,9 @@ class LicenseeCLI < Thor
rows = [] rows = []
rows << if project.license rows << if project.license
['License:', project.license.name] ['License:', project.license.spdx_id]
elsif !project.licenses.empty? elsif !project.licenses.empty?
['Licenses:', project.licenses.map(&:name)] ['Licenses:', project.licenses.map(&:spdx_id)]
else else
['License:', set_color('None', :red)] ['License:', set_color('None', :red)]
end end
@ -77,7 +77,7 @@ class LicenseeCLI < Thor
def humanize(value, type = nil) def humanize(value, type = nil)
case type case type
when :license when :license
value.name value.spdx_id
when :matcher when :matcher
value.class value.class
when :confidence when :confidence

View File

@ -13,19 +13,19 @@ RSpec.describe 'detect command' do
let(:hash) { '46cdc03462b9af57968df67b450cc4372ac41f53' } let(:hash) { '46cdc03462b9af57968df67b450cc4372ac41f53' }
let(:expected) do let(:expected) do
{ {
'License' => 'MIT License', 'License' => 'MIT',
'Matched files' => 'LICENSE.md, licensee.gemspec', 'Matched files' => 'LICENSE.md, licensee.gemspec',
'LICENSE.md' => { 'LICENSE.md' => {
'Content hash' => hash, 'Content hash' => hash,
'Attribution' => 'Copyright (c) 2014-2017 Ben Balter', 'Attribution' => 'Copyright (c) 2014-2017 Ben Balter',
'Confidence' => '100.00%', 'Confidence' => '100.00%',
'Matcher' => 'Licensee::Matchers::Exact', 'Matcher' => 'Licensee::Matchers::Exact',
'License' => 'MIT License' 'License' => 'MIT'
}, },
'licensee.gemspec' => { 'licensee.gemspec' => {
'Confidence' => '90.00%', 'Confidence' => '90.00%',
'Matcher' => 'Licensee::Matchers::Gemspec', 'Matcher' => 'Licensee::Matchers::Gemspec',
'License' => 'MIT License' 'License' => 'MIT'
} }
} }
end end