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
data/ci/scripts/run-rubocop.sh
CHANGED
data/ci/scripts/run-tests.sh
CHANGED
@@ -5,8 +5,6 @@ set -o pipefail
|
|
5
5
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
6
6
|
PROJECT_ROOT="$( dirname "$( dirname $DIR )" )"
|
7
7
|
|
8
|
-
RUBY_VERSION_UNDER_TEST=$1
|
9
|
-
|
10
8
|
pushd "$PROJECT_ROOT"
|
11
9
|
|
12
10
|
rvm install --default $RUBY_VERSION_UNDER_TEST
|
@@ -19,18 +17,6 @@ pushd "$PROJECT_ROOT"
|
|
19
17
|
gem install bundler
|
20
18
|
bundle install
|
21
19
|
|
22
|
-
# jruby-9 specific: requires >= rack 2.x
|
23
|
-
if [ "$RUBY_VERSION_UNDER_TEST" == "jruby-9.0.4.0" ]
|
24
|
-
then
|
25
|
-
bundle update rack
|
26
|
-
apt-get -y install software-properties-common
|
27
|
-
add-apt-repository -y ppa:webupd8team/java
|
28
|
-
apt-get update
|
29
|
-
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections
|
30
|
-
apt-get -y install oracle-java8-set-default
|
31
|
-
fi
|
32
|
-
|
33
|
-
|
34
20
|
bundle exec rake install
|
35
21
|
bundle exec rake spec
|
36
22
|
bundle exec rake features
|
data/dlf
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
if `which docker > /dev/null`; then
|
3
3
|
if [ $# -eq 0 ]; then
|
4
|
-
docker run -v $PWD:/scan -it licensefinder/license_finder
|
4
|
+
docker run -v $PWD:/scan -it licensefinder/license_finder
|
5
5
|
else
|
6
|
-
docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -lc "cd /scan &&
|
6
|
+
docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -lc "cd /scan && `echo $@`"
|
7
7
|
fi
|
8
8
|
else
|
9
9
|
echo "You do not have docker installed. Please install it:"
|
data/lib/license_finder.rb
CHANGED
data/lib/license_finder/cli.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'license_finder/report'
|
2
4
|
require 'license_finder/version'
|
3
5
|
require 'license_finder/diff'
|
@@ -172,6 +174,7 @@ module LicenseFinder
|
|
172
174
|
aggregate_paths = ProjectFinder.new(project_path, config.strict_matching).find_projects if config.recursive
|
173
175
|
say(aggregate_paths || project_path) if config.strict_matching
|
174
176
|
return aggregate_paths unless aggregate_paths.nil? || aggregate_paths.empty?
|
177
|
+
|
175
178
|
[config.project_path] unless config.project_path.nil?
|
176
179
|
end
|
177
180
|
|
data/lib/license_finder/core.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'forwardable'
|
2
4
|
|
3
5
|
require 'license_finder/logger'
|
@@ -73,7 +75,7 @@ module LicenseFinder
|
|
73
75
|
def decision_applier
|
74
76
|
# lazy, do not move to `initialize`
|
75
77
|
# Needs to be lazy loaded to prvent multiple decision appliers being created each time
|
76
|
-
@
|
78
|
+
@decision_applier ||= DecisionApplier.new(decisions: decisions, packages: current_packages)
|
77
79
|
end
|
78
80
|
|
79
81
|
def current_packages
|
data/lib/license_finder/diff.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module LicenseFinder
|
2
4
|
class Diff
|
3
5
|
class << self
|
4
|
-
def compare(
|
5
|
-
p1 = Set.new(build_packages(
|
6
|
-
p2 = Set.new(build_packages(
|
6
|
+
def compare(file1, file2)
|
7
|
+
p1 = Set.new(build_packages(file1))
|
8
|
+
p2 = Set.new(build_packages(file2))
|
7
9
|
|
8
10
|
added = p2.difference(p1).to_a
|
9
11
|
removed = p1.difference(p2).to_a
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module LicenseFinder
|
2
4
|
class LicenseAggregator
|
3
5
|
def initialize(config, aggregate_paths)
|
@@ -28,6 +30,7 @@ module LicenseFinder
|
|
28
30
|
|
29
31
|
def finders
|
30
32
|
return @finders unless @finders.nil?
|
33
|
+
|
31
34
|
@finders = if @aggregate_paths.nil?
|
32
35
|
[LicenseFinder::Core.new(@config)]
|
33
36
|
else
|
@@ -42,6 +45,7 @@ module LicenseFinder
|
|
42
45
|
|
43
46
|
def aggregate_packages
|
44
47
|
return @packages unless @packages.nil?
|
48
|
+
|
45
49
|
all_packages = finders.flat_map do |finder|
|
46
50
|
finder.prepare_projects if @config.prepare
|
47
51
|
finder.acknowledged.map { |dep| MergedPackage.new(dep, [finder.project_path]) }
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'logger'
|
2
4
|
|
3
5
|
module LicenseFinder
|
@@ -39,16 +41,18 @@ module LicenseFinder
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
|
-
def mode=(
|
43
|
-
@mode =
|
44
|
+
def mode=(verbose)
|
45
|
+
@mode = verbose
|
44
46
|
|
45
47
|
return if quiet?
|
48
|
+
|
46
49
|
level = @mode.equal?(MODE_DEBUG) ? ::Logger::DEBUG : ::Logger::INFO
|
47
50
|
system_logger.level = level
|
48
51
|
end
|
49
52
|
|
50
53
|
def log(msg, method)
|
51
54
|
return if quiet?
|
55
|
+
|
52
56
|
system_logger.send(method, msg)
|
53
57
|
end
|
54
58
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'license_finder/package_utils/licensing'
|
2
4
|
require 'license_finder/package_utils/license_files'
|
3
5
|
|
@@ -102,6 +104,7 @@ module LicenseFinder
|
|
102
104
|
def <=>(other)
|
103
105
|
eq_name = name <=> other.name
|
104
106
|
return eq_name unless eq_name.zero?
|
107
|
+
|
105
108
|
version <=> other.version
|
106
109
|
end
|
107
110
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module LicenseFinder
|
2
4
|
class PackageDelta
|
3
5
|
STATUSES = %i[added removed unchanged].freeze
|
@@ -53,7 +55,7 @@ module LicenseFinder
|
|
53
55
|
private
|
54
56
|
|
55
57
|
def pick_package
|
56
|
-
@current_package
|
58
|
+
@current_package || @previous_package
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module LicenseFinder
|
2
4
|
# Super-class for the different package managers
|
3
5
|
# (Bundler, NPM, Pip, etc.)
|
@@ -66,7 +68,7 @@ module LicenseFinder
|
|
66
68
|
|
67
69
|
def active?
|
68
70
|
path = detected_package_path
|
69
|
-
path
|
71
|
+
path&.exist?
|
70
72
|
end
|
71
73
|
|
72
74
|
def detected_package_path
|
@@ -90,6 +92,7 @@ module LicenseFinder
|
|
90
92
|
packages = current_packages
|
91
93
|
rescue StandardError => e
|
92
94
|
raise e unless @prepare_no_fail
|
95
|
+
|
93
96
|
packages = []
|
94
97
|
end
|
95
98
|
|
@@ -130,6 +133,7 @@ require 'license_finder/package_managers/go_dep'
|
|
130
133
|
require 'license_finder/package_managers/gvt'
|
131
134
|
require 'license_finder/package_managers/glide'
|
132
135
|
require 'license_finder/package_managers/govendor'
|
136
|
+
require 'license_finder/package_managers/go_modules'
|
133
137
|
require 'license_finder/package_managers/bundler'
|
134
138
|
require 'license_finder/package_managers/npm'
|
135
139
|
require 'license_finder/package_managers/yarn'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler'
|
2
4
|
|
3
5
|
module LicenseFinder
|
@@ -47,6 +49,7 @@ module LicenseFinder
|
|
47
49
|
|
48
50
|
def gem_details
|
49
51
|
return @gem_details if @gem_details
|
52
|
+
|
50
53
|
# clear gem paths before runninng specs_for
|
51
54
|
Gem.clear_paths
|
52
55
|
@gem_details = definition.specs_for(included_groups)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'json'
|
2
4
|
|
3
5
|
module LicenseFinder
|
@@ -27,6 +29,7 @@ module LicenseFinder
|
|
27
29
|
|
28
30
|
stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
|
29
31
|
raise "Command '#{command}' failed to execute: #{stderr}" unless status.success?
|
32
|
+
|
30
33
|
JSON(stdout)
|
31
34
|
.fetch('packages', [])
|
32
35
|
end
|