bundler-sbom 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bundler/sbom/cyclonedx.rb +1 -15
- data/lib/bundler/sbom/spdx.rb +2 -16
- data/lib/bundler/sbom/spec_license_finder.rb +26 -0
- data/lib/bundler/sbom/version.rb +1 -1
- data/lib/bundler/sbom.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25aca7901f1cf5074fa7d089541543e1626e61a2ed2969729fd5cd2e5308e831
|
|
4
|
+
data.tar.gz: fa38d57d57377305b21fe0deae6907ebd4bca352443c3b9ea5cc0ca068270927
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '028fb94c9fd911c34a0c73cef0c2f49e97a4a6278090cbd46595d46311181b351239f643d83a546c17eb63eaa8222b3873810310ca99504531aa02c5822a3735'
|
|
7
|
+
data.tar.gz: e91cc42c49bf6f4d62528fe4c97c9942bef964afc6f48af9e8bebb96ed588929344eb06557549019855ebfd0cda2cb2950a167091fbc49c934bc1c3f5d697cd7
|
|
@@ -37,21 +37,7 @@ module Bundler
|
|
|
37
37
|
gem_key = "#{spec.name}:#{spec.version}"
|
|
38
38
|
next if seen_gems.include?(gem_key)
|
|
39
39
|
seen_gems.add(gem_key)
|
|
40
|
-
|
|
41
|
-
gemspec = Gem::Specification.find_by_name(spec.name, spec.version)
|
|
42
|
-
licenses = []
|
|
43
|
-
if gemspec
|
|
44
|
-
if gemspec.license && !gemspec.license.empty?
|
|
45
|
-
licenses << gemspec.license
|
|
46
|
-
end
|
|
47
|
-
if gemspec.licenses && !gemspec.licenses.empty?
|
|
48
|
-
licenses.concat(gemspec.licenses)
|
|
49
|
-
end
|
|
50
|
-
licenses.uniq!
|
|
51
|
-
end
|
|
52
|
-
rescue Gem::LoadError
|
|
53
|
-
licenses = []
|
|
54
|
-
end
|
|
40
|
+
licenses = SpecLicenseFinder.find_licenses(spec)
|
|
55
41
|
|
|
56
42
|
component = {
|
|
57
43
|
"type" => "library",
|
data/lib/bundler/sbom/spdx.rb
CHANGED
|
@@ -27,22 +27,8 @@ module Bundler
|
|
|
27
27
|
gem_key = "#{spec.name}:#{spec.version}"
|
|
28
28
|
next if seen_gems.include?(gem_key)
|
|
29
29
|
seen_gems.add(gem_key)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
licenses = []
|
|
33
|
-
if gemspec
|
|
34
|
-
if gemspec.license && !gemspec.license.empty?
|
|
35
|
-
licenses << gemspec.license
|
|
36
|
-
end
|
|
37
|
-
if gemspec.licenses && !gemspec.licenses.empty?
|
|
38
|
-
licenses.concat(gemspec.licenses)
|
|
39
|
-
end
|
|
40
|
-
licenses.uniq!
|
|
41
|
-
end
|
|
42
|
-
license_string = licenses.empty? ? "NOASSERTION" : licenses.join(", ")
|
|
43
|
-
rescue Gem::LoadError
|
|
44
|
-
license_string = "NOASSERTION"
|
|
45
|
-
end
|
|
30
|
+
licenses = SpecLicenseFinder.find_licenses(spec)
|
|
31
|
+
license_string = licenses.empty? ? "NOASSERTION" : licenses.join(", ")
|
|
46
32
|
|
|
47
33
|
package = {
|
|
48
34
|
"SPDXID" => "SPDXRef-Package-#{spec.name}",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Bundler
|
|
2
|
+
module Sbom
|
|
3
|
+
module SpecLicenseFinder
|
|
4
|
+
def self.find_licenses(spec)
|
|
5
|
+
gemspec = spec.__materialize__ if spec.respond_to?(:__materialize__)
|
|
6
|
+
begin
|
|
7
|
+
gemspec ||= Gem::Specification.find_by_name(spec.name, spec.version)
|
|
8
|
+
rescue Gem::LoadError
|
|
9
|
+
# ignore
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
licenses = []
|
|
13
|
+
if gemspec
|
|
14
|
+
if gemspec.respond_to?(:license) && gemspec.license && !gemspec.license.empty?
|
|
15
|
+
licenses << gemspec.license
|
|
16
|
+
end
|
|
17
|
+
if gemspec.respond_to?(:licenses) && gemspec.licenses && !gemspec.licenses.empty?
|
|
18
|
+
licenses.concat(gemspec.licenses)
|
|
19
|
+
end
|
|
20
|
+
licenses.uniq!
|
|
21
|
+
end
|
|
22
|
+
licenses
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/bundler/sbom/version.rb
CHANGED
data/lib/bundler/sbom.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bundler-sbom
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SHIBATA Hiroshi
|
|
@@ -54,6 +54,7 @@ files:
|
|
|
54
54
|
- lib/bundler/sbom/generator.rb
|
|
55
55
|
- lib/bundler/sbom/reporter.rb
|
|
56
56
|
- lib/bundler/sbom/spdx.rb
|
|
57
|
+
- lib/bundler/sbom/spec_license_finder.rb
|
|
57
58
|
- lib/bundler/sbom/version.rb
|
|
58
59
|
- plugins.rb
|
|
59
60
|
homepage: https://github.com/hsbt/bundler-sbom
|