diff options
| author | mo khan <mo.khan@gmail.com> | 2020-04-20 23:25:14 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-04-20 23:25:14 -0600 |
| commit | 702b728ac0c02e0c08543e54265ed0c13738348c (patch) | |
| tree | 796b7f37e619ea691f1c40ed71652ddfa0160d4c /lib | |
| parent | 690819209575c28b1d54ac710322dce3356fc1ab (diff) | |
Generate gl specific report format
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/spandx/gitlab.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/spandx/gitlab.rb b/lib/spandx/gitlab.rb index 287cb0c..e932dea 100644 --- a/lib/spandx/gitlab.rb +++ b/lib/spandx/gitlab.rb @@ -11,4 +11,31 @@ module Spandx Pathname.new(File.dirname(__FILE__)).join('../..') end end + + module Core + class Report + def to_h + { version: '2.0', licenses: [], dependencies: [] }.tap do |report| + each do |dependency| + dependency.licenses.each do |license| + report[:licenses].push({ + id: license.id, + name: license.name, + url: license.url, + count: 0 + }) + end + report[:dependencies].push({ + name: dependency.name, + version: dependency.version, + description: '', + url: '', + licenses: dependency.licenses.map(&:id), + paths: ['.'] + }) + end + end + end + end + end end |
