diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/license/finder/ext/composer.rb | 11 |
1 files changed, 7 insertions, 4 deletions
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 |
