license_finder 6.9.0 → 6.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -2
  3. data/CHANGELOG.md +21 -0
  4. data/CONTRIBUTING.md +5 -4
  5. data/Dockerfile +20 -5
  6. data/README.md +26 -11
  7. data/Rakefile +1 -1
  8. data/VERSION +1 -1
  9. data/ci/pipelines/pull-request.yml.erb +2 -0
  10. data/ci/pipelines/release.yml.erb +3 -1
  11. data/ci/tasks/rubocop.yml +2 -0
  12. data/ci/tasks/update-changelog.yml +2 -0
  13. data/examples/Gemfile +4 -0
  14. data/examples/custom_erb_template.rb +24 -0
  15. data/examples/extract_license_data.rb +63 -0
  16. data/examples/sample_template.erb +7 -0
  17. data/lib/license_finder/cli/base.rb +8 -1
  18. data/lib/license_finder/cli/main.rb +5 -1
  19. data/lib/license_finder/configuration.rb +12 -0
  20. data/lib/license_finder/core.rb +5 -2
  21. data/lib/license_finder/decisions.rb +7 -0
  22. data/lib/license_finder/package.rb +2 -1
  23. data/lib/license_finder/package_manager.rb +8 -3
  24. data/lib/license_finder/package_managers/composer.rb +8 -4
  25. data/lib/license_finder/package_managers/conda.rb +131 -0
  26. data/lib/license_finder/package_managers/dep.rb +6 -1
  27. data/lib/license_finder/package_managers/go_15vendorexperiment.rb +6 -1
  28. data/lib/license_finder/package_managers/go_modules.rb +6 -1
  29. data/lib/license_finder/package_managers/npm.rb +1 -1
  30. data/lib/license_finder/package_managers/trash.rb +6 -1
  31. data/lib/license_finder/package_managers/yarn.rb +1 -1
  32. data/lib/license_finder/packages/conda_package.rb +74 -0
  33. data/lib/license_finder/report.rb +1 -0
  34. data/lib/license_finder/reports/junit_report.rb +19 -0
  35. data/lib/license_finder/reports/templates/junit_report.erb +41 -0
  36. data/lib/license_finder/scanner.rb +25 -2
  37. data/license_finder.gemspec +3 -2
  38. metadata +37 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc2352a955e259632d6033ca1ec13a03ef2d6925c0a0dde89f0bd4bbf125a333
4
- data.tar.gz: 275ec53c07253065b18133ea74bfd4dc69f73cb1a6dff6ba6d08f4ee278111e8
3
+ metadata.gz: 6b7a4a73fc4f78ba9e1d5bb08a603d08f5086e4c55517b35be972eb46cf45425
4
+ data.tar.gz: 7dc0e9072c02bf89ca269043225179f3ad03fb171d836db1bead5d7d82c3d278
5
5
  SHA512:
6
- metadata.gz: 657b1f48fc7b0f592dbec7428610b8984c9be7f897b0eb2bd0379399d41286ea77b925298207633c48e388da2ffd46f99859fbd1e57d885b508ee434162316fd
7
- data.tar.gz: 02e5b8f9fc1e70ddeb1bd87f55920d4c5537c82511cbbafb7ff96f622dee26f6e4dca3da7e9f03c321a44a1b0bdb6c2135638dd0ca3872169cebdc3731f7b4cc
6
+ metadata.gz: 10f7be63b0c95dc04fd734b793dc79129530ed8d0a4ad2d5e37158ef9d68f40ea3c44704d2c944946c29342ae5df3f234004f83fe23346a2a0c907104857aa8f
7
+ data.tar.gz: acf582f691fd9d5e5857d7b90dd021fa3a6ae8a4ed03efb189524f63921003612b075292394830abf2971a04ccda1aa74c0f99759964edec5be5320240b970d7
data/.rubocop.yml CHANGED
@@ -27,9 +27,9 @@ BlockLength:
27
27
  ClassLength:
28
28
  Enabled: false
29
29
  CyclomaticComplexity:
30
- Max: 10
30
+ Max: 15
31
31
  PerceivedComplexity:
32
- Max: 10
32
+ Max: 15
33
33
  LineLength:
34
34
  Max: 200
35
35
  MethodLength:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # [6.12.1] / 2021-04-12
2
+
3
+ # [6.12.0] / 2021-03-05
4
+
5
+ ### Added
6
+ * Provide homepage information for GoDep and Go15Vendor package managers - [bae1bda9](https://github.com/pivotal/LicenseFinder/commit/bae1bda9d76cb922405d7efca9c67e2583db70d4) - Jeff Jun
7
+
8
+ # [6.11.0] / 2021-03-04
9
+
10
+ ### Added
11
+ * Add homepage for go_modules package manager - [912394a8](https://github.com/pivotal/LicenseFinder/commit/912394a8a6ab4c31b6918a21da9f37d5b368ed6b)
12
+
13
+ # [6.10.1] / 2021-01-08
14
+
15
+ # [6.10.0] / 2020-11-27
16
+
1
17
  # [6.9.0] / 2020-10-05
2
18
 
3
19
  ### Changed
@@ -921,3 +937,8 @@ Bugfixes:
921
937
  [6.8.1]: https://github.com/pivotal/LicenseFinder/compare/v6.8.0...v6.8.1
922
938
  [6.8.2]: https://github.com/pivotal/LicenseFinder/compare/v6.8.1...v6.8.2
923
939
  [6.9.0]: https://github.com/pivotal/LicenseFinder/compare/v6.8.2...v6.9.0
940
+ [6.10.0]: https://github.com/pivotal/LicenseFinder/compare/v6.9.0...v6.10.0
941
+ [6.10.1]: https://github.com/pivotal/LicenseFinder/compare/v6.10.0...v6.10.1
942
+ [6.11.0]: https://github.com/pivotal/LicenseFinder/compare/v6.10.1...v6.11.0
943
+ [6.12.0]: https://github.com/pivotal/LicenseFinder/compare/v6.11.0...v6.12.0
944
+ [6.12.1]: https://github.com/pivotal/LicenseFinder/compare/v6.12.0...v6.12.1
data/CONTRIBUTING.md CHANGED
@@ -24,8 +24,8 @@ will use the gem version installed inside the docker image.
24
24
 
25
25
  ## Useful Tips
26
26
 
27
- To build the docker image simply call `docker build .` or explicitly pass the `Dockerfile`. Prebuilt versions of the
28
- dockerfile can also be found on [Dockerhub](https://hub.docker.com/r/licensefinder/license_finder/tags/).
27
+ To build the docker image simply call `docker build .` or explicitly pass the `Dockerfile`. Prebuilt versions of the
28
+ dockerfile can also be found on [Dockerhub](https://hub.docker.com/r/licensefinder/license_finder/tags/).
29
29
 
30
30
  To launch the docker image and interact with it via bash:
31
31
  ```
@@ -60,13 +60,13 @@ submitting a pull request which adds new columns to
60
60
  `lib/license_finder/reports/csv_report.rb`.
61
61
 
62
62
  It is also possible to generate a custom report from an ERB template. Use this
63
- [example](https://gist.github.com/mainej/b190d2f138c2b9e2e20a) as a starting
63
+ [example](https://github.com/pivotal/LicenseFinder/blob/master/examples/custom_erb_template.rb) as a starting
64
64
  point. These reports will have access to the helpers in
65
65
  [`LicenseFinder::ErbReport`](https://github.com/pivotal/LicenseFinder/blob/master/lib/license_finder/reports/erb_report.rb).
66
66
 
67
67
  If you need a report with more detailed data or in a different format, we
68
68
  recommend writing a custom ruby script. This
69
- [example](https://gist.github.com/mainej/48ac616844505d50f510) will get you
69
+ [example](https://github.com/pivotal/LicenseFinder/blob/master/examples/extract_license_data.rb) will get you
70
70
  started.
71
71
 
72
72
  If you come up with something useful, consider posting it to the Google Group
@@ -91,6 +91,7 @@ To successfully run the test suite, you will need the following installed:
91
91
  - Conan
92
92
  - NuGet
93
93
  - dotnet
94
+ - Conda (requires python)
94
95
 
95
96
  The [LicenseFinder docker image](https://hub.docker.com/r/licensefinder/license_finder/) already contains these dependencies.
96
97
 
data/Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM ubuntu:xenial
2
2
 
3
3
  # Versioning
4
4
  ENV PIP_INSTALL_VERSION 19.0.2
5
- ENV PIP3_INSTALL_VERSION 8.1.1
5
+ ENV PIP3_INSTALL_VERSION 20.0.2
6
6
  ENV GO_LANG_VERSION 1.14.3
7
7
  ENV MAVEN_VERSION 3.6.0
8
8
  ENV SBT_VERSION 1.3.3
@@ -25,7 +25,7 @@ RUN apt-get update && apt-get install -y \
25
25
  RUN add-apt-repository ppa:git-core/ppa && apt-get update && apt-get install -y git
26
26
 
27
27
  # nodejs seems to be required for the one of the gems
28
- RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
28
+ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
29
29
  apt-get -y install nodejs
30
30
 
31
31
  # install yarn
@@ -55,8 +55,8 @@ RUN curl -o rebar3 https://s3.amazonaws.com/rebar3/rebar3 && \
55
55
 
56
56
  # install and update python and python-pip
57
57
  RUN apt-get install -y python python-pip python3-pip && \
58
- pip2 install --no-cache-dir --upgrade pip==$PIP_INSTALL_VERSION && \
59
- pip3 install --no-cache-dir --upgrade pip==$PIP3_INSTALL_VERSION
58
+ python3 -m pip install pip==$PIP3_INSTALL_VERSION --upgrade && \
59
+ python -m pip install pip==$PIP_INSTALL_VERSION --upgrade --force
60
60
 
61
61
  # install maven
62
62
  RUN curl -O https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz && \
@@ -154,16 +154,31 @@ RUN wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsof
154
154
  sudo apt-get update &&\
155
155
  sudo apt-get install -y dotnet-runtime-2.1 dotnet-sdk-2.1 dotnet-sdk-2.2 dotnet-sdk-3.0 dotnet-sdk-3.1
156
156
 
157
+ # install Composer
157
158
  RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4F4EA0AAE5267A6C &&\
158
159
  echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/php.list &&\
159
160
  apt-get update &&\
160
161
  apt-get install -y php7.4-cli &&\
162
+ EXPECTED_COMPOSER_INSTALLER_CHECKSUM="$(curl --silent https://composer.github.io/installer.sig)" &&\
161
163
  php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" &&\
162
- php -r "if (hash_file('sha384', 'composer-setup.php') === '795f976fe0ebd8b75f26a6dd68f78fd3453ce79f32ecb33e7fd087d39bfeb978342fb73ac986cd4f54edd0dc902601dc') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" &&\
164
+ ACTUAL_COMPOSER_INSTALLER_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" &&\
165
+ test "${ACTUAL_COMPOSER_INSTALLER_CHECKSUM}" = "${EXPECTED_COMPOSER_INSTALLER_CHECKSUM}" || (echo "ERROR: Invalid installer checksum" >&2; false) &&\
163
166
  php composer-setup.php &&\
164
167
  php -r "unlink('composer-setup.php');" &&\
165
168
  mv composer.phar /usr/bin/composer
166
169
 
170
+ # install miniconda
171
+ # See https://docs.conda.io/en/latest/miniconda_hashes.html
172
+ # for latest versions and SHAs.
173
+ WORKDIR /tmp
174
+ RUN \
175
+ conda_installer=Miniconda3-py38_4.9.2-Linux-x86_64.sh &&\
176
+ ref='1314b90489f154602fd794accfc90446111514a5a72fe1f71ab83e07de9504a7' &&\
177
+ wget -q https://repo.anaconda.com/miniconda/${conda_installer} &&\
178
+ sha=`openssl sha256 "${conda_installer}" | cut -d' ' -f2` &&\
179
+ ([ "$sha" = "${ref}" ] || (echo "Verification failed: ${sha} != ${ref}"; false)) &&\
180
+ (echo; echo "yes") | sh "${conda_installer}"
181
+
167
182
  # install license_finder
168
183
  COPY . /LicenseFinder
169
184
  RUN bash -lc "cd /LicenseFinder && bundle config set no-cache 'true' && bundle install -j4 && rake install"
data/README.md CHANGED
@@ -54,6 +54,7 @@ and give you an actionable exception report.
54
54
  * Rust (via `cargo`)
55
55
  * Go Modules (via `go mod`)
56
56
  * PHP (via `composer`)
57
+ * Python (via Conda [Conda 4.8.3, Python 3.7, Bash; requires an `environment.yml` or `environment.yaml`])
57
58
 
58
59
  ## Installation
59
60
 
@@ -121,9 +122,9 @@ be useful when you need to track down an unexpected package or
121
122
  license.
122
123
 
123
124
  If you do not want to manually run an individual package manager's prepare
124
- command (ex: `bundle install`, `npm install`, etc) to ensure your project
125
+ command (ex: `bundle install`, `npm install`, etc) to ensure your project
125
126
  is fully prepared to be scanned, use the `--prepare` or `-p` option which will run
126
- each active package manager's prepare command for you. If you would like to continue
127
+ each active package manager's prepare command for you. If you would like to continue
127
128
  running `license_finder` even if there is an issue with a prepare step, use the
128
129
  `--prepare-no-fail` option which prepares but carries on despite any potential failures.
129
130
 
@@ -135,7 +136,7 @@ command.
135
136
 
136
137
  If you have docker installed, try using the included `dlf` script (potentially
137
138
  symlinked to be in your path via `ln -s LicenseFinder/dlf /usr/local/bin` or
138
- whatever method you prefer). This will run any commmands passed to it inside a
139
+ whatever method you prefer). This will run any commands passed to it inside a
139
140
  pre-provisioned Docker container to maintain consistent versions of all the
140
141
  package managers. For example,
141
142
 
@@ -156,10 +157,10 @@ You can better understand the way this script works by looking at its source, bu
156
157
  reference it will mount your current directory at the path `/scan` and run any commands
157
158
  passed to it from that directory.
158
159
 
159
- Note that the docker image will run the gem which is installed within it.
160
+ Note that the docker image will run the gem which is installed within it.
160
161
  So the docker image tagged `4.0.2` will run *License Finder Version 4.0.2*
161
162
 
162
- See the [contibuting guide](https://github.com/pivotal/LicenseFinder/blob/master/CONTRIBUTING.md) for information on development.
163
+ See the [contributing guide](https://github.com/pivotal/LicenseFinder/blob/master/CONTRIBUTING.md) for information on development.
163
164
 
164
165
  ### Activation
165
166
 
@@ -310,7 +311,7 @@ be approved. The project name at the top of the report can be set with
310
311
  `license_finder project_name add`.
311
312
 
312
313
  ### Note:
313
- When using the yarn package manager, when a node_module's package.json doesn't
314
+ When using the yarn package manager, when a node_module's package.json doesn't
314
315
  explicitly declare a license, yarn indicates that it has inferred the license based
315
316
  on some keywords in other files by appending an asterisk to the license name. If you
316
317
  see a * at the end of the license name, this is intended.
@@ -332,7 +333,7 @@ $ license_finder licenses add my_unknown_dependency MIT --homepage="www.unknown-
332
333
  ```
333
334
 
334
335
  This command would assign the MIT license to the dependency
335
- `my_unknown_dependency`. It will also set its homepage to `wwww.unknown-code.org`.
336
+ `my_unknown_dependency`. It will also set its homepage to `www.unknown-code.org`.
336
337
 
337
338
 
338
339
  ### Adding Hidden Dependencies
@@ -420,6 +421,15 @@ If you store rebar dependencies in a custom directory (by setting `deps_dir` in
420
421
  You can also invoke a custom Mix script `remix` with `--mix_command remix` and
421
422
  set `--mix_deps_dir` to fetch Mix dependencies from a custom directory.
422
423
 
424
+ ### Narrow down Package Manager
425
+
426
+ By default, license_finder will check for all supported package managers,
427
+ but you can narrow it down to use only those you pass to `--enabled-package-managers`.
428
+ For example,
429
+
430
+ ```
431
+ $ license_finder --enabled-package-managers bundler npm
432
+ ```
423
433
 
424
434
  ### Saving Configuration
425
435
 
@@ -437,6 +447,11 @@ rebar_command: './rebarw'
437
447
  rebar_deps_dir: './rebar_deps'
438
448
  mix_command: './mixw'
439
449
  mix_deps_dir: './mix_deps'
450
+ enabled_package_managers:
451
+ - bundler
452
+ - gradle
453
+ - rebar
454
+ - mix
440
455
  ```
441
456
 
442
457
  ### Gradle Projects
@@ -461,9 +476,9 @@ downloadLicenses {
461
476
  ### Conan Projects
462
477
 
463
478
  `license_finder` supports Conan. You need to have the following lines in your conanfile.txt for `license_finder` to retrieve dependencies' licenses.
464
- Ensure that `conan install` does not generate an error.
479
+ Ensure that `conan install` does not generate an error.
465
480
 
466
- ```
481
+ ```
467
482
  [imports]
468
483
  ., license* -> ./licenses @ folder=True, ignore_case=True
469
484
  ```
@@ -517,9 +532,9 @@ And save a `LICENSE` file which contains your license text in your repo.
517
532
 
518
533
  * Bundler
519
534
  * When using `--project-path`, Bundler cannot find the Gemfile.
520
-
535
+
521
536
  * Yarn
522
- * A module that is incompatible with the platform on which
537
+ * A module that is incompatible with the platform on which
523
538
  license_finder is run will always be reported to have a license type
524
539
  of "unknown". ([#456](https://github.com/pivotal/LicenseFinder/issues/456))
525
540
 
data/Rakefile CHANGED
@@ -54,7 +54,7 @@ task :update_pipeline, [:slack_url, :slack_channel] do |_, args|
54
54
  puts 'Warning: You should provide slack channel and url to receive slack notifications on build failures'
55
55
  end
56
56
 
57
- ruby_versions = %w[2.7.1 2.6.5 2.5.7 2.4.9 2.3.8 jruby-9.2.9.0]
57
+ ruby_versions = %w[2.7.1 2.6.5 2.5.7 2.4.9 2.3.8 jruby-9.2.14.0]
58
58
 
59
59
  params = []
60
60
  params << "ruby_versions=#{ruby_versions.join(',')}"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.9.0
1
+ 6.12.1
@@ -13,6 +13,8 @@ resource_types:
13
13
  source:
14
14
  repository: cfcommunity/slack-notification-resource
15
15
  tag: latest
16
+ username: ((LicenseFinderDocker.username))
17
+ password: ((LicenseFinderDocker.password))
16
18
  <% end %>
17
19
 
18
20
  resources:
@@ -8,6 +8,8 @@ resource_types:
8
8
  source:
9
9
  repository: cfcommunity/slack-notification-resource
10
10
  tag: latest
11
+ username: ((LicenseFinderDocker.username))
12
+ password: ((LicenseFinderDocker.password))
11
13
  <% end %>
12
14
 
13
15
  resources:
@@ -154,7 +156,7 @@ jobs:
154
156
  plan:
155
157
  - get: lf-git
156
158
  tags: ["private-worker"]
157
- passed: [<%= "#{ruby_versions.map{ |version| "ruby-#{version}"}.join(', ')}, rubocop" %>]
159
+ passed: [<%= "#{ruby_versions.map{ |version| "ruby-#{version}" unless version == "jruby-9.2.14.0" }.compact.join(', ') }, rubocop" %>]
158
160
  - get: semver-version
159
161
  tags: ["private-worker"]
160
162
  trigger: true
data/ci/tasks/rubocop.yml CHANGED
@@ -5,6 +5,8 @@ image_resource:
5
5
  source:
6
6
  repository: ruby
7
7
  tag: 2.7.1
8
+ username: ((LicenseFinderDocker.username))
9
+ password: ((LicenseFinderDocker.password))
8
10
 
9
11
  inputs:
10
12
  - name: LicenseFinder
@@ -4,6 +4,8 @@ image_resource:
4
4
  source:
5
5
  repository: brenix/alpine-bash-git-ssh
6
6
  tag: latest
7
+ username: ((LicenseFinderDocker.username))
8
+ password: ((LicenseFinderDocker.password))
7
9
  platform: linux
8
10
  inputs:
9
11
  - name: lf-git
data/examples/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gem 'license_finder', path: '..'
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+
8
+ # This is an example of how to programatically generate a report using a custom
9
+ # ERB template. Run with
10
+ # > bundle install
11
+ # > ./custom_erb_template.rb
12
+
13
+ require 'license_finder'
14
+
15
+ # See lib/license_finder/core.rb for more configuration options.
16
+ # A quiet logger is required when running reports...
17
+ lf = LicenseFinder::Core.new(LicenseFinder::Configuration.with_optional_saved_config(logger: :quiet))
18
+
19
+ # Find many more examples of complex ERB templates in
20
+ # lib/license_finder/reports/templates/
21
+ template = Pathname.new('./sample_template.erb')
22
+ print LicenseFinder::ErbReport
23
+ .new(lf.acknowledged, project_name: lf.project_name)
24
+ .to_s(template)
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+
8
+ # This is an example of how to programatically extract the information that
9
+ # LicenseFinder has about packages and their licenses.
10
+ # > bundle install
11
+ # > ./extract_license_data.rb
12
+
13
+ require 'license_finder'
14
+
15
+ # See lib/license_finder/core.rb for more configuration options.
16
+ # A quiet logger is required when running reports...
17
+ lf = LicenseFinder::Core.new(LicenseFinder::Configuration.with_optional_saved_config(logger: :quiet))
18
+
19
+ # Groups of packages
20
+ lf.acknowledged # All (non-ignored) packages license_finder is tracking
21
+ lf.unapproved # The packages which have not been approved or permitted
22
+ lf.restricted # The packages which have been restricted
23
+
24
+ # Package details
25
+ lf.acknowledged.each do |package|
26
+ # Approvals
27
+ package.approved? # Whether the package has been approved manually or permitted
28
+ package.approved_manually?
29
+ package.permitted?
30
+ package.restricted?
31
+
32
+ # Licensing
33
+ # The set of licenses, each of which has a name and url, which
34
+ # license_finder will report for this package.
35
+ package.licenses
36
+ # Additional information about how these licenses were chosen
37
+ # (from decision, from spec, from files, or none-found). See
38
+ # LicenseFinder::Licensing and LicenseFinder::Activation
39
+ package.activations
40
+ # The files that look like licenses, found in the package's
41
+ # directory. Caveat: if a package's licenses were specified by a decision or
42
+ # by the package's spec, the license_files will be ignored. That means,
43
+ # package.licenses may report different licenses than those found in
44
+ # license_files.
45
+ package.license_files
46
+ package.license_files.each do |file|
47
+ # The license found in this file.
48
+ file.license
49
+ # The text of the file. Sometimes this will be an entire README file,
50
+ # because license_finder has found the phrase "is released under the
51
+ # MIT license" in it.
52
+ file.text
53
+ end
54
+ package.licensing.activations_from_decisions # If license_finder only knew about decisions, what licenses would it report?
55
+ package.licensing.activations_from_spec # If license_finder only knew about package specs, what licenses would it report?
56
+ package.licensing.activations_from_files # If license_finder only knew about package files, what licenses would it report?
57
+ package.licensing.activations_from_files.each do |activation|
58
+ # Each activation groups together all files that point to the same license.
59
+ # Each file contains its #license and #text.
60
+ activation.license
61
+ activation.files
62
+ end
63
+ end
@@ -0,0 +1,7 @@
1
+ Licenses
2
+
3
+ <%= dependencies.size %> total
4
+
5
+ <% grouped_dependencies.each do |license_name, group| -%>
6
+ * <%= group.size %> <%= license_name %>
7
+ <% end %>
@@ -11,6 +11,10 @@ module LicenseFinder
11
11
  desc: 'Where decisions are saved. Defaults to doc/dependency_decisions.yml.'
12
12
  class_option :log_directory,
13
13
  desc: 'Where logs are saved. Defaults to ./lf_logs/$PROJECT/prepare_$PACKAGE_MANAGER.log'
14
+ class_option :enabled_package_managers,
15
+ desc: 'List of package managers to be enabled. Defaults to all supported package managers.',
16
+ type: :array,
17
+ enum: LicenseFinder::Scanner.supported_package_manager_ids
14
18
 
15
19
  no_commands do
16
20
  def decisions
@@ -32,6 +36,7 @@ module LicenseFinder
32
36
  extract_options(
33
37
  :project_path,
34
38
  :decisions_file,
39
+ :enabled_package_managers,
35
40
  :go_full_version,
36
41
  :gradle_command,
37
42
  :gradle_include_groups,
@@ -53,7 +58,9 @@ module LicenseFinder
53
58
  :columns,
54
59
  :aggregate_paths,
55
60
  :recursive,
56
- :sbt_include_groups
61
+ :sbt_include_groups,
62
+ :conda_bash_setup_script,
63
+ :composer_check_require_only
57
64
  ).merge(
58
65
  logger: logger_mode
59
66
  )
@@ -19,7 +19,8 @@ module LicenseFinder
19
19
  'markdown' => MarkdownReport,
20
20
  'csv' => CsvReport,
21
21
  'xml' => XmlReport,
22
- 'json' => JsonReport
22
+ 'json' => JsonReport,
23
+ 'junit' => JunitReport
23
24
  }.freeze
24
25
 
25
26
  class_option :go_full_version, desc: 'Whether dependency version should include full version. Only meaningful if used with a Go project. Defaults to false.'
@@ -37,6 +38,9 @@ module LicenseFinder
37
38
  class_option :mix_command, desc: "Command to use when fetching packages through Mix. Only meaningful if used with a Mix project (i.e., Elixir or Erlang). Defaults to 'mix'."
38
39
  class_option :mix_deps_dir, desc: "Path to Mix dependencies directory. Only meaningful if used with a Mix project (i.e., Elixir or Erlang). Defaults to 'deps'."
39
40
  class_option :sbt_include_groups, desc: 'Whether dependency name should include group id. Only meaningful if used with a Scala/sbt project. Defaults to false.'
41
+ class_option :conda_bash_setup_script, desc: "Path to conda.sh script. Only meaningful if used with a Conda project. Defaults to '~/miniconda3/etc/profile.d/conda.sh'."
42
+ class_option :composer_check_require_only,
43
+ desc: "Whether to only check for licenses from dependencies on the 'require' section. Only meaningful if used with a Composer project. Defaults to false."
40
44
 
41
45
  # Method options which are shared between report and action_item
42
46
  def self.format_option
@@ -65,6 +65,10 @@ module LicenseFinder
65
65
  Pathname(path_prefix).expand_path
66
66
  end
67
67
 
68
+ def enabled_package_manager_ids
69
+ get(:enabled_package_managers)
70
+ end
71
+
68
72
  def logger_mode
69
73
  get(:logger)
70
74
  end
@@ -93,6 +97,10 @@ module LicenseFinder
93
97
  get(:pip_requirements_path)
94
98
  end
95
99
 
100
+ def conda_bash_setup_script
101
+ get(:conda_bash_setup_script)
102
+ end
103
+
96
104
  def python_version
97
105
  get(:python_version)
98
106
  end
@@ -137,6 +145,10 @@ module LicenseFinder
137
145
  get(:sbt_include_groups)
138
146
  end
139
147
 
148
+ def composer_check_require_only
149
+ get(:composer_check_require_only)
150
+ end
151
+
140
152
  attr_writer :strict_matching
141
153
 
142
154
  attr_reader :strict_matching
@@ -24,7 +24,7 @@ module LicenseFinder
24
24
  # Default +options+:
25
25
  # {
26
26
  # project_path: Pathname.pwd
27
- # logger: {}, # can include quiet: true or debug: true
27
+ # logger: nil, # can be :quiet or :debug
28
28
  # decisions_file: "doc/dependency_decisions.yml",
29
29
  # gradle_command: "gradle",
30
30
  # rebar_command: "rebar",
@@ -93,6 +93,7 @@ module LicenseFinder
93
93
  project_path: config.project_path,
94
94
  log_directory: File.join(config.log_directory, project_name),
95
95
  ignored_groups: decisions.ignored_groups,
96
+ enabled_package_manager_ids: config.enabled_package_manager_ids,
96
97
  go_full_version: config.go_full_version,
97
98
  gradle_command: config.gradle_command,
98
99
  gradle_include_groups: config.gradle_include_groups,
@@ -107,7 +108,9 @@ module LicenseFinder
107
108
  mix_deps_dir: config.mix_deps_dir,
108
109
  prepare: config.prepare,
109
110
  prepare_no_fail: config.prepare_no_fail,
110
- sbt_include_groups: config.sbt_include_groups
111
+ sbt_include_groups: config.sbt_include_groups,
112
+ conda_bash_setup_script: config.conda_bash_setup_script,
113
+ composer_check_require_only: config.composer_check_require_only
111
114
  }
112
115
  end
113
116
  end
@@ -281,6 +281,13 @@ module LicenseFinder
281
281
  return result unless persisted
282
282
 
283
283
  actions = YAML.load(persisted)
284
+
285
+ list_of_actions = (actions || []).map(&:first)
286
+
287
+ if (list_of_actions & %i[whitelist blacklist]).any?
288
+ raise 'The decisions file seems to have whitelist/blacklist keys which are deprecated. Please replace them with permit/restrict respectively and try again! More info - https://github.com/pivotal/LicenseFinder/commit/a40b22fda11b3a0efbb3c0a021381534bc998dd9'
289
+ end
290
+
284
291
  (actions || []).each do |action, *args|
285
292
  result.send(action, *args)
286
293
  end
@@ -38,7 +38,7 @@ module LicenseFinder
38
38
 
39
39
  ## DESCRIPTION
40
40
  @name = name
41
- @version = version
41
+ @version = version || ''
42
42
  @authors = options[:authors] || ''
43
43
  @summary = options[:summary] || ''
44
44
  @description = options[:description] || ''
@@ -198,3 +198,4 @@ require 'license_finder/packages/yarn_package'
198
198
  require 'license_finder/packages/sbt_package'
199
199
  require 'license_finder/packages/cargo_package'
200
200
  require 'license_finder/packages/composer_package'
201
+ require 'license_finder/packages/conda_package'
@@ -22,6 +22,10 @@ module LicenseFinder
22
22
  def takes_priority_over
23
23
  nil
24
24
  end
25
+
26
+ def id
27
+ name.split('::').last.downcase
28
+ end
25
29
  end
26
30
 
27
31
  def installed?(logger = Core.default_logger)
@@ -125,10 +129,10 @@ module LicenseFinder
125
129
  def log_errors_with_cmd(prep_cmd, stderr)
126
130
  logger.info(prep_cmd, 'did not succeed.', color: :red)
127
131
  logger.info(prep_cmd, stderr, color: :red)
128
- log_to_file stderr
132
+ log_to_file(prep_cmd, stderr)
129
133
  end
130
134
 
131
- def log_to_file(contents)
135
+ def log_to_file(prep_cmd, contents)
132
136
  FileUtils.mkdir_p @log_directory
133
137
 
134
138
  # replace whitespace with underscores and remove slashes
@@ -136,7 +140,7 @@ module LicenseFinder
136
140
  log_file = File.join(@log_directory, "prepare_#{log_file_name || 'errors'}.log")
137
141
 
138
142
  File.open(log_file, 'w') do |f|
139
- f.write("Prepare command \"#{prepare_command}\" failed with:\n")
143
+ f.write("Prepare command \"#{prep_cmd}\" failed with:\n")
140
144
  f.write("#{contents}\n\n")
141
145
  end
142
146
  end
@@ -171,5 +175,6 @@ require 'license_finder/package_managers/conan'
171
175
  require 'license_finder/package_managers/sbt'
172
176
  require 'license_finder/package_managers/cargo'
173
177
  require 'license_finder/package_managers/composer'
178
+ require 'license_finder/package_managers/conda'
174
179
 
175
180
  require 'license_finder/package'
@@ -4,7 +4,10 @@ require 'json'
4
4
 
5
5
  module LicenseFinder
6
6
  class Composer < PackageManager
7
- SHELL_COMMAND = 'composer licenses --format=json'
7
+ def initialize(options = {})
8
+ super
9
+ @check_require_only = !!options[:composer_check_require_only]
10
+ end
8
11
 
9
12
  def possible_package_paths
10
13
  [project_path.join('composer.lock'), project_path.join('composer.json')]
@@ -33,7 +36,7 @@ module LicenseFinder
33
36
  end
34
37
 
35
38
  def prepare_command
36
- 'composer install --no-plugins --ignore-platform-reqs --no-interaction'
39
+ 'composer install --no-plugins --no-scripts --ignore-platform-reqs --no-interaction'
37
40
  end
38
41
 
39
42
  def package_path
@@ -50,8 +53,9 @@ module LicenseFinder
50
53
  end
51
54
 
52
55
  def composer_json
53
- stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(Composer::SHELL_COMMAND) }
54
- raise "Command '#{Composer::SHELL_COMMAND}' failed to execute: #{stderr}" unless status.success?
56
+ command = "composer licenses --format=json#{@check_require_only ? ' --no-dev' : ''}"
57
+ stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
58
+ raise "Command '#{command}' failed to execute: #{stderr}" unless status.success?
55
59
 
56
60
  JSON(stdout)
57
61
  end
@@ -0,0 +1,131 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module LicenseFinder
6
+ class Conda < PackageManager
7
+ attr_reader :conda_bash_setup_script
8
+
9
+ def initialize(options = {})
10
+ @conda_bash_setup_script = options[:conda_bash_setup_script] || Pathname("#{ENV['HOME']}/miniconda3/etc/profile.d/conda.sh")
11
+ super
12
+ end
13
+
14
+ # This command is *not* directly executable. See .conda() below.
15
+ def prepare_command
16
+ "conda env create -f #{detected_package_path}"
17
+ end
18
+
19
+ def prepare
20
+ return if environment_exists?
21
+
22
+ prep_cmd = prepare_command
23
+ _stdout, stderr, status = Dir.chdir(project_path) { conda(prep_cmd) }
24
+ return if status.success?
25
+
26
+ log_errors stderr
27
+ raise "Prepare command '#{prep_cmd}' failed" unless @prepare_no_fail
28
+ end
29
+
30
+ def current_packages
31
+ conda_list.map do |entry|
32
+ case entry['channel']
33
+ when 'pypi'
34
+ # PyPI is much faster than `conda search`, use it when we can.
35
+ PipPackage.new(entry['name'], entry['version'], PyPI.definition(entry['name'], entry['version']))
36
+ else
37
+ CondaPackage.new(conda_search_info(entry))
38
+ end
39
+ end.compact
40
+ end
41
+
42
+ def possible_package_paths
43
+ [project_path.join('environment.yaml'), project_path.join('environment.yml')]
44
+ end
45
+
46
+ private
47
+
48
+ def environment_exists?
49
+ environments.grep(environment_name).any?
50
+ end
51
+
52
+ def environments
53
+ command = 'conda env list'
54
+ stdout, stderr, status = conda command
55
+
56
+ environments = []
57
+ if status.success?
58
+ environments = stdout.split("\n").grep_v(/^#/).map { |line| line.split.first }
59
+ else
60
+ log_errors_with_cmd command, stderr
61
+ end
62
+ environments
63
+ end
64
+
65
+ def environment_file
66
+ detected_package_path
67
+ end
68
+
69
+ def environment_name
70
+ @environment_name ||= YAML.load_file(environment_file).fetch('name')
71
+ end
72
+
73
+ def conda(command)
74
+ Open3.capture3('bash', '-c', "source #{conda_bash_setup_script} && #{command}")
75
+ end
76
+
77
+ def activated_conda(command)
78
+ Open3.capture3('bash', '-c', "source #{conda_bash_setup_script} && conda activate #{environment_name} && #{command}")
79
+ end
80
+
81
+ # Algorithm is based on
82
+ # https://bioinformatics.stackexchange.com/a/11226
83
+ # but completely recoded in Ruby. Like the poster, if the package is
84
+ # actually managed by conda, we assume that all the potential infos (for
85
+ # various architectures, versions of python, etc) have the same license.
86
+ def conda_list
87
+ command = 'conda list'
88
+ stdout, stderr, status = activated_conda(command)
89
+
90
+ if status.success?
91
+ conda_list = []
92
+ stdout.each_line do |line|
93
+ next if line =~ /^\s*#/
94
+
95
+ name, version, build, channel = line.split
96
+ conda_list << {
97
+ 'name' => name,
98
+ 'version' => version,
99
+ 'build' => build,
100
+ 'channel' => channel
101
+ }
102
+ end
103
+ conda_list
104
+ else
105
+ log_errors_with_cmd command, stderr
106
+ []
107
+ end
108
+ end
109
+
110
+ def conda_search_info(list_entry)
111
+ command = 'conda search --info --json '
112
+ command += "--channel #{list_entry['channel']} " if list_entry['channel'] && !list_entry['channel'].empty?
113
+ command += "'#{list_entry['name']} #{list_entry['version']}'"
114
+
115
+ # Errors from conda (in --json mode, at least) show up in stdout, not stderr
116
+ stdout, _stderr, status = activated_conda(command)
117
+
118
+ name = list_entry['name']
119
+
120
+ if status.success?
121
+ JSON(stdout).fetch(name).first
122
+ else
123
+ log_errors_with_cmd command, stdout
124
+ list_entry
125
+ end
126
+ rescue KeyError
127
+ logger.info('Conda', "Key error trying to find #{name} in\n#{JSON(stdout)}")
128
+ list_entry
129
+ end
130
+ end
131
+ end
@@ -18,11 +18,16 @@ module LicenseFinder
18
18
  GoPackage.from_dependency({
19
19
  'ImportPath' => project['name'],
20
20
  'InstallPath' => project_path.join('vendor', project['name']),
21
- 'Rev' => project['revision']
21
+ 'Rev' => project['revision'],
22
+ 'Homepage' => repo_name(project['name'])
22
23
  }, nil, true)
23
24
  end
24
25
  end
25
26
 
27
+ def repo_name(name)
28
+ name.split('/')[0..2].join('/')
29
+ end
30
+
26
31
  def self.takes_priority_over
27
32
  Go15VendorExperiment
28
33
  end
@@ -37,11 +37,16 @@ module LicenseFinder
37
37
  GoPackage.from_dependency({
38
38
  'ImportPath' => dep,
39
39
  'InstallPath' => detected_package_path.join(dep),
40
- 'Rev' => 'vendored-' + project_sha(detected_package_path.join(dep))
40
+ 'Rev' => 'vendored-' + project_sha(detected_package_path.join(dep)),
41
+ 'Homepage' => repo_name(dep)
41
42
  }, nil, true)
42
43
  end
43
44
  end
44
45
 
46
+ def repo_name(name)
47
+ name.split('/')[0..2].join('/')
48
+ end
49
+
45
50
  def package_management_command
46
51
  'go'
47
52
  end
@@ -76,10 +76,15 @@ module LicenseFinder
76
76
  info = {
77
77
  'ImportPath' => name,
78
78
  'InstallPath' => install_path,
79
- 'Rev' => version
79
+ 'Rev' => version,
80
+ 'Homepage' => repo_name(name)
80
81
  }
81
82
 
82
83
  GoPackage.from_dependency(info, nil, true)
83
84
  end
85
+
86
+ def repo_name(name)
87
+ name.split('/')[0..2].join('/')
88
+ end
84
89
  end
85
90
  end
@@ -14,7 +14,7 @@ module LicenseFinder
14
14
  end
15
15
 
16
16
  def prepare_command
17
- 'npm install --no-save'
17
+ 'npm install --no-save --ignore-scripts'
18
18
  end
19
19
 
20
20
  def possible_package_paths
@@ -30,9 +30,14 @@ module LicenseFinder
30
30
  GoPackage.from_dependency({
31
31
  'ImportPath' => import_path,
32
32
  'InstallPath' => license_path,
33
- 'Rev' => package_hash.fetch('version')
33
+ 'Rev' => package_hash.fetch('version'),
34
+ 'Homepage' => repo_name(import_path)
34
35
  }, nil, true)
35
36
  end
36
37
  end
38
+
39
+ def repo_name(name)
40
+ name.split('/')[0..2].join('/')
41
+ end
37
42
  end
38
43
  end
@@ -56,7 +56,7 @@ module LicenseFinder
56
56
  end
57
57
 
58
58
  def prepare_command
59
- 'yarn install --ignore-engines'
59
+ 'yarn install --ignore-engines --ignore-scripts'
60
60
  end
61
61
 
62
62
  private
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LicenseFinder
4
+ class CondaPackage < Package
5
+ attr_accessor :identifier, :json
6
+
7
+ def initialize(conda_json)
8
+ @json = conda_json
9
+ @identifier = Identifier.from_hash(conda_json)
10
+ super(@identifier.name,
11
+ @identifier.version,
12
+ spec_licenses: Package.license_names_from_standard_spec(conda_json),
13
+ children: children)
14
+ end
15
+
16
+ def ==(other)
17
+ other.is_a?(CondaPackage) && @identifier == other.identifier
18
+ end
19
+
20
+ def to_s
21
+ @identifier.to_s
22
+ end
23
+
24
+ def package_manager
25
+ 'Conda'
26
+ end
27
+
28
+ def package_url
29
+ @json['url']
30
+ end
31
+
32
+ def children
33
+ @json.fetch('depends', []).map { |constraint| constraint.split.first }
34
+ end
35
+
36
+ class Identifier
37
+ attr_accessor :name, :version
38
+
39
+ def initialize(name, version)
40
+ @name = name
41
+ @version = version
42
+ end
43
+
44
+ def self.from_hash(hash)
45
+ name = hash['name']
46
+ version = hash['version']
47
+ return nil if name.nil? || version.nil?
48
+
49
+ Identifier.new(name, version)
50
+ end
51
+
52
+ def ==(other)
53
+ other.is_a?(Identifier) && @name == other.name && @version == other.version
54
+ end
55
+
56
+ def eql?(other)
57
+ self == other
58
+ end
59
+
60
+ def hash
61
+ [@name, @version].hash
62
+ end
63
+
64
+ def <=>(other)
65
+ sort_name = @name <=> other.name
66
+ sort_name.zero? ? @version <=> other.version : sort_name
67
+ end
68
+
69
+ def to_s
70
+ "#{@name} - #{@version}"
71
+ end
72
+ end
73
+ end
74
+ end
@@ -30,3 +30,4 @@ require 'license_finder/reports/html_report'
30
30
  require 'license_finder/reports/markdown_report'
31
31
  require 'license_finder/reports/xml_report'
32
32
  require 'license_finder/reports/json_report'
33
+ require 'license_finder/reports/junit_report'
@@ -0,0 +1,19 @@
1
+ require 'license_finder/reports/erb_report'
2
+
3
+ module LicenseFinder
4
+ class JunitReport < ErbReport
5
+ ROOT_PATH = Pathname.new(__FILE__).dirname
6
+ TEMPLATE_PATH = ROOT_PATH.join('templates')
7
+
8
+ def to_s(filename = TEMPLATE_PATH.join("#{template_name}.erb"))
9
+ template = ERB.new(filename.read, nil, '-')
10
+ template.result(binding)
11
+ end
12
+
13
+ private
14
+
15
+ def template_name
16
+ 'junit_report'
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuites failures="<%= unapproved_dependencies.size %>" name="<%= project_name %>" tests="<%= dependencies.size %>">
3
+ <% sorted_dependencies.each_with_index do |dependency, i| -%>
4
+ <testsuite failures="<%= dependency.approved? ? "0" : "1" -%>" id="<%= i %>" name="<%= dependency.name %>" package="Gemfile.lock" skipped="0" tests="1" timestamp="<%= Time.now.strftime("%Y-%m-%dT%H:%M:%S:%6N") %>">
5
+ <testcase classname="<%= license_names(dependency) %>" name="<%= dependency.name %>"<%= dependency.approved? ? " /" : "" %>>
6
+ <%- unless dependency.approved? -%>
7
+ <failure message="Unapproved license in '<%= dependency.name %>' <%= dependency.version %>">
8
+ Name: <%= dependency.name %>
9
+ Version: <%= dependency.version %>
10
+ Licence:
11
+ <%- if dependency.licenses.any? -%>
12
+ <%- dependency.licenses.each do |license| -%>- <%=license.name %>: <%=license.url %><% end %>
13
+ <%- end -%>
14
+ URL: <%= dependency.package_url %>
15
+ Homepage: <%= dependency.homepage %>
16
+ Summary: <%= REXML::Text.new(dependency.summary, false, nil, false) %>
17
+ Description: <%= REXML::Text.new(dependency.description, false, nil, false) %>
18
+ <% if dependency.parents.any? %>
19
+ Dependencies:
20
+ <% dependency.parents.to_a.each do |dep| -%>
21
+ - <%= dep %>
22
+ <% end -%>
23
+ <% end -%>
24
+ <%- if dependency.children.any? -%>
25
+ Requirements:
26
+ <%- dependency.children.each do |req| -%>
27
+ - <%= req %>
28
+ <% end -%>
29
+ <% end -%>
30
+ </failure>
31
+ <system-out>
32
+ stdout
33
+ </system-out>
34
+ <system-err>
35
+ stderr
36
+ </system-err>
37
+ </testcase>
38
+ <%- end -%>
39
+ </testsuite>
40
+ <% end -%>
41
+ </testsuites>
@@ -4,7 +4,8 @@ module LicenseFinder
4
4
  class Scanner
5
5
  PACKAGE_MANAGERS = [
6
6
  GoModules, GoDep, GoWorkspace, Go15VendorExperiment, Glide, Gvt, Govendor, Trash, Dep, Bundler, NPM, Pip,
7
- Yarn, Bower, Maven, Gradle, CocoaPods, Rebar, Erlangmk, Nuget, Carthage, Mix, Conan, Sbt, Cargo, Dotnet, Composer, Pipenv
7
+ Yarn, Bower, Maven, Gradle, CocoaPods, Rebar, Erlangmk, Nuget, Carthage, Mix, Conan, Sbt, Cargo, Dotnet, Composer, Pipenv,
8
+ Conda
8
9
  ].freeze
9
10
 
10
11
  class << self
@@ -12,6 +13,10 @@ module LicenseFinder
12
13
  paths.reject { |path| subproject?(Pathname(path)) }
13
14
  end
14
15
 
16
+ def supported_package_manager_ids
17
+ PACKAGE_MANAGERS.map(&:id)
18
+ end
19
+
15
20
  private
16
21
 
17
22
  def subproject?(path)
@@ -28,6 +33,7 @@ module LicenseFinder
28
33
  @config = config
29
34
  @project_path = @config[:project_path]
30
35
  @logger = @config[:logger]
36
+ @enabled_package_manager_ids = @config[:enabled_package_manager_ids]
31
37
  end
32
38
 
33
39
  def active_packages
@@ -40,7 +46,7 @@ module LicenseFinder
40
46
  return @package_managers if @package_managers
41
47
 
42
48
  active_pm_classes = []
43
- PACKAGE_MANAGERS.each do |pm_class|
49
+ enabled_package_managers.each do |pm_class|
44
50
  active = pm_class.new(@config).active?
45
51
 
46
52
  if active
@@ -56,5 +62,22 @@ module LicenseFinder
56
62
  active_pm_classes -= active_pm_classes.map(&:takes_priority_over)
57
63
  @package_managers = active_pm_classes.map { |pm_class| pm_class.new(@config) }
58
64
  end
65
+
66
+ private
67
+
68
+ def enabled_package_managers
69
+ enabled_pm_ids = @enabled_package_manager_ids
70
+
71
+ return PACKAGE_MANAGERS unless enabled_pm_ids
72
+
73
+ enabled_pm_classes = PACKAGE_MANAGERS.select { |pm_class| enabled_pm_ids.include?(pm_class.id) }
74
+
75
+ if enabled_pm_classes.length != enabled_pm_ids.length
76
+ unsupported_pm_ids = enabled_pm_ids - self.class.supported_package_manager_ids
77
+ raise "Unsupported package manager: #{unsupported_pm_ids.join(', ')}"
78
+ end
79
+
80
+ enabled_pm_classes
81
+ end
59
82
  end
60
83
  end
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
46
46
  s.add_dependency 'bundler'
47
47
  s.add_dependency 'rubyzip', '>=1', '<3'
48
48
  s.add_dependency 'thor', '~> 1.0.1'
49
- s.add_dependency 'tomlrb', '~> 1.3.0'
49
+ s.add_dependency 'tomlrb', '>= 1.3', '< 2.1'
50
50
  s.add_dependency 'with_env', '1.1.0'
51
51
  s.add_dependency 'xml-simple', '~> 1.1.5'
52
52
 
@@ -55,7 +55,7 @@ Gem::Specification.new do |s|
55
55
  s.add_development_dependency 'cocoapods', '>= 1.0.0' if RUBY_PLATFORM =~ /darwin/
56
56
  s.add_development_dependency 'fakefs', '~> 1.2.0'
57
57
  s.add_development_dependency 'mime-types', '3.3.1'
58
- s.add_development_dependency 'pry', '~> 0.13.0'
58
+ s.add_development_dependency 'pry', '~> 0.14.0'
59
59
  s.add_development_dependency 'rake', '~> 13.0.1'
60
60
  s.add_development_dependency 'rspec', '~> 3'
61
61
  s.add_development_dependency 'rspec-its', '~> 1.3.0'
@@ -63,6 +63,7 @@ Gem::Specification.new do |s|
63
63
  s.add_development_dependency 'rubocop-performance', '~> 1.5.0'
64
64
  s.add_development_dependency 'webmock', '~> 3.5'
65
65
 
66
+ s.add_development_dependency 'nokogiri', '~>1.10'
66
67
  s.add_development_dependency 'rack', '~> 2.2.2'
67
68
  s.add_development_dependency 'rack-test', '~> 1.1.0', '> 0.7'
68
69
 
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: 6.9.0
4
+ version: 6.12.1
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: 2020-10-05 00:00:00.000000000 Z
30
+ date: 2021-04-12 00:00:00.000000000 Z
31
31
  dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: bundler
@@ -81,16 +81,22 @@ dependencies:
81
81
  name: tomlrb
82
82
  requirement: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - "~>"
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
- version: 1.3.0
86
+ version: '1.3'
87
+ - - "<"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.1'
87
90
  type: :runtime
88
91
  prerelease: false
89
92
  version_requirements: !ruby/object:Gem::Requirement
90
93
  requirements:
91
- - - "~>"
94
+ - - ">="
92
95
  - !ruby/object:Gem::Version
93
- version: 1.3.0
96
+ version: '1.3'
97
+ - - "<"
98
+ - !ruby/object:Gem::Version
99
+ version: '2.1'
94
100
  - !ruby/object:Gem::Dependency
95
101
  name: with_env
96
102
  requirement: !ruby/object:Gem::Requirement
@@ -181,14 +187,14 @@ dependencies:
181
187
  requirements:
182
188
  - - "~>"
183
189
  - !ruby/object:Gem::Version
184
- version: 0.13.0
190
+ version: 0.14.0
185
191
  type: :development
186
192
  prerelease: false
187
193
  version_requirements: !ruby/object:Gem::Requirement
188
194
  requirements:
189
195
  - - "~>"
190
196
  - !ruby/object:Gem::Version
191
- version: 0.13.0
197
+ version: 0.14.0
192
198
  - !ruby/object:Gem::Dependency
193
199
  name: rake
194
200
  requirement: !ruby/object:Gem::Requirement
@@ -273,6 +279,20 @@ dependencies:
273
279
  - - "~>"
274
280
  - !ruby/object:Gem::Version
275
281
  version: '3.5'
282
+ - !ruby/object:Gem::Dependency
283
+ name: nokogiri
284
+ requirement: !ruby/object:Gem::Requirement
285
+ requirements:
286
+ - - "~>"
287
+ - !ruby/object:Gem::Version
288
+ version: '1.10'
289
+ type: :development
290
+ prerelease: false
291
+ version_requirements: !ruby/object:Gem::Requirement
292
+ requirements:
293
+ - - "~>"
294
+ - !ruby/object:Gem::Version
295
+ version: '1.10'
276
296
  - !ruby/object:Gem::Dependency
277
297
  name: rack
278
298
  requirement: !ruby/object:Gem::Requirement
@@ -351,6 +371,10 @@ files:
351
371
  - ci/tasks/run-tests.yml
352
372
  - ci/tasks/update-changelog.yml
353
373
  - dlf
374
+ - examples/Gemfile
375
+ - examples/custom_erb_template.rb
376
+ - examples/extract_license_data.rb
377
+ - examples/sample_template.erb
354
378
  - lib/license_finder.rb
355
379
  - lib/license_finder/cli.rb
356
380
  - lib/license_finder/cli/approvals.rb
@@ -413,6 +437,7 @@ files:
413
437
  - lib/license_finder/package_managers/cocoa_pods.rb
414
438
  - lib/license_finder/package_managers/composer.rb
415
439
  - lib/license_finder/package_managers/conan.rb
440
+ - lib/license_finder/package_managers/conda.rb
416
441
  - lib/license_finder/package_managers/dep.rb
417
442
  - lib/license_finder/package_managers/dotnet.rb
418
443
  - lib/license_finder/package_managers/erlangmk.rb
@@ -451,6 +476,7 @@ files:
451
476
  - lib/license_finder/packages/cocoa_pods_package.rb
452
477
  - lib/license_finder/packages/composer_package.rb
453
478
  - lib/license_finder/packages/conan_package.rb
479
+ - lib/license_finder/packages/conda_package.rb
454
480
  - lib/license_finder/packages/erlangmk_package.rb
455
481
  - lib/license_finder/packages/go_package.rb
456
482
  - lib/license_finder/packages/gradle_package.rb
@@ -472,10 +498,12 @@ files:
472
498
  - lib/license_finder/reports/erb_report.rb
473
499
  - lib/license_finder/reports/html_report.rb
474
500
  - lib/license_finder/reports/json_report.rb
501
+ - lib/license_finder/reports/junit_report.rb
475
502
  - lib/license_finder/reports/markdown_report.rb
476
503
  - lib/license_finder/reports/merged_report.rb
477
504
  - lib/license_finder/reports/templates/bootstrap.css
478
505
  - lib/license_finder/reports/templates/html_report.erb
506
+ - lib/license_finder/reports/templates/junit_report.erb
479
507
  - lib/license_finder/reports/templates/markdown_report.erb
480
508
  - lib/license_finder/reports/templates/xml_report.erb
481
509
  - lib/license_finder/reports/text_report.rb
@@ -505,7 +533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
505
533
  - !ruby/object:Gem::Version
506
534
  version: '0'
507
535
  requirements: []
508
- rubygems_version: 3.1.4
536
+ rubygems_version: 3.2.16
509
537
  signing_key:
510
538
  specification_version: 4
511
539
  summary: Audit the OSS licenses of your application's dependencies.