diff options
Diffstat (limited to 'lib/license')
| -rw-r--r-- | lib/license/management/report.rb | 2 | ||||
| -rw-r--r-- | lib/license/management/report/v1_1.rb | 27 |
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/license/management/report.rb b/lib/license/management/report.rb index a41f49d..aa3111d 100644 --- a/lib/license/management/report.rb +++ b/lib/license/management/report.rb @@ -2,6 +2,7 @@ require 'license/management/report/base' require 'license/management/report/v1' +require 'license/management/report/v1_1' require 'license/management/report/v2' module License @@ -13,6 +14,7 @@ module License '' => V1, '1' => V1, '1.0' => V1, + '1.1' => V1_1, '2' => V2, '2.0' => V2 }.freeze diff --git a/lib/license/management/report/v1_1.rb b/lib/license/management/report/v1_1.rb new file mode 100644 index 0000000..1186e2a --- /dev/null +++ b/lib/license/management/report/v1_1.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module License + module Management + module Report + class V1_1 < V1 + def to_h + { version: '1.1' }.merge(super) + end + + private + + def map_from_dependency(dependency) + licenses = dependency.licenses.sort_by(&:name).map do |license| + item = license_data(license) + { + name: item['name'], + url: item.fetch('url', '') + } + end + + { licenses: licenses }.merge(super) + end + end + end + end +end |
