licensed 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +4 -4
- data/.github/workflows/test.yml +27 -14
- data/CHANGELOG.md +7 -1
- data/lib/licensed/sources/bower.rb +3 -3
- data/lib/licensed/sources/bundler.rb +4 -4
- data/lib/licensed/sources/cabal.rb +7 -7
- data/lib/licensed/sources/composer.rb +3 -3
- data/lib/licensed/sources/dep.rb +3 -3
- data/lib/licensed/sources/git_submodule.rb +3 -3
- data/lib/licensed/sources/go.rb +3 -3
- data/lib/licensed/sources/manifest.rb +12 -12
- data/lib/licensed/sources/npm.rb +7 -3
- data/lib/licensed/sources/pip.rb +8 -6
- data/lib/licensed/sources/pipenv.rb +4 -2
- data/lib/licensed/version.rb +1 -1
- data/licensed.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 399ad5d09b5d158f3c1a51aa719dd0f353bf9a4714d495d3998dd0e38c6b7009
|
4
|
+
data.tar.gz: 72a61d16fa72990cb12421bb29db09c80c15436eb5a85f962ffab089e78f7c99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c267eaf2523970f7e890e8e08eca972fa07cf3b616f66dc68ba010677014cd3ab8f08f7d7496c22345b4cd9801e6386015ff13e0064eed5ee850c12b068f8a5
|
7
|
+
data.tar.gz: ea1f68a031f398a43036648850325f34b44f28e5cfb9da630cc6d6bbdbe8e3b82b5d467b030256d4ed78bb4dda7e7c5820f5dd7fb97af08afe10105db8fc2946
|
@@ -18,7 +18,7 @@ jobs:
|
|
18
18
|
- name: Set up Ruby 2.6
|
19
19
|
uses: actions/setup-ruby@v1
|
20
20
|
with:
|
21
|
-
version: 2.6.x
|
21
|
+
ruby-version: 2.6.x
|
22
22
|
|
23
23
|
- name: Build package
|
24
24
|
run: script/packages/linux
|
@@ -39,7 +39,7 @@ jobs:
|
|
39
39
|
- name: Set up Ruby 2.6
|
40
40
|
uses: actions/setup-ruby@v1
|
41
41
|
with:
|
42
|
-
version: 2.6.x
|
42
|
+
ruby-version: 2.6.x
|
43
43
|
|
44
44
|
- name: Build package
|
45
45
|
run: script/packages/mac
|
@@ -60,7 +60,7 @@ jobs:
|
|
60
60
|
- name: Set up Ruby 2.6
|
61
61
|
uses: actions/setup-ruby@v1
|
62
62
|
with:
|
63
|
-
version: 2.6.x
|
63
|
+
ruby-version: 2.6.x
|
64
64
|
|
65
65
|
- name: Build gem
|
66
66
|
run: gem build *.gemspec
|
@@ -88,7 +88,7 @@ jobs:
|
|
88
88
|
- name: Set up Ruby 2.6
|
89
89
|
uses: actions/setup-ruby@v1
|
90
90
|
with:
|
91
|
-
version: 2.6.x
|
91
|
+
ruby-version: 2.6.x
|
92
92
|
|
93
93
|
- name: Download linux package
|
94
94
|
uses: actions/download-artifact@master
|
data/.github/workflows/test.yml
CHANGED
@@ -15,11 +15,11 @@ jobs:
|
|
15
15
|
- name: Setup node
|
16
16
|
uses: actions/setup-node@v1
|
17
17
|
with:
|
18
|
-
version: 8
|
18
|
+
node-version: 8
|
19
19
|
- name: Set up Ruby
|
20
20
|
uses: actions/setup-ruby@v1
|
21
21
|
with:
|
22
|
-
version: 2.6.x
|
22
|
+
ruby-version: 2.6.x
|
23
23
|
- name: Bootstrap
|
24
24
|
run: script/bootstrap
|
25
25
|
- name: Set up fixtures
|
@@ -37,7 +37,7 @@ jobs:
|
|
37
37
|
- name: Set up Ruby
|
38
38
|
uses: actions/setup-ruby@v1
|
39
39
|
with:
|
40
|
-
version: 2.6.x
|
40
|
+
ruby-version: 2.6.x
|
41
41
|
- name: Set up Bundler
|
42
42
|
run: |
|
43
43
|
yes | gem uninstall bundler --all
|
@@ -60,7 +60,7 @@ jobs:
|
|
60
60
|
- name: Set up Ruby
|
61
61
|
uses: actions/setup-ruby@v1
|
62
62
|
with:
|
63
|
-
version: 2.6.x
|
63
|
+
ruby-version: 2.6.x
|
64
64
|
- name: Setup Haskell
|
65
65
|
uses: actions/setup-haskell@v1
|
66
66
|
with:
|
@@ -83,7 +83,7 @@ jobs:
|
|
83
83
|
- name: Set up Ruby
|
84
84
|
uses: actions/setup-ruby@v1
|
85
85
|
with:
|
86
|
-
version: ${{matrix.ruby}}
|
86
|
+
ruby-version: ${{matrix.ruby}}
|
87
87
|
- name: Set up Bundler
|
88
88
|
run: gem install bundler
|
89
89
|
- name: Bootstrap
|
@@ -104,7 +104,7 @@ jobs:
|
|
104
104
|
- name: Set up Ruby
|
105
105
|
uses: actions/setup-ruby@v1
|
106
106
|
with:
|
107
|
-
version: 2.6.x
|
107
|
+
ruby-version: 2.6.x
|
108
108
|
- name: Bootstrap
|
109
109
|
run: script/bootstrap
|
110
110
|
- name: Set up fixtures
|
@@ -126,7 +126,7 @@ jobs:
|
|
126
126
|
- name: Set up Ruby
|
127
127
|
uses: actions/setup-ruby@v1
|
128
128
|
with:
|
129
|
-
version: 2.6.x
|
129
|
+
ruby-version: 2.6.x
|
130
130
|
- name: Bootstrap
|
131
131
|
run: script/bootstrap
|
132
132
|
- name: Set up fixtures
|
@@ -144,11 +144,11 @@ jobs:
|
|
144
144
|
- name: Setup node
|
145
145
|
uses: actions/setup-node@v1
|
146
146
|
with:
|
147
|
-
version: ${{ matrix.node_version }}
|
147
|
+
node-version: ${{ matrix.node_version }}
|
148
148
|
- name: Set up Ruby
|
149
149
|
uses: actions/setup-ruby@v1
|
150
150
|
with:
|
151
|
-
version: 2.6.x
|
151
|
+
ruby-version: 2.6.x
|
152
152
|
- name: Bootstrap
|
153
153
|
run: script/bootstrap
|
154
154
|
- name: Set up fixtures
|
@@ -163,7 +163,7 @@ jobs:
|
|
163
163
|
- name: Set up Ruby
|
164
164
|
uses: actions/setup-ruby@v1
|
165
165
|
with:
|
166
|
-
version: 2.6.x
|
166
|
+
ruby-version: 2.6.x
|
167
167
|
- name: Bootstrap
|
168
168
|
run: script/bootstrap
|
169
169
|
- name: Gradle version
|
@@ -186,7 +186,7 @@ jobs:
|
|
186
186
|
- name: Set up Ruby
|
187
187
|
uses: actions/setup-ruby@v1
|
188
188
|
with:
|
189
|
-
version: 2.6.x
|
189
|
+
ruby-version: 2.6.x
|
190
190
|
- name: Bootstrap
|
191
191
|
run: script/bootstrap
|
192
192
|
- name: Install virtualenv
|
@@ -208,7 +208,7 @@ jobs:
|
|
208
208
|
- name: Set up Ruby
|
209
209
|
uses: actions/setup-ruby@v1
|
210
210
|
with:
|
211
|
-
version: 2.6.x
|
211
|
+
ruby-version: 2.6.x
|
212
212
|
- name: Bootstrap
|
213
213
|
run: script/bootstrap
|
214
214
|
- name: Install pipenv
|
@@ -232,7 +232,7 @@ jobs:
|
|
232
232
|
- name: Set up Ruby
|
233
233
|
uses: actions/setup-ruby@v1
|
234
234
|
with:
|
235
|
-
version: 2.6.x
|
235
|
+
ruby-version: 2.6.x
|
236
236
|
- name: Bootstrap
|
237
237
|
run: script/bootstrap
|
238
238
|
- name: Set up fixtures
|
@@ -255,10 +255,23 @@ jobs:
|
|
255
255
|
- name: Set up Ruby
|
256
256
|
uses: actions/setup-ruby@v1
|
257
257
|
with:
|
258
|
-
version: 2.6.x
|
258
|
+
ruby-version: 2.6.x
|
259
259
|
- name: Bootstrap
|
260
260
|
run: script/bootstrap
|
261
261
|
- name: Set up fixtures
|
262
262
|
run: script/source-setup/mix
|
263
263
|
- name: Run tests
|
264
264
|
run: script/test mix
|
265
|
+
|
266
|
+
manifest:
|
267
|
+
runs-on: ubuntu-latest
|
268
|
+
steps:
|
269
|
+
- uses: actions/checkout@master
|
270
|
+
- name: Set up Ruby
|
271
|
+
uses: actions/setup-ruby@v1
|
272
|
+
with:
|
273
|
+
ruby-version: 2.6.x
|
274
|
+
- name: Bootstrap
|
275
|
+
run: script/bootstrap
|
276
|
+
- name: Run tests
|
277
|
+
run: script/test manifest
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## 2.6.1
|
10
|
+
2019-10-26
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- Performance improvements during dependency enumeration (:tada: @krzysztof-pawlik-gat https://github.com/github/licensed/pull/204, https://github.com/github/licensed/pull/207) (https://github.com/github/licensed/pull/210)
|
14
|
+
|
9
15
|
## 2.6.0
|
10
16
|
2019-10-22
|
11
17
|
|
@@ -229,4 +235,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
229
235
|
|
230
236
|
Initial release :tada:
|
231
237
|
|
232
|
-
[Unreleased]: https://github.com/github/licensed/compare/2.6.
|
238
|
+
[Unreleased]: https://github.com/github/licensed/compare/2.6.1...HEAD
|
@@ -5,7 +5,7 @@ module Licensed
|
|
5
5
|
module Sources
|
6
6
|
class Bower < Source
|
7
7
|
def enabled?
|
8
|
-
[
|
8
|
+
[config.pwd.join(".bowerrc"), config.pwd.join("bower.json")].any? do |path|
|
9
9
|
File.exist?(path)
|
10
10
|
end
|
11
11
|
end
|
@@ -30,7 +30,7 @@ module Licensed
|
|
30
30
|
# Returns a parsed ".bowerrc" configuration, or an empty hash if not found
|
31
31
|
def bower_config
|
32
32
|
@bower_config ||= begin
|
33
|
-
path =
|
33
|
+
path = config.pwd.join(".bowerrc")
|
34
34
|
path.exist? ? JSON.parse(path.read) : {}
|
35
35
|
end
|
36
36
|
end
|
@@ -38,7 +38,7 @@ module Licensed
|
|
38
38
|
# Returns the expected path to bower components.
|
39
39
|
# Note this does not validate that the returned path is valid
|
40
40
|
def bower_path
|
41
|
-
pwd = bower_config["cwd"] ? Pathname.new(bower_config["cwd"]).expand_path :
|
41
|
+
pwd = bower_config["cwd"] ? Pathname.new(bower_config["cwd"]).expand_path : config.pwd
|
42
42
|
pwd.join bower_config["directory"] || "bower_components"
|
43
43
|
end
|
44
44
|
end
|
@@ -264,7 +264,7 @@ module Licensed
|
|
264
264
|
# Defaults to [:development, :test] + ::Bundler.settings[:without]
|
265
265
|
def exclude_groups
|
266
266
|
@exclude_groups ||= begin
|
267
|
-
exclude = Array(
|
267
|
+
exclude = Array(config.dig("bundler", "without"))
|
268
268
|
exclude = DEFAULT_WITHOUT_GROUPS if exclude.empty?
|
269
269
|
exclude.uniq.map(&:to_sym)
|
270
270
|
end
|
@@ -272,7 +272,7 @@ module Licensed
|
|
272
272
|
|
273
273
|
# Returns the path to the Bundler Gemfile
|
274
274
|
def gemfile_path
|
275
|
-
@gemfile_path ||= GEMFILES.map { |g|
|
275
|
+
@gemfile_path ||= GEMFILES.map { |g| config.pwd.join g }
|
276
276
|
.find { |f| f.exist? }
|
277
277
|
end
|
278
278
|
|
@@ -285,10 +285,10 @@ module Licensed
|
|
285
285
|
# Returns the configured bundler executable to use, or "bundle" by default.
|
286
286
|
def bundler_exe
|
287
287
|
@bundler_exe ||= begin
|
288
|
-
exe =
|
288
|
+
exe = config.dig("bundler", "bundler_exe")
|
289
289
|
return "bundle" unless exe
|
290
290
|
return exe if Licensed::Shell.tool_available?(exe)
|
291
|
-
|
291
|
+
config.root.join(exe)
|
292
292
|
end
|
293
293
|
end
|
294
294
|
|
@@ -43,7 +43,7 @@ module Licensed
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
Parallel.map(package_ids) { |id| package_info(id) }.concat(missing)
|
47
47
|
end
|
48
48
|
|
49
49
|
# Returns the packages document directory and search root directory
|
@@ -52,7 +52,7 @@ module Licensed
|
|
52
52
|
unless package["haddock-html"]
|
53
53
|
# default to a local vendor directory if haddock-html property
|
54
54
|
# isn't available
|
55
|
-
return [File.join(
|
55
|
+
return [File.join(config.pwd, "vendor", package["name"]), nil]
|
56
56
|
end
|
57
57
|
|
58
58
|
html_dir = package["haddock-html"]
|
@@ -85,7 +85,7 @@ module Licensed
|
|
85
85
|
|
86
86
|
results.merge new_packages
|
87
87
|
|
88
|
-
dependencies = new_packages
|
88
|
+
dependencies = Parallel.map(new_packages, &method(:package_dependencies)).flatten
|
89
89
|
|
90
90
|
return results if dependencies.empty?
|
91
91
|
|
@@ -131,10 +131,10 @@ module Licensed
|
|
131
131
|
# Returns an array of ghc package DB locations as specified in the app
|
132
132
|
# configuration
|
133
133
|
def package_db_args
|
134
|
-
@package_db_args ||= Array(
|
134
|
+
@package_db_args ||= Array(config.dig("cabal", "ghc_package_db")).map do |path|
|
135
135
|
next "--#{path}" if %w(global user).include?(path)
|
136
136
|
path = realized_ghc_package_path(path)
|
137
|
-
path = File.expand_path(path,
|
137
|
+
path = File.expand_path(path, config.root)
|
138
138
|
|
139
139
|
next unless File.exist?(path)
|
140
140
|
"--package-db=#{path}"
|
@@ -196,14 +196,14 @@ module Licensed
|
|
196
196
|
|
197
197
|
# Returns the targets to search for `build-depends` in a cabal file
|
198
198
|
def cabal_file_targets
|
199
|
-
targets = Array(
|
199
|
+
targets = Array(config.dig("cabal", "cabal_file_targets"))
|
200
200
|
targets.push(*DEFAULT_TARGETS) if targets.empty?
|
201
201
|
targets
|
202
202
|
end
|
203
203
|
|
204
204
|
# Returns an array of the local directory cabal package files
|
205
205
|
def cabal_files
|
206
|
-
@cabal_files ||= Dir.glob(File.join(
|
206
|
+
@cabal_files ||= Dir.glob(File.join(config.pwd, "*.cabal"))
|
207
207
|
end
|
208
208
|
|
209
209
|
# Returns the ghc cli tool version
|
@@ -49,12 +49,12 @@ module Licensed
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def composer_application_path
|
52
|
-
setting =
|
53
|
-
File.expand_path(setting,
|
52
|
+
setting = config.dig("composer", "application_path") || DEFAULT_COMPOSER_APPLICATON_PATH
|
53
|
+
File.expand_path(setting, config.pwd)
|
54
54
|
end
|
55
55
|
|
56
56
|
def composer_lock
|
57
|
-
|
57
|
+
config.pwd.join("composer.lock")
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
data/lib/licensed/sources/dep.rb
CHANGED
@@ -10,8 +10,8 @@ module Licensed
|
|
10
10
|
|
11
11
|
def enumerate_dependencies
|
12
12
|
packages.map do |package|
|
13
|
-
package_dir =
|
14
|
-
search_root =
|
13
|
+
package_dir = config.pwd.join("vendor", package[:name])
|
14
|
+
search_root = config.pwd.join("vendor", package[:project])
|
15
15
|
|
16
16
|
Dependency.new(
|
17
17
|
name: package[:name],
|
@@ -52,7 +52,7 @@ module Licensed
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def gopkg_lock_path
|
55
|
-
|
55
|
+
config.pwd.join("Gopkg.lock")
|
56
56
|
end
|
57
57
|
|
58
58
|
# Returns a list of go standard packages
|
@@ -20,7 +20,7 @@ module Licensed
|
|
20
20
|
git_submodules_command.lines.map do |line|
|
21
21
|
displaypath, toplevel, version, homepage = line.strip.split
|
22
22
|
name = File.basename(displaypath)
|
23
|
-
submodule_path = if toplevel ==
|
23
|
+
submodule_path = if toplevel == config.pwd.to_s
|
24
24
|
name
|
25
25
|
else
|
26
26
|
parent = File.basename(toplevel)
|
@@ -31,7 +31,7 @@ module Licensed
|
|
31
31
|
Licensed::Dependency.new(
|
32
32
|
name: submodule_path,
|
33
33
|
version: version,
|
34
|
-
path:
|
34
|
+
path: config.pwd.join(displaypath),
|
35
35
|
metadata: {
|
36
36
|
"type" => self.class.type,
|
37
37
|
"name" => name,
|
@@ -50,7 +50,7 @@ module Licensed
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def gitmodules_path
|
53
|
-
|
53
|
+
config.pwd.join(".gitmodules")
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/lib/licensed/sources/go.rb
CHANGED
@@ -54,7 +54,7 @@ module Licensed
|
|
54
54
|
def root_package_deps
|
55
55
|
# check for ignored packages to avoid raising errors calling `go list`
|
56
56
|
# when ignored package is not found
|
57
|
-
Array(root_package["Deps"])
|
57
|
+
Parallel.map(Array(root_package["Deps"])) { |name| package_info(name) }
|
58
58
|
end
|
59
59
|
|
60
60
|
# Returns the list of dependencies as returned by "go list -json -deps"
|
@@ -196,12 +196,12 @@ module Licensed
|
|
196
196
|
def gopath
|
197
197
|
return @gopath if defined?(@gopath)
|
198
198
|
|
199
|
-
path =
|
199
|
+
path = config.dig("go", "GOPATH")
|
200
200
|
@gopath = if path.nil? || path.empty?
|
201
201
|
ENV["GOPATH"]
|
202
202
|
else
|
203
203
|
root = begin
|
204
|
-
|
204
|
+
config.root
|
205
205
|
rescue Licensed::Shell::Error
|
206
206
|
Pathname.pwd
|
207
207
|
end
|
@@ -12,7 +12,7 @@ module Licensed
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def enumerate_dependencies
|
15
|
-
|
15
|
+
Parallel.map(packages) do |package_name, sources|
|
16
16
|
Licensed::Sources::Manifest::Dependency.new(
|
17
17
|
name: package_name,
|
18
18
|
version: contents_version(*sources),
|
@@ -28,10 +28,10 @@ module Licensed
|
|
28
28
|
|
29
29
|
# Returns the license path for a package specified in the configuration.
|
30
30
|
def configured_license_path(package_name)
|
31
|
-
license_path =
|
31
|
+
license_path = config.dig("manifest", "licenses", package_name)
|
32
32
|
return unless license_path
|
33
33
|
|
34
|
-
license_path =
|
34
|
+
license_path = config.root.join(license_path)
|
35
35
|
return unless license_path.exist?
|
36
36
|
license_path
|
37
37
|
end
|
@@ -46,7 +46,7 @@ module Licensed
|
|
46
46
|
# don't allow the workspace root to be used as common prefix
|
47
47
|
# the project this is run for should be excluded from the manifest,
|
48
48
|
# or ignored in the config. any license in the root should be ignored.
|
49
|
-
return common_prefix if common_prefix !=
|
49
|
+
return common_prefix if common_prefix != config.root
|
50
50
|
end
|
51
51
|
|
52
52
|
# use the first (or only) sources directory to find license information
|
@@ -61,7 +61,7 @@ module Licensed
|
|
61
61
|
manifest.each_with_object({}) do |(src, package_name), hsh|
|
62
62
|
next if src.nil? || src.empty?
|
63
63
|
hsh[package_name] ||= []
|
64
|
-
hsh[package_name] << File.join(
|
64
|
+
hsh[package_name] << File.join(config.root, src)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -79,15 +79,15 @@ module Licensed
|
|
79
79
|
|
80
80
|
# Returns the manifest location for the app
|
81
81
|
def manifest_path
|
82
|
-
path =
|
83
|
-
return
|
82
|
+
path = config.dig("manifest", "path")
|
83
|
+
return config.root.join(path) if path
|
84
84
|
|
85
|
-
|
85
|
+
config.cache_path.join("manifest.json")
|
86
86
|
end
|
87
87
|
|
88
88
|
# Returns whether a manifest should be generated automatically
|
89
89
|
def generate_manifest?
|
90
|
-
!File.exist?(manifest_path) &&
|
90
|
+
!File.exist?(manifest_path) && !config.dig("manifest", "dependencies").nil?
|
91
91
|
end
|
92
92
|
|
93
93
|
# Returns a manifest of files generated automatically based on patterns
|
@@ -128,7 +128,7 @@ module Licensed
|
|
128
128
|
# Returns the project dependencies specified from the licensed configuration
|
129
129
|
def configured_dependencies
|
130
130
|
@configured_dependencies ||= begin
|
131
|
-
dependencies =
|
131
|
+
dependencies = config.dig("manifest", "dependencies")&.dup || {}
|
132
132
|
|
133
133
|
dependencies.each do |name, patterns|
|
134
134
|
# map glob pattern(s) listed for the dependency to a listing
|
@@ -142,7 +142,7 @@ module Licensed
|
|
142
142
|
|
143
143
|
# Returns the set of project files that are included in dependency evaluation
|
144
144
|
def included_files
|
145
|
-
@sources ||= all_files - files_from_pattern_list(
|
145
|
+
@sources ||= all_files - files_from_pattern_list(config.dig("manifest", "exclude"))
|
146
146
|
end
|
147
147
|
|
148
148
|
# Finds and returns all files in the project that match
|
@@ -151,7 +151,7 @@ module Licensed
|
|
151
151
|
return Set.new if patterns.nil? || patterns.empty?
|
152
152
|
|
153
153
|
# evaluate all patterns from the project root
|
154
|
-
Dir.chdir
|
154
|
+
Dir.chdir config.root do
|
155
155
|
Array(patterns).reduce(Set.new) do |files, pattern|
|
156
156
|
if pattern.start_with?("!")
|
157
157
|
# if the pattern is an exclusion, remove all matching files
|
data/lib/licensed/sources/npm.rb
CHANGED
@@ -9,11 +9,10 @@ module Licensed
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def enabled?
|
12
|
-
Licensed::Shell.tool_available?("npm") && File.exist?(
|
12
|
+
Licensed::Shell.tool_available?("npm") && File.exist?(config.pwd.join("package.json"))
|
13
13
|
end
|
14
14
|
|
15
15
|
def enumerate_dependencies
|
16
|
-
@yarn_lock_present = File.exist?(@config.pwd.join("yarn.lock"))
|
17
16
|
packages.map do |name, package|
|
18
17
|
path = package["path"]
|
19
18
|
Dependency.new(
|
@@ -49,7 +48,7 @@ module Licensed
|
|
49
48
|
# package name to it's metadata
|
50
49
|
def recursive_dependencies(dependencies, result = {})
|
51
50
|
dependencies.each do |name, dependency|
|
52
|
-
next if
|
51
|
+
next if yarn_lock_present && dependency["missing"]
|
53
52
|
(result[name] ||= []) << dependency
|
54
53
|
recursive_dependencies(dependency["dependencies"] || {}, result)
|
55
54
|
end
|
@@ -60,6 +59,11 @@ module Licensed
|
|
60
59
|
def package_metadata_command
|
61
60
|
Licensed::Shell.execute("npm", "list", "--json", "--production", "--long", allow_failure: true)
|
62
61
|
end
|
62
|
+
|
63
|
+
# Returns true if a yarn.lock file exists in the current directory
|
64
|
+
def yarn_lock_present
|
65
|
+
@yarn_lock_present ||= File.exist?(config.pwd.join("yarn.lock"))
|
66
|
+
end
|
63
67
|
end
|
64
68
|
end
|
65
69
|
end
|
data/lib/licensed/sources/pip.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
3
|
require "English"
|
4
|
+
require "json"
|
5
|
+
require "parallel"
|
4
6
|
|
5
7
|
module Licensed
|
6
8
|
module Sources
|
@@ -10,11 +12,11 @@ module Licensed
|
|
10
12
|
|
11
13
|
def enabled?
|
12
14
|
return unless virtual_env_pip && Licensed::Shell.tool_available?(virtual_env_pip)
|
13
|
-
File.exist?(
|
15
|
+
File.exist?(config.pwd.join("requirements.txt"))
|
14
16
|
end
|
15
17
|
|
16
18
|
def enumerate_dependencies
|
17
|
-
|
19
|
+
Parallel.map(packages_from_requirements_txt, in_threads: Parallel.processor_count) do |package_name|
|
18
20
|
package = package_info(package_name)
|
19
21
|
location = File.join(package["Location"], package["Name"].gsub("-", "_") + "-" + package["Version"] + ".dist-info")
|
20
22
|
Dependency.new(
|
@@ -33,7 +35,7 @@ module Licensed
|
|
33
35
|
private
|
34
36
|
|
35
37
|
def packages_from_requirements_txt
|
36
|
-
File.read(
|
38
|
+
File.read(config.pwd.join("requirements.txt"))
|
37
39
|
.lines
|
38
40
|
.reject { |line| line.include?("://") }
|
39
41
|
.map { |line| line.strip.match(PACKAGE_REGEX) { |match| match.captures.first } }
|
@@ -61,8 +63,8 @@ module Licensed
|
|
61
63
|
def virtual_env_dir
|
62
64
|
return @virtual_env_dir if defined?(@virtual_env_dir)
|
63
65
|
@virtual_env_dir = begin
|
64
|
-
venv_dir =
|
65
|
-
File.expand_path(venv_dir,
|
66
|
+
venv_dir = config.dig("python", "virtual_env_dir")
|
67
|
+
File.expand_path(venv_dir, config.root) if venv_dir
|
66
68
|
end
|
67
69
|
end
|
68
70
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "parallel"
|
4
|
+
|
3
5
|
module Licensed
|
4
6
|
module Sources
|
5
7
|
class Pipenv < Source
|
6
8
|
def enabled?
|
7
|
-
Licensed::Shell.tool_available?("pipenv") && File.exist?(
|
9
|
+
Licensed::Shell.tool_available?("pipenv") && File.exist?(config.pwd.join("Pipfile.lock"))
|
8
10
|
end
|
9
11
|
|
10
12
|
def enumerate_dependencies
|
11
|
-
|
13
|
+
Parallel.map(pakages_from_pipfile_lock, in_threads: Parallel.processor_count) do |package_name|
|
12
14
|
package = package_info(package_name)
|
13
15
|
location = File.join(package["Location"], package["Name"].gsub("-", "_") + "-" + package["Version"] + ".dist-info")
|
14
16
|
Dependency.new(
|
data/lib/licensed/version.rb
CHANGED
data/licensed.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency "tomlrb", "~> 1.2"
|
30
30
|
spec.add_dependency "bundler", ">= 1.10"
|
31
31
|
spec.add_dependency "ruby-xxHash", "~> 0.4"
|
32
|
+
spec.add_dependency "parallel", ">= 0.18.0"
|
32
33
|
|
33
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
34
35
|
spec.add_development_dependency "minitest", "~> 5.8"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: licensed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: licensee
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.4'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: parallel
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.18.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.18.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rake
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|