license_scout 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/license_scout/dependency_manager/gomod.rb +42 -1
- data/lib/license_scout/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd43121262b011195253e1d4337bbc5c9a8e16ce86ffc95a0531eef369b35ec6
|
4
|
+
data.tar.gz: e047de55037d1fc5135cec96989b30581e58cb3ee7c641529cd3fe8ce1cbd0df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3a30a65a74f1b83b1f23ce9bd98722ad6e603134508b0392527510f35bad3f811553b544960af7029b434ec87a53feada7313ec1105bf348f784e209de03217
|
7
|
+
data.tar.gz: a53752fd8831112fa724eb8b178be6ef9645db8fa0aff980b04cca14bfc533737b0e87cfadff8cc09b89753ff4e5231fd37619b738326112d0200e9492cb958c
|
@@ -57,8 +57,27 @@ module LicenseScout
|
|
57
57
|
File.join(directory, "go.sum")
|
58
58
|
end
|
59
59
|
|
60
|
+
def vendor_dir
|
61
|
+
File.join(directory, "vendor")
|
62
|
+
end
|
63
|
+
|
64
|
+
def modules_txt_file
|
65
|
+
File.join(vendor_dir, "modules.txt")
|
66
|
+
end
|
67
|
+
|
60
68
|
def go_modules
|
61
|
-
|
69
|
+
if vendor_mode
|
70
|
+
GoModulesTxtParser.parse(File.read(modules_txt_file), vendor_dir)
|
71
|
+
else
|
72
|
+
FFI_Yajl::Parser.parse(go_modules_json)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def vendor_mode
|
77
|
+
if @vendor_mode.nil?
|
78
|
+
@vendor_mode = File.directory?(vendor_dir)
|
79
|
+
end
|
80
|
+
@vendor_mode
|
62
81
|
end
|
63
82
|
|
64
83
|
def go_modules_json
|
@@ -69,4 +88,26 @@ module LicenseScout
|
|
69
88
|
end
|
70
89
|
end
|
71
90
|
end
|
91
|
+
|
92
|
+
module GoModulesTxtParser
|
93
|
+
# The modules.txt file has lines that look like:
|
94
|
+
#
|
95
|
+
# # gopkg.in/square/go-jose.v2 v2.1.3
|
96
|
+
#
|
97
|
+
# We parse these lines and return something that looks like `go
|
98
|
+
# list -m -json all` output.
|
99
|
+
def self.parse(data, base_path)
|
100
|
+
data.lines.map do |l|
|
101
|
+
if l.start_with?("#")
|
102
|
+
parts = l.split
|
103
|
+
{
|
104
|
+
"Main" => false,
|
105
|
+
"Path" => parts[1],
|
106
|
+
"Version" => parts[2],
|
107
|
+
"Dir" => File.join(base_path, parts[1]),
|
108
|
+
}
|
109
|
+
end
|
110
|
+
end.compact
|
111
|
+
end
|
112
|
+
end
|
72
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: license_scout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Duffield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi-yajl
|