license_scout 2.4.0 → 2.5.0

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: 0cc1880e883f74c45e68c9495f816f7e757a62f16701de45fa77e89c97ed6637
4
- data.tar.gz: 43e3b7c1a111a7fa2f97f5340e3268547aead69d8ff38b8dfd57be47121e4aea
3
+ metadata.gz: 8f29370aa4433c28361002a6e01527d036ce7b2c432a29f5f0824b0be8e50b7e
4
+ data.tar.gz: f54b8c5e6bb9752b0137abb871068b98d7215611c3d9397f812ea4f73a0fb2e5
5
5
  SHA512:
6
- metadata.gz: 4031e209faef9bb783dcef890f9d72ebe87df83711e7730a39680014ffe14bbb4880b9f0f201ed351890cb0b385b3ebe8eb8dee980cba3a702553e1dd738f435
7
- data.tar.gz: 072b2ee320c4f4de3fbeeeca3aab2d4a08476325d441a62b94adcfccbb90ffb241576ab1f5d9f7b6dfb2e9b803057268a993e14dcbab0164dfe5f0f48c404102
6
+ metadata.gz: d4a2d99ab4ddd0541e9fe0899072d187fc2fb87b8c4da4194d113c414f173e010052a947a51f4017ab4ccb3b106d97379994aed61fa75e152b4f612c78061945
7
+ data.tar.gz: 8f1b6f27816f43c994ddf0608b88462ead8d8e4f2a3e1d088b4c14621c2ec3ae239ee012cb69822421b2f67bf30cc885b156c6185125ddfccbc86d39f653f0f8
data/README.md CHANGED
@@ -9,7 +9,7 @@ Dependency Type | Supported Dependency Managers
9
9
  chef_cookbook | berkshelf
10
10
  erlang | rebar
11
11
  elixir | mix
12
- golang | dep, godep, glide
12
+ golang | modules, dep, godep, glide
13
13
  habitat | habitat
14
14
  nodejs | npm
15
15
  perl | cpan
@@ -29,6 +29,7 @@ gem install license_scout
29
29
  * If you wish to scan for `berkshelf` dependencies, you'll need to manually install the Berkshelf gem in the same Ruby as License Scout
30
30
  * If you wish to scan for `mix` or `rebar` dependencies, you'll need to install Erlang OTP 18.3 or greater.
31
31
  * If you wish to scan for `cargo` dependencies, you'll need to manually install cargo
32
+ * If you wish to scan for `go mod` dependencies, you'll need to manually install go
32
33
 
33
34
  ### Habitat
34
35
 
@@ -247,6 +248,14 @@ https://github.com/chef/chef/blob/master/CONTRIBUTING.md
247
248
 
248
249
  Pull requests in this project are merged when they have two :+1:s from maintainers.
249
250
 
251
+ ## GitHub Tokens
252
+
253
+ If you wish to scan private GitHub repositories or are hitting API rate limits, [create a GitHub token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) and set it to this environmental variable:
254
+
255
+ ```
256
+ OCTOKIT_ACCESS_TOKEN=your_token_value
257
+ ```
258
+
250
259
  ## Maintainers
251
260
 
252
261
  - [Dan DeLeo](https://github.com/danielsdeleo)
@@ -24,6 +24,7 @@ require "license_scout/dependency_manager/cpanm"
24
24
  require "license_scout/dependency_manager/dep"
25
25
  require "license_scout/dependency_manager/glide"
26
26
  require "license_scout/dependency_manager/godep"
27
+ require "license_scout/dependency_manager/gomod"
27
28
  require "license_scout/dependency_manager/habitat"
28
29
  require "license_scout/dependency_manager/mix"
29
30
  require "license_scout/dependency_manager/rebar"
@@ -40,6 +41,7 @@ module LicenseScout
40
41
  Dep,
41
42
  Glide,
42
43
  Godep,
44
+ Gomod,
43
45
  Habitat,
44
46
  Mix,
45
47
  Rebar,
@@ -51,6 +51,7 @@ module LicenseScout
51
51
  # @example Go's various package managers
52
52
  # Name Reference
53
53
  # -------- -----------------------------------------------
54
+ # go_mod [`gomod`](https://golang.org/cmd/go/#hdr-The_go_mod_file)
54
55
  # go_dep [`godep`](https://github.com/tools/godep)
55
56
  # go_godep [`dep`](https://github.com/golang/dep)
56
57
  # go_glide [`glide`](https://github.com/Masterminds/glide)
@@ -59,7 +59,7 @@ module LicenseScout
59
59
  Dir.chdir(directory) do
60
60
  install_cargo_license_crate
61
61
 
62
- s = Mixlib::ShellOut.new("cargo license -d -j")
62
+ s = Mixlib::ShellOut.new("cargo-license -d -j")
63
63
  s.run_command
64
64
  s.error!
65
65
 
@@ -0,0 +1,72 @@
1
+ #
2
+ # Copyright:: Copyright 2020, Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require "license_scout/dependency_manager/base"
19
+
20
+ module LicenseScout
21
+ module DependencyManager
22
+ class Gomod < Base
23
+
24
+ def name
25
+ "golang_modules"
26
+ end
27
+
28
+ def type
29
+ "golang"
30
+ end
31
+
32
+ def signature
33
+ "go.sum file"
34
+ end
35
+
36
+ def install_command
37
+ "go mod download"
38
+ end
39
+
40
+ def detected?
41
+ File.exist?(go_sum_file)
42
+ end
43
+
44
+ def dependencies
45
+ go_modules.map do |mod|
46
+ next if mod["Main"] == true
47
+
48
+ dep_name = mod["Path"]
49
+ dep_version = mod["Version"]
50
+ dep_path = mod["Dir"]
51
+
52
+ new_dependency(dep_name, dep_version, dep_path)
53
+ end.compact
54
+ end
55
+
56
+ def go_sum_file
57
+ File.join(directory, "go.sum")
58
+ end
59
+
60
+ def go_modules
61
+ FFI_Yajl::Parser.parse(go_modules_json)
62
+ end
63
+
64
+ def go_modules_json
65
+ s = Mixlib::ShellOut.new("go list -m -json all", cwd: directory, environment: LicenseScout::Config.environment)
66
+ s.run_command
67
+ s.error!
68
+ "[" + s.stdout.gsub("}\n{", "},\n{") + "]"
69
+ end
70
+ end
71
+ end
72
+ end
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module LicenseScout
19
- VERSION = "2.4.0".freeze
19
+ VERSION = "2.5.0".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.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Duffield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-04 00:00:00.000000000 Z
11
+ date: 2020-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-yajl
@@ -167,6 +167,7 @@ files:
167
167
  - lib/license_scout/dependency_manager/dep.rb
168
168
  - lib/license_scout/dependency_manager/glide.rb
169
169
  - lib/license_scout/dependency_manager/godep.rb
170
+ - lib/license_scout/dependency_manager/gomod.rb
170
171
  - lib/license_scout/dependency_manager/habitat.rb
171
172
  - lib/license_scout/dependency_manager/mix.rb
172
173
  - lib/license_scout/dependency_manager/npm.rb