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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f29370aa4433c28361002a6e01527d036ce7b2c432a29f5f0824b0be8e50b7e
4
- data.tar.gz: f54b8c5e6bb9752b0137abb871068b98d7215611c3d9397f812ea4f73a0fb2e5
3
+ metadata.gz: dd43121262b011195253e1d4337bbc5c9a8e16ce86ffc95a0531eef369b35ec6
4
+ data.tar.gz: e047de55037d1fc5135cec96989b30581e58cb3ee7c641529cd3fe8ce1cbd0df
5
5
  SHA512:
6
- metadata.gz: d4a2d99ab4ddd0541e9fe0899072d187fc2fb87b8c4da4194d113c414f173e010052a947a51f4017ab4ccb3b106d97379994aed61fa75e152b4f612c78061945
7
- data.tar.gz: 8f1b6f27816f43c994ddf0608b88462ead8d8e4f2a3e1d088b4c14621c2ec3ae239ee012cb69822421b2f67bf30cc885b156c6185125ddfccbc86d39f653f0f8
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
- FFI_Yajl::Parser.parse(go_modules_json)
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
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module LicenseScout
19
- VERSION = "2.5.0".freeze
19
+ VERSION = "2.5.1".freeze
20
20
  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.0
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-06 00:00:00.000000000 Z
11
+ date: 2020-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-yajl