box-project/box2

Build task fail if there is other composer.json in home directory

konradpodgorski opened this issue · 1 comments

I had empty composer.json file in my home directory (created by mistake, not sure why it existed there)

this composer.json was loaded instead of one from project root directory, because it didn't include vendor-dir script pretty much fail with the following error.

Might be a good idea to limit searching in parent directories to the directory from where task is actually run. https://github.com/box-project/box2/blob/2.0/bin/box#L37-L49

$ ./vendor/bin/box build -v
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'The Composer class loader "/Users/konrad/vendor/autoload.php" could not be found.' in /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box:89
Stack trace:
#0 /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box(16): loadComposerClassloader('/Users/konrad/p...')
#1 {main}
  thrown in /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box on line 89

Fatal error: Uncaught exception 'RuntimeException' with message 'The Composer class loader "/Users/konrad/vendor/autoload.php" could not be found.' in /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box:89
Stack trace:
#0 /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box(16): loadComposerClassloader('/Users/konrad/p...')
#1 {main}
  thrown in /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box on line 89

I'm not sure how this would work for running Box from installations that are not in the current working directory path.