diff options
| author | mo khan <mo.khan@gmail.com> | 2019-10-22 20:24:29 +0000 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2019-10-22 20:24:29 +0000 |
| commit | 431f07f8d11b2bc2a8fd09351a4323c9df676822 (patch) | |
| tree | 4f40b60925a4edf8eace71ae8af65bb5d67c7b6b /lib/license/management/repository.rb | |
| parent | 7f175952a5a047d785b5ea72c15a10642523c62a (diff) | |
| parent | 561556fbd1f59492cfa8fdd790f2ce39c90f3a8d (diff) | |
Merge branch 'remove-tech-debt' into 'master'v1.7.2
Remove feature flags and temporary mappings
See merge request gitlab-org/security-products/license-management!75
Diffstat (limited to 'lib/license/management/repository.rb')
| -rw-r--r-- | lib/license/management/repository.rb | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/license/management/repository.rb b/lib/license/management/repository.rb index 164653c..0c428dd 100644 --- a/lib/license/management/repository.rb +++ b/lib/license/management/repository.rb @@ -14,24 +14,18 @@ module License @spdx_data = load_spdx_data_from(spdx_path) end - def item_for(license, spdx: true) - if spdx - item = spdx_data_for(license) - return item if item - end - - id = id_for(license) - item = id ? compatibility_data['licenses'][id] : nil - item ? { 'id' => id }.merge(item) : generate_item_for(license) + def item_for(license) + spdx_data_for(id_for(license)) || + spdx_data_for(license.send(:short_name)) || + generate_item_for(license) end private attr_reader :spdx_data, :compatibility_data - def spdx_data_for(license) - id = id_for(license) - data = id ? spdx_data[id] : spdx_data[license.send(:short_name)] + def spdx_data_for(id) + data = spdx_data[id] if data { 'id' => data['licenseId'], @@ -39,7 +33,7 @@ module License 'url' => data['seeAlso'][-1] } else - log_info("could not find license named `#{license.send(:short_name)}` in SPDX index") + log_info("Could not find license `#{id}` in SPDX") nil end end |
