From ead56ee6bdd3c49f575a0607e513cd1c9a947fad Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 12 Aug 2020 13:36:13 -0600 Subject: Ensure drupal pkgs are detected correctly * Use same composer.json and composer.lock file from issue * Check if vendor path exists before specifying env vars * Install php from deb package --- lib/license/finder/ext/composer.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/license/finder/ext/composer.rb b/lib/license/finder/ext/composer.rb index 1be4e2b..1434798 100644 --- a/lib/license/finder/ext/composer.rb +++ b/lib/license/finder/ext/composer.rb @@ -33,10 +33,13 @@ module LicenseFinder def default_env @default_env ||= { 'COMPOSER_ALLOW_SUPER' => '1', - 'COMPOSER_CACHE_DIR' => ENV.fetch('COMPOSER_CACHE_DIR', vendor_path.join('.cache')).to_s, - 'COMPOSER_CAFILE' => ENV.fetch('COMPOSER_CACHE_DIR', shell.default_certificate_path).to_s, - 'COMPOSER_VENDOR_DIR' => ENV.fetch('COMPOSER_VENDOR_DIR', vendor_path).to_s - } + 'COMPOSER_CAFILE' => ENV.fetch('COMPOSER_CACHE_DIR', shell.default_certificate_path).to_s + }.tap do |env| + if vendor_path.exist? + env['COMPOSER_CACHE_DIR'] = ENV.fetch('COMPOSER_CACHE_DIR', vendor_path.join('.cache')).to_s + env['COMPOSER_VENDOR_DIR'] = ENV.fetch('COMPOSER_VENDOR_DIR', vendor_path).to_s + end + end end def dependencies -- cgit v1.2.3