license_finder 5.4.1 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +18 -12
- data/Dockerfile +7 -4
- data/README.md +15 -14
- data/Rakefile +9 -1
- data/bin/license_finder +1 -0
- data/ci/pipelines/{pipeline.yml.erb → pull-request.yml.erb} +25 -37
- data/ci/pipelines/release.yml.erb +199 -0
- data/ci/scripts/run-rubocop.sh +1 -1
- data/ci/scripts/run-tests.sh +0 -14
- data/ci/tasks/run-tests.yml +10 -0
- data/dlf +2 -2
- data/lib/license_finder.rb +2 -0
- data/lib/license_finder/cli.rb +2 -0
- data/lib/license_finder/cli/approvals.rb +2 -0
- data/lib/license_finder/cli/base.rb +2 -0
- data/lib/license_finder/cli/blacklist.rb +2 -0
- data/lib/license_finder/cli/dependencies.rb +2 -0
- data/lib/license_finder/cli/ignored_dependencies.rb +2 -0
- data/lib/license_finder/cli/ignored_groups.rb +2 -0
- data/lib/license_finder/cli/licenses.rb +2 -0
- data/lib/license_finder/cli/main.rb +3 -0
- data/lib/license_finder/cli/makes_decisions.rb +2 -0
- data/lib/license_finder/cli/patched_thor.rb +2 -0
- data/lib/license_finder/cli/project_name.rb +2 -0
- data/lib/license_finder/cli/whitelist.rb +2 -0
- data/lib/license_finder/configuration.rb +3 -0
- data/lib/license_finder/core.rb +3 -1
- data/lib/license_finder/decision_applier.rb +2 -0
- data/lib/license_finder/decisions.rb +2 -0
- data/lib/license_finder/decisions_factory.rb +2 -0
- data/lib/license_finder/diff.rb +5 -3
- data/lib/license_finder/license.rb +2 -0
- data/lib/license_finder/license/any_matcher.rb +2 -0
- data/lib/license_finder/license/definitions.rb +2 -0
- data/lib/license_finder/license/header_matcher.rb +2 -0
- data/lib/license_finder/license/matcher.rb +2 -0
- data/lib/license_finder/license/none_matcher.rb +2 -0
- data/lib/license_finder/license/template.rb +2 -0
- data/lib/license_finder/license/text.rb +2 -0
- data/lib/license_finder/license_aggregator.rb +4 -0
- data/lib/license_finder/logger.rb +6 -2
- data/lib/license_finder/package.rb +3 -0
- data/lib/license_finder/package_delta.rb +3 -1
- data/lib/license_finder/package_manager.rb +5 -1
- data/lib/license_finder/package_managers/bower.rb +2 -0
- data/lib/license_finder/package_managers/bundler.rb +3 -0
- data/lib/license_finder/package_managers/cargo.rb +3 -0
- data/lib/license_finder/package_managers/carthage.rb +2 -0
- data/lib/license_finder/package_managers/cocoa_pods.rb +2 -0
- data/lib/license_finder/package_managers/conan.rb +2 -0
- data/lib/license_finder/package_managers/dep.rb +2 -0
- data/lib/license_finder/package_managers/glide.rb +2 -0
- data/lib/license_finder/package_managers/go_15vendorexperiment.rb +4 -0
- data/lib/license_finder/package_managers/go_dep.rb +26 -20
- data/lib/license_finder/package_managers/go_modules.rb +62 -0
- data/lib/license_finder/package_managers/go_workspace.rb +6 -0
- data/lib/license_finder/package_managers/govendor.rb +15 -3
- data/lib/license_finder/package_managers/gradle.rb +2 -0
- data/lib/license_finder/package_managers/gvt.rb +5 -1
- data/lib/license_finder/package_managers/maven.rb +2 -0
- data/lib/license_finder/package_managers/mix.rb +2 -0
- data/lib/license_finder/package_managers/npm.rb +4 -0
- data/lib/license_finder/package_managers/nuget.rb +5 -0
- data/lib/license_finder/package_managers/pip.rb +4 -1
- data/lib/license_finder/package_managers/rebar.rb +2 -0
- data/lib/license_finder/package_managers/sbt.rb +2 -0
- data/lib/license_finder/package_managers/yarn.rb +6 -2
- data/lib/license_finder/package_utils/activation.rb +2 -0
- data/lib/license_finder/package_utils/conan_info_parser.rb +3 -0
- data/lib/license_finder/package_utils/gradle_dependency_finder.rb +2 -0
- data/lib/license_finder/package_utils/license_files.rb +4 -1
- data/lib/license_finder/package_utils/licensing.rb +5 -3
- data/lib/license_finder/package_utils/maven_dependency_finder.rb +2 -0
- data/lib/license_finder/package_utils/possible_license_file.rb +2 -0
- data/lib/license_finder/package_utils/sbt_dependency_finder.rb +2 -0
- data/lib/license_finder/packages/bower_package.rb +2 -0
- data/lib/license_finder/packages/bundler_package.rb +2 -0
- data/lib/license_finder/packages/cargo_package.rb +2 -0
- data/lib/license_finder/packages/carthage_package.rb +2 -0
- data/lib/license_finder/packages/cocoa_pods_package.rb +2 -0
- data/lib/license_finder/packages/conan_package.rb +2 -0
- data/lib/license_finder/packages/go_package.rb +4 -0
- data/lib/license_finder/packages/gradle_package.rb +2 -0
- data/lib/license_finder/packages/manual_package.rb +2 -0
- data/lib/license_finder/packages/maven_package.rb +2 -0
- data/lib/license_finder/packages/merged_package.rb +2 -0
- data/lib/license_finder/packages/mix_package.rb +2 -0
- data/lib/license_finder/packages/npm_package.rb +5 -0
- data/lib/license_finder/packages/nuget_package.rb +2 -0
- data/lib/license_finder/packages/pip_package.rb +4 -0
- data/lib/license_finder/packages/rebar_package.rb +2 -0
- data/lib/license_finder/packages/sbt_package.rb +2 -0
- data/lib/license_finder/packages/yarn_package.rb +2 -0
- data/lib/license_finder/platform.rb +2 -0
- data/lib/license_finder/project_finder.rb +3 -0
- data/lib/license_finder/report.rb +2 -0
- data/lib/license_finder/scanner.rb +3 -1
- data/lib/license_finder/shared_helpers/cmd.rb +2 -0
- data/lib/license_finder/shared_helpers/common_path.rb +8 -6
- data/lib/license_finder/version.rb +3 -1
- data/license_finder.gemspec +5 -2
- metadata +21 -5
- data/ci/pipelines/release.yml +0 -112
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'license_finder/package_utils/possible_license_file'
|
2
4
|
|
3
5
|
module LicenseFinder
|
4
6
|
class LicenseFiles
|
5
7
|
CANDIDATE_FILE_NAMES = %w[LICENSE License LICENCE Licence COPYING README Readme ReadMe].freeze
|
6
|
-
CANDIDATE_PATH_WILDCARD = "*{#{CANDIDATE_FILE_NAMES.join(',')}}*"
|
8
|
+
CANDIDATE_PATH_WILDCARD = "*{#{CANDIDATE_FILE_NAMES.join(',')}}*"
|
7
9
|
|
8
10
|
def self.find(install_path, options = {})
|
9
11
|
new(install_path).find(options)
|
@@ -32,6 +34,7 @@ module LicenseFinder
|
|
32
34
|
|
33
35
|
def candidate_files_and_dirs
|
34
36
|
return [] if install_path.nil?
|
37
|
+
|
35
38
|
Pathname.glob(install_path.join('**', CANDIDATE_PATH_WILDCARD))
|
36
39
|
end
|
37
40
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'license_finder/package_utils/activation'
|
2
4
|
|
3
5
|
module LicenseFinder
|
@@ -14,17 +16,17 @@ module LicenseFinder
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def activations_from_decisions
|
17
|
-
@
|
19
|
+
@activations_from_decisions ||= decided_licenses
|
18
20
|
.map { |license| Activation::FromDecision.new(package, license) }
|
19
21
|
end
|
20
22
|
|
21
23
|
def activations_from_spec
|
22
|
-
@
|
24
|
+
@activations_from_spec ||= licenses_from_spec
|
23
25
|
.map { |license| Activation::FromSpec.new(package, license) }
|
24
26
|
end
|
25
27
|
|
26
28
|
def activations_from_files
|
27
|
-
@
|
29
|
+
@activations_from_files ||= license_files
|
28
30
|
.group_by(&:license)
|
29
31
|
.map { |license, files| Activation::FromFiles.new(package, license, files) }
|
30
32
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module LicenseFinder
|
2
4
|
class NpmPackage < Package
|
3
5
|
attr_accessor :identifier, :dependencies, :groups, :json
|
@@ -36,6 +38,7 @@ module LicenseFinder
|
|
36
38
|
group.package_names.each do |package_name|
|
37
39
|
@packages.each_key do |identifier|
|
38
40
|
next unless identifier.name == package_name
|
41
|
+
|
39
42
|
dependency = @packages[identifier]
|
40
43
|
dependency.groups |= [group.name]
|
41
44
|
populate_child_groups(dependency, @packages)
|
@@ -47,6 +50,7 @@ module LicenseFinder
|
|
47
50
|
def populate_child_groups(dependency, packages, populated_ids = [])
|
48
51
|
dependency.dependencies.each do |id|
|
49
52
|
next if populated_ids.include? id
|
53
|
+
|
50
54
|
populated_ids.push id
|
51
55
|
packages[id].groups |= dependency.groups
|
52
56
|
populate_child_groups(packages[id], packages, populated_ids)
|
@@ -97,6 +101,7 @@ module LicenseFinder
|
|
97
101
|
name = hash['name']
|
98
102
|
version = hash['version']
|
99
103
|
return nil if name.nil? || version.nil?
|
104
|
+
|
100
105
|
Identifier.new(name, version)
|
101
106
|
end
|
102
107
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module LicenseFinder
|
2
4
|
class ProjectFinder
|
3
5
|
def initialize(main_project_path, strict_matching = false)
|
@@ -33,6 +35,7 @@ module LicenseFinder
|
|
33
35
|
|
34
36
|
def remove_nested(pathname, paths)
|
35
37
|
return if project_root?(pathname)
|
38
|
+
|
36
39
|
paths.reject! { |path| nested_path?(path, pathname) }
|
37
40
|
end
|
38
41
|
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module LicenseFinder
|
2
4
|
class Scanner
|
3
|
-
PACKAGE_MANAGERS = [GoDep, GoWorkspace, Go15VendorExperiment, Glide, Gvt, Govendor, Dep, Bundler, NPM, Pip,
|
5
|
+
PACKAGE_MANAGERS = [GoModules, GoDep, GoWorkspace, Go15VendorExperiment, Glide, Gvt, Govendor, Dep, Bundler, NPM, Pip,
|
4
6
|
Yarn, Bower, Maven, Gradle, CocoaPods, Rebar, Nuget, Carthage, Mix, Conan, Sbt, Cargo].freeze
|
5
7
|
|
6
8
|
def initialize(config = { project_path: Pathname.new('') })
|
@@ -1,24 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module CommonPathHelper
|
2
|
-
def self.
|
4
|
+
def self.longest_common_paths(paths)
|
3
5
|
[].tap do |common_paths|
|
4
6
|
# organize by matching root paths
|
5
7
|
paths_with_roots = paths.group_by { |path| path.split('/').first }
|
6
8
|
paths_with_roots.each do |common_root, full_paths|
|
7
9
|
# use the shortest path as the 'template'
|
8
|
-
shortest_path = full_paths.
|
9
|
-
|
10
|
+
shortest_path = full_paths.min_by { |path| path.split('/').length }
|
11
|
+
longest_common_path = common_root
|
10
12
|
|
11
13
|
# iterate through each subpath of the 'template'
|
12
14
|
shortest_path.split('/').each_with_index do |subpath, i|
|
13
|
-
potential_path = i.zero? ?
|
15
|
+
potential_path = i.zero? ? longest_common_path : [longest_common_path, subpath].join('/')
|
14
16
|
|
15
17
|
# check each for the existence of the subsequent subpath
|
16
18
|
mismatch = full_paths.any? { |path| !path.start_with?(potential_path) }
|
17
19
|
break if mismatch
|
18
20
|
|
19
|
-
|
21
|
+
longest_common_path = potential_path
|
20
22
|
end
|
21
|
-
common_paths <<
|
23
|
+
common_paths << longest_common_path
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
data/license_finder.gemspec
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
3
5
|
|
4
6
|
require 'license_finder/platform'
|
5
7
|
require 'license_finder/version'
|
6
8
|
|
7
9
|
Gem::Specification.new do |s|
|
8
|
-
s.required_ruby_version = '>= 2.
|
10
|
+
s.required_ruby_version = '>= 2.3.3'
|
9
11
|
s.name = 'license_finder'
|
10
12
|
s.version = LicenseFinder::VERSION
|
11
13
|
|
@@ -61,6 +63,7 @@ Gem::Specification.new do |s|
|
|
61
63
|
s.add_development_dependency 'rake'
|
62
64
|
s.add_development_dependency 'rspec', '~> 3'
|
63
65
|
s.add_development_dependency 'rspec-its'
|
66
|
+
s.add_development_dependency 'rubocop', '~> 0.59.2'
|
64
67
|
s.add_development_dependency 'webmock', '~> 1.13'
|
65
68
|
|
66
69
|
# to preserve ruby < 2.2.2 support.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: license_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Collins
|
@@ -27,7 +27,7 @@ authors:
|
|
27
27
|
autorequire:
|
28
28
|
bindir: bin
|
29
29
|
cert_chain: []
|
30
|
-
date: 2018-
|
30
|
+
date: 2018-10-11 00:00:00.000000000 Z
|
31
31
|
dependencies:
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: bundler
|
@@ -225,6 +225,20 @@ dependencies:
|
|
225
225
|
- - ">="
|
226
226
|
- !ruby/object:Gem::Version
|
227
227
|
version: '0'
|
228
|
+
- !ruby/object:Gem::Dependency
|
229
|
+
name: rubocop
|
230
|
+
requirement: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - "~>"
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: 0.59.2
|
235
|
+
type: :development
|
236
|
+
prerelease: false
|
237
|
+
version_requirements: !ruby/object:Gem::Requirement
|
238
|
+
requirements:
|
239
|
+
- - "~>"
|
240
|
+
- !ruby/object:Gem::Version
|
241
|
+
version: 0.59.2
|
228
242
|
- !ruby/object:Gem::Dependency
|
229
243
|
name: webmock
|
230
244
|
requirement: !ruby/object:Gem::Requirement
|
@@ -295,8 +309,8 @@ files:
|
|
295
309
|
- appveyor.yml
|
296
310
|
- bin/license_finder
|
297
311
|
- bin/license_finder_pip.py
|
298
|
-
- ci/pipelines/
|
299
|
-
- ci/pipelines/release.yml
|
312
|
+
- ci/pipelines/pull-request.yml.erb
|
313
|
+
- ci/pipelines/release.yml.erb
|
300
314
|
- ci/scripts/bump-patch-version.sh
|
301
315
|
- ci/scripts/containerize-tests.sh
|
302
316
|
- ci/scripts/pushscript.sh
|
@@ -309,6 +323,7 @@ files:
|
|
309
323
|
- ci/tasks/build.yml
|
310
324
|
- ci/tasks/bump-patch-version.yml
|
311
325
|
- ci/tasks/rubocop.yml
|
326
|
+
- ci/tasks/run-tests.yml
|
312
327
|
- ci/tasks/update-changelog.yml
|
313
328
|
- dlf
|
314
329
|
- lib/license_finder.rb
|
@@ -367,6 +382,7 @@ files:
|
|
367
382
|
- lib/license_finder/package_managers/glide.rb
|
368
383
|
- lib/license_finder/package_managers/go_15vendorexperiment.rb
|
369
384
|
- lib/license_finder/package_managers/go_dep.rb
|
385
|
+
- lib/license_finder/package_managers/go_modules.rb
|
370
386
|
- lib/license_finder/package_managers/go_workspace.rb
|
371
387
|
- lib/license_finder/package_managers/govendor.rb
|
372
388
|
- lib/license_finder/package_managers/gradle.rb
|
@@ -436,7 +452,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
436
452
|
requirements:
|
437
453
|
- - ">="
|
438
454
|
- !ruby/object:Gem::Version
|
439
|
-
version: 2.
|
455
|
+
version: 2.3.3
|
440
456
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
441
457
|
requirements:
|
442
458
|
- - ">="
|
data/ci/pipelines/release.yml
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
resources:
|
2
|
-
- name: lf-git
|
3
|
-
type: git
|
4
|
-
source:
|
5
|
-
uri: git@github.com:pivotal-legacy/LicenseFinder.git
|
6
|
-
private_key: ((CfOslBot.private_key))
|
7
|
-
branch: master
|
8
|
-
|
9
|
-
- name: lf-image
|
10
|
-
type: docker-image
|
11
|
-
source:
|
12
|
-
repository: licensefinder/license_finder
|
13
|
-
email: ((LicenseFinderDockerEmail))
|
14
|
-
username: ((LicenseFinderDocker.username))
|
15
|
-
password: ((LicenseFinderDocker.password))
|
16
|
-
|
17
|
-
- name: lf-release
|
18
|
-
type: github-release
|
19
|
-
source:
|
20
|
-
owner: pivotal
|
21
|
-
repository: LicenseFinder
|
22
|
-
access_token: ((GithubApiRootToken))
|
23
|
-
|
24
|
-
jobs:
|
25
|
-
|
26
|
-
- name: patch-version
|
27
|
-
plan:
|
28
|
-
- get: lf-git
|
29
|
-
- get: lf-image
|
30
|
-
params:
|
31
|
-
save: true
|
32
|
-
- task: bump-version
|
33
|
-
params:
|
34
|
-
image: lf-image
|
35
|
-
GIT_USERNAME: ((GithubApiUser))
|
36
|
-
GIT_EMAIL: ((GithubApiEmail))
|
37
|
-
file: lf-git/ci/tasks/bump-patch-version.yml
|
38
|
-
- put: lf-git
|
39
|
-
params:
|
40
|
-
repository: lf-git-changed
|
41
|
-
|
42
|
-
- name: release
|
43
|
-
plan:
|
44
|
-
- get: lf-git
|
45
|
-
trigger: true
|
46
|
-
passed: [ patch-version ]
|
47
|
-
- get: lf-image
|
48
|
-
params:
|
49
|
-
save: true
|
50
|
-
- get: lf-release
|
51
|
-
- task: update-changelog
|
52
|
-
image: lf-image
|
53
|
-
params:
|
54
|
-
GIT_USERNAME: ((GithubApiUser))
|
55
|
-
GIT_EMAIL: ((GithubApiEmail))
|
56
|
-
file: lf-git/ci/tasks/update-changelog.yml
|
57
|
-
- put: lf-image
|
58
|
-
params:
|
59
|
-
build: lf-git
|
60
|
-
tag: version/version.txt
|
61
|
-
tag_as_latest: true
|
62
|
-
- put: lf-git
|
63
|
-
params:
|
64
|
-
repository: lf-git-changed
|
65
|
-
- task: build-and-push-gem
|
66
|
-
image: lf-image
|
67
|
-
params:
|
68
|
-
GIT_USERNAME: ((GithubApiUser))
|
69
|
-
GIT_EMAIL: ((GithubApiEmail))
|
70
|
-
GIT_PRIVATE_KEY: ((CfOslBot.private_key))
|
71
|
-
GEM_API_KEY: ((LicenseFinderGemApiKey))
|
72
|
-
file: lf-git/ci/tasks/build-and-push-gem.yml
|
73
|
-
- put: lf-release
|
74
|
-
params:
|
75
|
-
name: version/tag.txt
|
76
|
-
tag: version/tag.txt
|
77
|
-
body: version/changelog.txt
|
78
|
-
|
79
|
-
- name: manual-release
|
80
|
-
plan:
|
81
|
-
- get: lf-git
|
82
|
-
- get: lf-image
|
83
|
-
params:
|
84
|
-
save: true
|
85
|
-
- get: lf-release
|
86
|
-
- task: update-changelog
|
87
|
-
image: lf-image
|
88
|
-
params:
|
89
|
-
GIT_USERNAME: ((GithubApiUser))
|
90
|
-
GIT_EMAIL: ((GithubApiEmail))
|
91
|
-
file: lf-git/ci/tasks/update-changelog.yml
|
92
|
-
- put: lf-image
|
93
|
-
params:
|
94
|
-
build: lf-git
|
95
|
-
tag: version/version.txt
|
96
|
-
tag_as_latest: true
|
97
|
-
- task: build-and-push-gem
|
98
|
-
image: lf-image
|
99
|
-
params:
|
100
|
-
GIT_USERNAME: ((GithubApiUser))
|
101
|
-
GIT_EMAIL: ((GithubApiEmail))
|
102
|
-
GIT_PRIVATE_KEY: ((CfOslBot.private_key))
|
103
|
-
GEM_API_KEY: ((LicenseFinderGemApiKey))
|
104
|
-
file: lf-git/ci/tasks/build-and-push-gem.yml
|
105
|
-
- put: lf-git
|
106
|
-
params:
|
107
|
-
repository: lf-git-changed
|
108
|
-
- put: lf-release
|
109
|
-
params:
|
110
|
-
name: version/tag.txt
|
111
|
-
tag: version/tag.txt
|
112
|
-
body: version/changelog.txt
|