There are two install roles:
- Global (
composer global require phalcon/crest): runs new, up, down and install. These commands need no project.
- Per project (
require --dev phalcon/crest, run as vendor/bin/crest): runs the project commands, such as make:*, route:list and container:list. They need the project's autoloader and the project's Phalcon, which a global crest cannot load.
The hand-off connects the two roles. When you type crest make:action ... in a project with the global crest, the global crest finds the project's vendor/bin/crest and runs it with the same arguments. It then returns that exit code. You type crest everywhere, and the correct crest runs.
In code, it needs these parts:
- Find the project: search up from the working directory (or --directory) and look for vendor/bin/crest.
- Sort the commands: decide which are host commands (the global crest runs them) and which are project commands (it passes them on).
- Pass the command on: run the project crest with the same arguments and terminal, much as
ShellRunner does now.
- Stop loops: if the running crest is already the project's crest, it must not pass the command to itself.
- Give a clear error: if there is no project crest, tell the user to run composer install or add
phalcon/crest as a dev dependency.
- Update the docs: they must stop telling users to type vendor/bin/crest.
There are two install roles:
composer global require phalcon/crest): runs new, up, down and install. These commands need no project.require --dev phalcon/crest, run asvendor/bin/crest): runs the project commands, such asmake:*,route:listandcontainer:list. They need the project's autoloader and the project's Phalcon, which a global crest cannot load.The hand-off connects the two roles. When you type
crest make:action ...in a project with the global crest, the global crest finds the project's vendor/bin/crest and runs it with the same arguments. It then returns that exit code. You type crest everywhere, and the correct crest runs.In code, it needs these parts:
ShellRunnerdoes now.phalcon/crestas a dev dependency.