summaryrefslogtreecommitdiff
path: root/lib/license/finder
diff options
context:
space:
mode:
Diffstat (limited to 'lib/license/finder')
-rw-r--r--lib/license/finder/ext/go_modules.rb4
-rw-r--r--lib/license/finder/ext/pip.rb4
-rw-r--r--lib/license/finder/ext/pipenv.rb15
-rw-r--r--lib/license/finder/ext/shared_helpers.rb7
4 files changed, 14 insertions, 16 deletions
diff --git a/lib/license/finder/ext/go_modules.rb b/lib/license/finder/ext/go_modules.rb
index 2ef3aa2..d86f21a 100644
--- a/lib/license/finder/ext/go_modules.rb
+++ b/lib/license/finder/ext/go_modules.rb
@@ -25,10 +25,6 @@ module LicenseFinder
private
- def shell
- @shell ||= ::License::Management::Shell.new
- end
-
def absolute_project_path
@absolute_project_path ||= Pathname(project_path).cleanpath
end
diff --git a/lib/license/finder/ext/pip.rb b/lib/license/finder/ext/pip.rb
index a55dba7..5ef6602 100644
--- a/lib/license/finder/ext/pip.rb
+++ b/lib/license/finder/ext/pip.rb
@@ -51,10 +51,6 @@ module LicenseFinder
Dir.chdir(project_path) { yield }
end
- def shell
- @shell ||= ::License::Management::Shell.new
- end
-
def pypi
@pypi ||= Spandx::Python::PyPI.new(sources: [
Spandx::Python::Source.new({
diff --git a/lib/license/finder/ext/pipenv.rb b/lib/license/finder/ext/pipenv.rb
index 075ddd9..d681cc2 100644
--- a/lib/license/finder/ext/pipenv.rb
+++ b/lib/license/finder/ext/pipenv.rb
@@ -5,8 +5,8 @@ module LicenseFinder
def prepare
return unless pipfile?
- shell.execute([:pipenv, '--python', python.version])
- shell.execute([:pipenv, :run, :pipenv, :sync, '--pypi-mirror', python.pip_index_url])
+ shell.execute([:pipenv, '--python', python.version], env: default_env)
+ shell.execute([:pipenv, :run, :pipenv, :sync, '--pypi-mirror', python.pip_index_url], env: default_env)
end
def current_packages
@@ -17,10 +17,6 @@ module LicenseFinder
private
- def shell
- @shell ||= ::License::Management::Shell.new
- end
-
def python
@python ||= ::License::Management::Python.new
end
@@ -52,5 +48,12 @@ module LicenseFinder
def lockfile_hash
@lockfile_hash ||= JSON.parse(IO.read(detected_package_path))
end
+
+ def default_env
+ return {} unless shell.custom_certificate_installed?
+ return {} if ENV['PIP_CERT']
+
+ { 'PIP_CERT' => shell.custom_certificate_path.to_s }
+ end
end
end
diff --git a/lib/license/finder/ext/shared_helpers.rb b/lib/license/finder/ext/shared_helpers.rb
index cee79ab..c3d6319 100644
--- a/lib/license/finder/ext/shared_helpers.rb
+++ b/lib/license/finder/ext/shared_helpers.rb
@@ -2,10 +2,13 @@
module LicenseFinder
module SharedHelpers
+ def shell
+ ::License::Management.shell
+ end
+
class Cmd
def self.run(command)
- @shell ||= ::License::Management::Shell.new
- @shell.execute(command)
+ ::License::Management.shell.execute(command)
end
end
end