summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-08-12 13:36:13 -0600
committermo khan <mo.khan@gmail.com>2020-08-13 10:38:52 -0600
commitead56ee6bdd3c49f575a0607e513cd1c9a947fad (patch)
tree6e55a2b395da34dd47c17aef0eb759cab42914aa /lib
parent6139087cee470d7d1ca9585b7001469298e848b4 (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/license/finder/ext/composer.rb11
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