Closed forikal-uk closed 6 years ago
I am thinking that, if a user has not run composer install
or composer update
to get a vendor directory created, then pattern A will carry on going forever until the user types CTRL+C which is not particularly good userbility.
So, I prefer pattern B.
Let's use pattern B in the gsheet-to-xml bootstrap.
and also test the never-ending-loop assumption in those projects that use pattern A and add bug if needed.
I have added some code and tested it.
See: 4ba5935
To test it, I commented out one of the paths to force it to fail and ensured it presented a friendly message:
$ bin/gsheet-to-xml.php
autoload.php not found.
Searched in:
[/Users/x/Documents/Projects/XmlAuthoringSuite/xml-authoring-project/vendor/xmlsquad/gsheet-to-xml/bin/../vendor/autoload.php]
Maybe you forgot to run 'composer install'?
and when it finds the autoload.php it just works:
$ bin/gsheet-to-xml.php
Not enough arguments (missing: "drive-url").
inventory:gsheet-to-xml [-r|--recursive] [--client-secret-file CLIENT-SECRET-FILE] [--access-token-file ACCESS-TOKEN-FILE] [--force-authenticate] [--] <drive-url>
Currently the standalone bootstrap file expects the autoloader to be in one relative location
I notice that other commands can find them irregardless of whether the bin directory is in the root of the project
/bin
or thevendor/bin
directory.There are two styles in xmlsquad.
Pattern A xml-authoring-tools searches up the parent directories in a dynamic fashion:
Pattern B Whereas the ping-drive is hardcoded with some places to look:
I am not sure which one is best pattern to copy.