Method |
Description |
|
buildConfigCommand ( string $execPath, array $composerArgs, string $key, string $value, array $env, string $installLocation ) : CommandToExec |
Generate command string to call composer config KEY VALUE to install one project. |
|
buildGlobalCommand ( $composerCommand, $execPath, array $composerArgs, string $projectWithVersion, array $env, string $installLocation ) : CommandToExec |
Generate command string to call composer COMMAND to install one project. |
|
configureProjectStability ( string $execPath, array $composerArgs, array $projects, array $options ) : array |
If --stability VALUE is provided, then run a composer config minimum-stability VALUE
command to configure composer.json appropriately. |
|
flipProjectsArray ( string[] $projects ) : array |
Convert from an array of projects to an array where the key is the
project name, and the value (version) is an empty string. |
|
generalCommand ( string $composerCommand, string $execPath, array $composerArgs, array $projects, array $options ) : array |
General command handler. |
|
getCommandsToExec ( $command, array $composerArgs, array $projects, array $options ) : CommandToExec |
Return an array containing a list of commands to execute. Depending on
the composition of the aguments and projects parameters, this list will
contain either a single command string to call through to composer (if
cgr is being used as a composer alias), or it will contain a list of
appropriate replacement 'composer global require' commands that install
each project in its own installation directory, while installing each
projects' binaries in the global Composer bin directory,
~/.composer/vendor/bin. |
|
getDefaultOptionValues ( string $home ) : array |
Return our list of default option values, with paths relative to
the provided home directory. |
|
isComposerVersion ( string $arg ) : boolean |
Identify an argument that could be a Composer version string. |
|
parseArgvAndGetCommandList ( $argv, $home ) |
Figure out everything we're going to do, but don't do any of it
yet, just return the command objects to run. |
|
parseOutOurOptions ( array $argv, array $optionDefaultValues ) : array |
We use our own special-purpose argv parser. The options that apply
to this tool are identified by a simple associative array, where
the key is the option name, and the value is its default value. |
|
projectWithVersion ( string $project, string $version ) : string |
Return $project:$version, or just $project if there is no $version. |
|
requireCommand ( string $execPath, array $composerArgs, array $projects, array $options ) : array |
Provide a safer version of composer global require. Each project
listed in $projects will be installed into its own project directory. |
|
run ( array $argv, string $home ) : integer |
Run the cgr tool, a safer alternative to composer global require. |
|
runCommandList ( array $commandList, $options ) : integer |
Run all of the commands in a list. Abort early if any fail. |
|
separateProjectAndGetCommandList ( $argv, $home, $options ) |
Figure out everything we're going to do, but don't do any of it
yet, just return the command objects to run. |
|
separateProjectsFromArgs ( array $argv, $options ) : array |
After our options are removed by parseOutOurOptions, those items remaining
in $argv will be separated into a list of projects and versions, and
anything else that is not a project:version. Returns an array of two
items containing:
- An associative array, where the key is the project name and the value
is the version (or an empty string, if no version was specified)
- The remaining $argv items not used to build the projects array. |
|
setOutputFile ( $outputFile ) |
Set up output redirection. Used by tests. |
|
updateCommand ( $execPath, array $composerArgs, array $projects, array $options ) : array |
Run composer global update. Not only do we want to update the
"global" Composer project, we also want to update all of the
"isolated" projects installed via cgr in ~/.composer/global. |
|