diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-18 13:39:30 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-04-15 13:25:52 -0600 |
| commit | 6730f0011eb1fafa97492e1d051403fbcdfdd15c (patch) | |
| tree | edba5805bac99826e00bdc579a4c2dfd144e7fa1 /lib | |
| parent | 3fdf2793726ad19d7f654fec0a9a98600d39d48f (diff) | |
Use GRADLE_CLI_OPTS when invoking gradle directly
* Extract gradle_command method
* Bump version and update CHANGELOG
* Remove prepare_java step from run.sh
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/license/finder/ext.rb | 1 | ||||
| -rw-r--r-- | lib/license/finder/ext/gradle.rb | 17 | ||||
| -rw-r--r-- | lib/license/finder/ext/pip.rb | 14 | ||||
| -rw-r--r-- | lib/license/finder/ext/pipenv.rb | 8 | ||||
| -rw-r--r-- | lib/license/management/version.rb | 2 |
5 files changed, 28 insertions, 14 deletions
diff --git a/lib/license/finder/ext.rb b/lib/license/finder/ext.rb index 24afd37..703afc5 100644 --- a/lib/license/finder/ext.rb +++ b/lib/license/finder/ext.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'license/finder/ext/go_modules' +require 'license/finder/ext/gradle' require 'license/finder/ext/license' require 'license/finder/ext/maven' require 'license/finder/ext/nuget' diff --git a/lib/license/finder/ext/gradle.rb b/lib/license/finder/ext/gradle.rb new file mode 100644 index 0000000..64bcfbb --- /dev/null +++ b/lib/license/finder/ext/gradle.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module LicenseFinder + class Gradle + def package_management_command + wrapper? ? './gradlew' : gradle_command + end + + def wrapper? + File.exist?(File.join(project_path, 'gradlew')) + end + + def gradle_command + ['gradle', ENV.fetch('GRADLE_CLI_OPTS', '-x test')].join(' ') + end + end +end diff --git a/lib/license/finder/ext/pip.rb b/lib/license/finder/ext/pip.rb index 084816c..51e2039 100644 --- a/lib/license/finder/ext/pip.rb +++ b/lib/license/finder/ext/pip.rb @@ -55,19 +55,11 @@ module LicenseFinder Dir.chdir(project_path) { yield } end - def pypi - @pypi ||= Spandx::Python::PyPI.new(sources: [ - Spandx::Python::Source.new({ - 'name' => 'pypi', - 'url' => python.pip_index_url, - 'verify_ssl' => true - }) - ]) - end - def legacy_results + sources = [Spandx::Python::Source.new({ 'name' => 'pypi', 'url' => python.pip_index_url, 'verify_ssl' => true })] + pypi = Spandx::Python::PyPI.new pip_output.map do |name, version, _children, _location| - spec = pypi.definition_for(name, version) + spec = pypi.definition_for(name, version, sources: sources) Package.new( name, version, diff --git a/lib/license/finder/ext/pipenv.rb b/lib/license/finder/ext/pipenv.rb index 056b81d..ebe8cad 100644 --- a/lib/license/finder/ext/pipenv.rb +++ b/lib/license/finder/ext/pipenv.rb @@ -38,11 +38,15 @@ module LicenseFinder end def build_package_for(name, version) - PipPackage.new(name, version, pypi.definition_for(name, version)) + PipPackage.new(name, version, pypi.definition_for(name, version, sources: sources)) + end + + def sources + @sources ||= ::Spandx::Python::Source.sources_from(lockfile_hash) end def pypi - @pypi ||= ::Spandx::Python::PyPI.new(sources: ::Spandx::Python::Source.sources_from(lockfile_hash)) + @pypi ||= ::Spandx::Python::Pypi.new end def lockfile_hash diff --git a/lib/license/management/version.rb b/lib/license/management/version.rb index fe617f9..46ec201 100644 --- a/lib/license/management/version.rb +++ b/lib/license/management/version.rb @@ -2,6 +2,6 @@ module License module Management - VERSION = '3.7.1' + VERSION = '3.7.2' end end |
