license_finder 4.0.2 → 5.0.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 +4 -2
- data/CHANGELOG.md +16 -1
- data/CONTRIBUTING.md +23 -5
- data/Gemfile +0 -1
- data/README.md +6 -1
- data/Rakefile +2 -2
- data/ci/pipelines/pipeline.yml.erb +1 -1
- data/ci/pipelines/release.yml +14 -23
- data/ci/scripts/pushscript.sh +1 -2
- data/ci/scripts/run-rubocop.sh +1 -1
- data/ci/scripts/updateChangelog.sh +77 -0
- data/ci/tasks/build.yml +1 -1
- data/ci/tasks/update-changelog.yml +15 -0
- data/lib/license_finder/cli/base.rb +19 -13
- data/lib/license_finder/cli/main.rb +54 -37
- data/lib/license_finder/cli/makes_decisions.rb +3 -2
- data/lib/license_finder/configuration.rb +68 -15
- data/lib/license_finder/core.rb +17 -7
- data/lib/license_finder/decisions_factory.rb +11 -0
- data/lib/license_finder/license/templates/SimplifiedBSD.txt +1 -1
- data/lib/license_finder/license_aggregator.rb +11 -6
- data/lib/license_finder/logger.rb +2 -2
- data/lib/license_finder/package.rb +18 -16
- data/lib/license_finder/package_manager.rb +40 -47
- data/lib/license_finder/package_managers/bower.rb +8 -4
- data/lib/license_finder/package_managers/bundler.rb +8 -5
- data/lib/license_finder/package_managers/carthage.rb +4 -4
- data/lib/license_finder/package_managers/cocoa_pods.rb +2 -2
- data/lib/license_finder/package_managers/conan.rb +1 -1
- data/lib/license_finder/package_managers/gradle.rb +1 -1
- data/lib/license_finder/package_managers/maven.rb +1 -3
- data/lib/license_finder/package_managers/mix.rb +8 -4
- data/lib/license_finder/package_managers/npm.rb +5 -1
- data/lib/license_finder/package_managers/pip.rb +2 -2
- data/lib/license_finder/package_managers/rebar.rb +4 -4
- data/lib/license_finder/package_managers/yarn.rb +2 -2
- data/lib/license_finder/{packages → package_utils}/activation.rb +0 -0
- data/lib/license_finder/{package_managers → package_utils}/conan_info_parser.rb +1 -1
- data/lib/license_finder/{package_managers → package_utils}/gradle_dependency_finder.rb +0 -0
- data/lib/license_finder/{packages → package_utils}/license_files.rb +1 -1
- data/lib/license_finder/{packages → package_utils}/licensing.rb +1 -1
- data/lib/license_finder/{package_managers → package_utils}/maven_dependency_finder.rb +0 -0
- data/lib/license_finder/{packages → package_utils}/possible_license_file.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/bower_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/bundler_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/carthage_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/cocoa_pods_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/conan_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/go_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/gradle_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/maven_package.rb +0 -0
- data/lib/license_finder/packages/merged_package.rb +42 -0
- data/lib/license_finder/{package_managers → packages}/mix_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/npm_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/nuget_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/pip_package.rb +0 -0
- data/lib/license_finder/{package_managers → packages}/rebar_package.rb +0 -0
- data/lib/license_finder/packages/yarn_package.rb +7 -0
- data/lib/license_finder/project_finder.rb +1 -1
- data/lib/license_finder/reports/csv_report.rb +1 -0
- data/lib/license_finder/reports/merged_report.rb +2 -0
- data/lib/license_finder/reports/templates/html_report.erb +8 -0
- data/lib/license_finder/reports/templates/markdown_report.erb +7 -0
- data/lib/license_finder/scanner.rb +38 -0
- data/lib/license_finder/version.rb +1 -1
- data/license_finder.gemspec +9 -2
- metadata +37 -101
- data/ci/tasks/get-version-and-tag.yml +0 -20
- data/features/features/cli/cli_spec.rb +0 -63
- data/features/features/configure/add_dependencies_spec.rb +0 -54
- data/features/features/configure/approve_dependencies_spec.rb +0 -61
- data/features/features/configure/assign_licenses_spec.rb +0 -35
- data/features/features/configure/blacklist_licenses_spec.rb +0 -30
- data/features/features/configure/ignore_dependencies_spec.rb +0 -35
- data/features/features/configure/ignore_groups_spec.rb +0 -46
- data/features/features/configure/name_project_spec.rb +0 -33
- data/features/features/configure/set_project_path_spec.rb +0 -17
- data/features/features/configure/whitelist_licenses_spec.rb +0 -38
- data/features/features/package_managers/bower_spec.rb +0 -14
- data/features/features/package_managers/carthage_spec.rb +0 -14
- data/features/features/package_managers/cocoapods_spec.rb +0 -14
- data/features/features/package_managers/conan_spec.rb +0 -11
- data/features/features/package_managers/dep_spec.rb +0 -15
- data/features/features/package_managers/glide_spec.rb +0 -26
- data/features/features/package_managers/godep_spec.rb +0 -17
- data/features/features/package_managers/govendor_spec.rb +0 -15
- data/features/features/package_managers/gradle_spec.rb +0 -34
- data/features/features/package_managers/gvt_spec.rb +0 -14
- data/features/features/package_managers/maven_spec.rb +0 -22
- data/features/features/package_managers/mix_spec.rb +0 -16
- data/features/features/package_managers/npm_spec.rb +0 -14
- data/features/features/package_managers/nuget_spec.rb +0 -14
- data/features/features/package_managers/pip_spec.rb +0 -14
- data/features/features/package_managers/rebar_spec.rb +0 -14
- data/features/features/package_managers/yarn_spec.rb +0 -14
- data/features/features/report/composite_spec.rb +0 -28
- data/features/features/report/csv_spec.rb +0 -18
- data/features/features/report/diff_spec.rb +0 -203
- data/features/features/report/html_spec.rb +0 -51
- data/features/features/report/java_groups_spec.rb +0 -11
- data/features/features/report/subproject_spec.rb +0 -63
- data/features/fixtures/Cartfile +0 -1
- data/features/fixtures/Podfile +0 -3
- data/features/fixtures/alternate-build-file-gradle/build-alt.gradle +0 -16
- data/features/fixtures/alternate-build-file-gradle/settings.gradle +0 -1
- data/features/fixtures/build.gradle +0 -16
- data/features/fixtures/conanfile.txt +0 -11
- data/features/fixtures/file-based-libs-gradle/build.gradle +0 -16
- data/features/fixtures/file-based-libs-gradle/libs/data.json-0.2.3.jar +0 -0
- data/features/fixtures/gopath/src/github.com/pivotal/foo/Godeps/Godeps.json +0 -16
- data/features/fixtures/gopath/src/github.com/pivotal/foo/Godeps/Readme +0 -5
- data/features/fixtures/gopath/src/github.com/pivotal/foo/foo.go +0 -6
- data/features/fixtures/gopath_dep/src/foo-dep/Gopkg.lock +0 -14
- data/features/fixtures/gopath_dep/src/foo-dep/Gopkg.toml +0 -7
- data/features/fixtures/gopath_dep/src/foo-dep/bar/bar.go +0 -10
- data/features/fixtures/gopath_dep/src/foo-dep/foo.go +0 -7
- data/features/fixtures/gopath_dep/src/foo-dep/vendor/a/b/LICENSE +0 -1
- data/features/fixtures/gopath_glide/src/glide.lock +0 -9
- data/features/fixtures/gopath_glide/src/glide.yaml +0 -6
- data/features/fixtures/gopath_glide_without_src/glide.lock +0 -9
- data/features/fixtures/gopath_glide_without_src/glide.yaml +0 -6
- data/features/fixtures/gopath_govendor/src/vendor/vendor.json +0 -19
- data/features/fixtures/gopath_gvt/src/vendor/manifest +0 -22
- data/features/fixtures/gradle-wrapper/build.gradle +0 -16
- data/features/fixtures/gradle-wrapper/gradlew +0 -8
- data/features/fixtures/gradle-wrapper/gradlew.bat +0 -9
- data/features/fixtures/maven-wrapper/mvnw +0 -3
- data/features/fixtures/maven-wrapper/mvnw.cmd +0 -7
- data/features/fixtures/maven-wrapper/pom.xml +0 -37
- data/features/fixtures/mix.exs +0 -22
- data/features/fixtures/multi-module-gradle/build.gradle +0 -12
- data/features/fixtures/multi-module-gradle/module1/build.gradle +0 -3
- data/features/fixtures/multi-module-gradle/module2/build.gradle +0 -3
- data/features/fixtures/multi-module-gradle/settings.gradle +0 -1
- data/features/fixtures/nuget/.nuget/.keep +0 -0
- data/features/fixtures/nuget/Fun.Test/packages.config +0 -4
- data/features/fixtures/nuget/Fun/packages.config +0 -5
- data/features/fixtures/pom.xml +0 -19
- data/features/fixtures/rebar.config +0 -12
- data/features/fixtures/single-module-gradle/build.gradle +0 -16
- data/features/support/feature_helper.rb +0 -15
- data/features/support/testing_dsl.rb +0 -564
- data/lib/license_finder/package_managers/merged_package.rb +0 -95
- data/license_finder-2.1.2.gem +0 -0
@@ -12,6 +12,14 @@ module LicenseFinder
|
|
12
12
|
'bower'
|
13
13
|
end
|
14
14
|
|
15
|
+
def self.prepare_command
|
16
|
+
'bower install'
|
17
|
+
end
|
18
|
+
|
19
|
+
def possible_package_paths
|
20
|
+
[project_path.join('bower.json')]
|
21
|
+
end
|
22
|
+
|
15
23
|
private
|
16
24
|
|
17
25
|
def bower_output
|
@@ -23,9 +31,5 @@ module LicenseFinder
|
|
23
31
|
.fetch('dependencies', {})
|
24
32
|
.values
|
25
33
|
end
|
26
|
-
|
27
|
-
def possible_package_paths
|
28
|
-
[project_path.join('bower.json')]
|
29
|
-
end
|
30
34
|
end
|
31
35
|
end
|
@@ -25,6 +25,10 @@ module LicenseFinder
|
|
25
25
|
'bundle install'
|
26
26
|
end
|
27
27
|
|
28
|
+
def possible_package_paths
|
29
|
+
[project_path.join('Gemfile')]
|
30
|
+
end
|
31
|
+
|
28
32
|
private
|
29
33
|
|
30
34
|
attr_reader :ignored_groups
|
@@ -42,7 +46,10 @@ module LicenseFinder
|
|
42
46
|
end
|
43
47
|
|
44
48
|
def gem_details
|
45
|
-
@gem_details
|
49
|
+
return @gem_details if @gem_details
|
50
|
+
# clear gem paths before runninng specs_for
|
51
|
+
Gem.clear_paths
|
52
|
+
@gem_details = definition.specs_for(included_groups)
|
46
53
|
end
|
47
54
|
|
48
55
|
def bundler_details
|
@@ -53,10 +60,6 @@ module LicenseFinder
|
|
53
60
|
definition.groups - ignored_groups.map(&:to_sym)
|
54
61
|
end
|
55
62
|
|
56
|
-
def possible_package_paths
|
57
|
-
[project_path.join('Gemfile')]
|
58
|
-
end
|
59
|
-
|
60
63
|
def lockfile_path
|
61
64
|
project_path.join('Gemfile.lock')
|
62
65
|
end
|
@@ -22,6 +22,10 @@ module LicenseFinder
|
|
22
22
|
LicenseFinder::Platform.darwin? ? 'carthage' : nil
|
23
23
|
end
|
24
24
|
|
25
|
+
def possible_package_paths
|
26
|
+
[public_dependency_path]
|
27
|
+
end
|
28
|
+
|
25
29
|
private
|
26
30
|
|
27
31
|
def cartfile
|
@@ -33,10 +37,6 @@ module LicenseFinder
|
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
36
|
-
def possible_package_paths
|
37
|
-
[public_dependency_path]
|
38
|
-
end
|
39
|
-
|
40
40
|
def public_dependency_path
|
41
41
|
project_path.join('Cartfile')
|
42
42
|
end
|
@@ -23,12 +23,12 @@ module LicenseFinder
|
|
23
23
|
LicenseFinder::Platform.darwin? ? 'pod' : nil
|
24
24
|
end
|
25
25
|
|
26
|
-
private
|
27
|
-
|
28
26
|
def possible_package_paths
|
29
27
|
[project_path.join('Podfile')]
|
30
28
|
end
|
31
29
|
|
30
|
+
private
|
31
|
+
|
32
32
|
def lockfile_path
|
33
33
|
project_path.join('Podfile.lock')
|
34
34
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'xmlsimple'
|
2
|
-
|
2
|
+
require 'license_finder/package_utils/maven_dependency_finder'
|
3
3
|
|
4
4
|
module LicenseFinder
|
5
5
|
class Maven < PackageManager
|
@@ -42,8 +42,6 @@ module LicenseFinder
|
|
42
42
|
File.exist?(File.join(project_path, wrapper)) ? wrapper : maven
|
43
43
|
end
|
44
44
|
|
45
|
-
private
|
46
|
-
|
47
45
|
def possible_package_paths
|
48
46
|
[project_path.join('pom.xml')]
|
49
47
|
end
|
@@ -21,6 +21,14 @@ module LicenseFinder
|
|
21
21
|
'mix'
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.prepare_command
|
25
|
+
'mix deps.get'
|
26
|
+
end
|
27
|
+
|
28
|
+
def possible_package_paths
|
29
|
+
[project_path.join('mix.exs')]
|
30
|
+
end
|
31
|
+
|
24
32
|
private
|
25
33
|
|
26
34
|
def mix_output
|
@@ -43,9 +51,5 @@ module LicenseFinder
|
|
43
51
|
def resolve_version(line)
|
44
52
|
line =~ /locked at ([^\s]+)/ ? Regexp.last_match(1) : line
|
45
53
|
end
|
46
|
-
|
47
|
-
def possible_package_paths
|
48
|
-
[project_path.join('mix.exs')]
|
49
|
-
end
|
50
54
|
end
|
51
55
|
end
|
@@ -11,12 +11,16 @@ module LicenseFinder
|
|
11
11
|
'npm'
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
def self.prepare_command
|
15
|
+
'npm install'
|
16
|
+
end
|
15
17
|
|
16
18
|
def possible_package_paths
|
17
19
|
[project_path.join('package.json')]
|
18
20
|
end
|
19
21
|
|
22
|
+
private
|
23
|
+
|
20
24
|
def npm_json
|
21
25
|
command = "#{NPM.package_management_command} list --json --long"
|
22
26
|
stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
|
@@ -25,8 +25,6 @@ module LicenseFinder
|
|
25
25
|
'pip'
|
26
26
|
end
|
27
27
|
|
28
|
-
private
|
29
|
-
|
30
28
|
def possible_package_paths
|
31
29
|
if project_path.nil?
|
32
30
|
[@requirements_path]
|
@@ -35,6 +33,8 @@ module LicenseFinder
|
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
36
|
+
private
|
37
|
+
|
38
38
|
def pip_output
|
39
39
|
output = `#{LicenseFinder::BIN_PATH.join('license_finder_pip.py')} #{detected_package_path}`
|
40
40
|
JSON(output).map do |package|
|
@@ -22,6 +22,10 @@ module LicenseFinder
|
|
22
22
|
'rebar'
|
23
23
|
end
|
24
24
|
|
25
|
+
def possible_package_paths
|
26
|
+
[project_path.join('rebar.config')]
|
27
|
+
end
|
28
|
+
|
25
29
|
private
|
26
30
|
|
27
31
|
def rebar_ouput
|
@@ -34,9 +38,5 @@ module LicenseFinder
|
|
34
38
|
.reject { |line| line.start_with?('=') }
|
35
39
|
.map { |line| line.split(' ') }
|
36
40
|
end
|
37
|
-
|
38
|
-
def possible_package_paths
|
39
|
-
[project_path.join('rebar.config')]
|
40
|
-
end
|
41
41
|
end
|
42
42
|
end
|
@@ -24,7 +24,7 @@ module LicenseFinder
|
|
24
24
|
json_objects.each do |json_object|
|
25
25
|
match = /(?<name>[\w,\-]+)@(?<version>(\d+\.?)+)/ =~ json_object['data'].to_s
|
26
26
|
if match
|
27
|
-
package =
|
27
|
+
package = YarnPackage.new(name, version, spec_licenses: ['unknown'])
|
28
28
|
incompatible_packages.push(package)
|
29
29
|
end
|
30
30
|
end
|
@@ -55,7 +55,7 @@ module LicenseFinder
|
|
55
55
|
end
|
56
56
|
|
57
57
|
packages.map do |package_hash|
|
58
|
-
|
58
|
+
YarnPackage.new(package_hash['Name'], package_hash['Version'], spec_licenses: [package_hash['License']], homepage: package_hash['VendorUrl'])
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
File without changes
|
@@ -53,7 +53,7 @@ module LicenseFinder
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def wrap_up
|
56
|
-
|
56
|
+
@current_project[@current_key] = @current_vals if @current_vals.count && @current_key
|
57
57
|
@projects << @current_project
|
58
58
|
end
|
59
59
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module LicenseFinder
|
2
|
+
class MergedPackage < Package
|
3
|
+
extend Forwardable
|
4
|
+
attr_reader :dependency
|
5
|
+
|
6
|
+
def initialize(package, aggregate_paths)
|
7
|
+
@dependency = package
|
8
|
+
@aggregate_paths = aggregate_paths.map { |p| Pathname(p) }
|
9
|
+
super(package.name, package.version)
|
10
|
+
end
|
11
|
+
|
12
|
+
def_delegators :@dependency, :name, :version, :authors, :summary, :description, :homepage, :children, :parents,
|
13
|
+
:groups, :whitelisted, :blacklisted, :manual_approval, :install_path, :licenses, :approved_manually?,
|
14
|
+
:approved_manually!, :approved?, :whitelisted!, :whitelisted?, :blacklisted!, :blacklisted?, :hash,
|
15
|
+
:activations, :missing, :license_names_from_spec, :decided_licenses, :licensing, :decide_on_license,
|
16
|
+
:license_files, :package_manager, :missing?, :log_activation
|
17
|
+
|
18
|
+
def aggregate_paths
|
19
|
+
@aggregate_paths.map { |p| p.expand_path.to_s }
|
20
|
+
end
|
21
|
+
|
22
|
+
def <=>(other)
|
23
|
+
dependency <=> other.dependency
|
24
|
+
end
|
25
|
+
|
26
|
+
def eql?(other)
|
27
|
+
if other.instance_of? MergedPackage
|
28
|
+
other.dependency.eql?(dependency)
|
29
|
+
else
|
30
|
+
dependency.eql?(other)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def ==(other)
|
35
|
+
dependency.eql?(other.dependency) && aggregate_paths.eql?(other.aggregate_paths)
|
36
|
+
end
|
37
|
+
|
38
|
+
def method_missing(_method_name)
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -83,6 +83,14 @@
|
|
83
83
|
<%= link_to_dependency(dependency) %>
|
84
84
|
<small><%= version_groups(dependency) %></small>
|
85
85
|
</h2>
|
86
|
+
<% if dependency.is_a?(MergedPackage) && !dependency.aggregate_paths.nil? && dependency.aggregate_paths.count > 0-%>
|
87
|
+
<h4>Paths</h4>
|
88
|
+
<dl>
|
89
|
+
<% dependency.aggregate_paths.each do |path| -%>
|
90
|
+
<dd><%= path %></dd>
|
91
|
+
<% end -%>
|
92
|
+
</dl>
|
93
|
+
<% end -%>
|
86
94
|
<h4><%= dependency.summary %></h4>
|
87
95
|
<p><%= dependency.description %></p>
|
88
96
|
<% if dependency.parents.any? -%>
|
@@ -24,6 +24,13 @@ As of <%= Time.now.strftime("%B %e, %Y %l:%M%P") %>. <%= dependencies.size %> to
|
|
24
24
|
### <%= link_to_dependency(dependency) %> <%= version_groups(dependency) %>
|
25
25
|
#### <%= dependency.summary %>
|
26
26
|
|
27
|
+
<% if dependency.is_a?(MergedPackage) && !dependency.aggregate_paths.nil? && dependency.aggregate_paths.count > 0 -%>
|
28
|
+
##### Paths
|
29
|
+
<% dependency.aggregate_paths.each do |path| -%>
|
30
|
+
* <%= path %>
|
31
|
+
<% end -%>
|
32
|
+
<% end -%>
|
33
|
+
|
27
34
|
<% if dependency.approved_manually? -%>
|
28
35
|
<%= license_links(dependency) %> manually approved
|
29
36
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module LicenseFinder
|
2
|
+
class Scanner
|
3
|
+
PACKAGE_MANAGERS = [GoDep, GoWorkspace, Go15VendorExperiment, Glide, Gvt, Govendor, Dep, Bundler, NPM, Pip,
|
4
|
+
Yarn, Bower, Maven, Gradle, CocoaPods, Rebar, Nuget, Carthage, Mix, Conan].freeze
|
5
|
+
|
6
|
+
def initialize(config = { project_path: Pathname.new('') })
|
7
|
+
@config = config
|
8
|
+
@project_path = @config[:project_path]
|
9
|
+
@logger = @config[:logger]
|
10
|
+
end
|
11
|
+
|
12
|
+
def active_packages
|
13
|
+
package_managers = active_package_managers
|
14
|
+
installed_package_managers = package_managers.select { |pm| pm.class.installed?(@logger) }
|
15
|
+
installed_package_managers.flat_map(&:current_packages_with_relations)
|
16
|
+
end
|
17
|
+
|
18
|
+
def active_package_managers
|
19
|
+
return @package_managers if @package_managers
|
20
|
+
|
21
|
+
active_pm_classes = []
|
22
|
+
PACKAGE_MANAGERS.each do |pm_class|
|
23
|
+
active = pm_class.new(@config).active?
|
24
|
+
if active
|
25
|
+
@logger.info pm_class, 'is active', color: :green
|
26
|
+
active_pm_classes << pm_class
|
27
|
+
else
|
28
|
+
@logger.debug pm_class, 'is not active', color: :red
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
@logger.info 'License Finder', 'No active and installed package managers found for project.', color: :red if active_pm_classes.empty?
|
33
|
+
|
34
|
+
active_pm_classes -= active_pm_classes.map(&:takes_priority_over)
|
35
|
+
@package_managers = active_pm_classes.map { |pm_class| pm_class.new(@config) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|