PHP 클래스 Consolidation\Cgr\Application

파일 보기 프로젝트 열기: consolidation/cgr

보호된 프로퍼티들

프로퍼티 타입 설명
$outputFile

공개 메소드들

메소드 설명
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.

보호된 메소드들

메소드 설명
overlayEnvironmentValues ( $defaults ) Replace option default values with the corresponding environment variable value, if it is set.

메소드 상세

buildConfigCommand() 공개 메소드

Generate command string to call composer config KEY VALUE to install one project.
public buildConfigCommand ( string $execPath, array $composerArgs, string $key, string $value, array $env, string $installLocation ) : CommandToExec
$execPath string The path to composer
$composerArgs array The arguments to pass to composer
$key string The config item to set
$value string The value to set the config item to
$env array Environment to set prior to exec
$installLocation string Location to install the project
리턴 CommandToExec

buildGlobalCommand() 공개 메소드

Generate command string to call composer COMMAND to install one project.
public buildGlobalCommand ( $composerCommand, $execPath, array $composerArgs, string $projectWithVersion, array $env, string $installLocation ) : CommandToExec
$composerArgs array The arguments to pass to composer
$projectWithVersion string The project:version to install
$env array Environment to set prior to exec
$installLocation string Location to install the project
리턴 CommandToExec

configureProjectStability() 공개 메소드

If --stability VALUE is provided, then run a composer config minimum-stability VALUE command to configure composer.json appropriately.
public configureProjectStability ( string $execPath, array $composerArgs, array $projects, array $options ) : array
$execPath string The path to composer
$composerArgs array Anything from the global $argv to be passed on to Composer
$projects array A list of projects to install, with the key specifying the project name, and the value specifying its version.
$options array User options from the command line; see $optionDefaultValues in the main() function.
리턴 array

flipProjectsArray() 공개 메소드

Convert from an array of projects to an array where the key is the project name, and the value (version) is an empty string.
public flipProjectsArray ( string[] $projects ) : array
$projects string[]
리턴 array

generalCommand() 공개 메소드

General command handler.
public generalCommand ( string $composerCommand, string $execPath, array $composerArgs, array $projects, array $options ) : array
$composerCommand string The composer command to run e.g. require
$execPath string The path to composer
$composerArgs array Anything from the global $argv to be passed on to Composer
$projects array A list of projects to install, with the key specifying the project name, and the value specifying its version.
$options array User options from the command line; see $optionDefaultValues in the main() function.
리턴 array

getCommandsToExec() 공개 메소드

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.
public getCommandsToExec ( $command, array $composerArgs, array $projects, array $options ) : CommandToExec
$composerArgs array
$projects array
$options array
리턴 CommandToExec

getDefaultOptionValues() 공개 메소드

Return our list of default option values, with paths relative to the provided home directory.
public getDefaultOptionValues ( string $home ) : array
$home string The user's home directory
리턴 array

isComposerVersion() 공개 메소드

Identify an argument that could be a Composer version string.
public isComposerVersion ( string $arg ) : boolean
$arg string The argument to test
리턴 boolean

overlayEnvironmentValues() 보호된 메소드

Replace option default values with the corresponding environment variable value, if it is set.
protected overlayEnvironmentValues ( $defaults )

parseArgvAndGetCommandList() 공개 메소드

Figure out everything we're going to do, but don't do any of it yet, just return the command objects to run.
public parseArgvAndGetCommandList ( $argv, $home )

parseOutOurOptions() 공개 메소드

The result of this function is an array of two items containing: - An array of the items in $argv not used to set an option value - An array of options containing the user-specified or default values
public parseOutOurOptions ( array $argv, array $optionDefaultValues ) : array
$argv array The global $argv passed in by php
$optionDefaultValues array An associative array
리턴 array

projectWithVersion() 공개 메소드

Return $project:$version, or just $project if there is no $version.
public projectWithVersion ( string $project, string $version ) : string
$project string The project to install
$version string The version desired
리턴 string

requireCommand() 공개 메소드

The binaries from each project will still be placed in the global composer bin directory.
public requireCommand ( string $execPath, array $composerArgs, array $projects, array $options ) : array
$execPath string The path to composer
$composerArgs array Anything from the global $argv to be passed on to Composer
$projects array A list of projects to install, with the key specifying the project name, and the value specifying its version.
$options array User options from the command line; see $optionDefaultValues in the main() function.
리턴 array

run() 공개 메소드

Run the cgr tool, a safer alternative to composer global require.
public run ( array $argv, string $home ) : integer
$argv array The global $argv array passed in by PHP
$home string The path to the user's home directory
리턴 integer

runCommandList() 공개 메소드

Run all of the commands in a list. Abort early if any fail.
public runCommandList ( array $commandList, $options ) : integer
$commandList array An array of CommandToExec
리턴 integer

separateProjectAndGetCommandList() 공개 메소드

Figure out everything we're going to do, but don't do any of it yet, just return the command objects to run.
public separateProjectAndGetCommandList ( $argv, $home, $options )

separateProjectsFromArgs() 공개 메소드

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.
public separateProjectsFromArgs ( array $argv, $options ) : array
$argv array The $argv array from parseOutOurOptions()
리턴 array

setOutputFile() 공개 메소드

Set up output redirection. Used by tests.
public setOutputFile ( $outputFile )

updateCommand() 공개 메소드

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.
public updateCommand ( $execPath, array $composerArgs, array $projects, array $options ) : array
$composerArgs array Anything from the global $argv to be passed on to Composer
$projects array A list of projects to update.
$options array User options from the command line; see $optionDefaultValues in the main() function.
리턴 array

프로퍼티 상세

$outputFile 보호되어 있는 프로퍼티

protected $outputFile