本文整理汇总了PHP中Composer\Script\CommandEvent类的典型用法代码示例。如果您正苦于以下问题:PHP CommandEvent类的具体用法?PHP CommandEvent怎么用?PHP CommandEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommandEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installWelcomeText
/**
* Just dump welcome text on how to install eZ Platform.
*
* @param $event CommandEvent A instance
*/
public static function installWelcomeText(CommandEvent $event)
{
$event->getIO()->write(<<<'EOT'
________________/\\\\\\\\\\\\\\\____________/\\\\\\\\\\\\\____/\\\\\\________________________________________/\\\\\_________________________________________________
________________\////////////\\\____________\/\\\/////////\\\_\////\\\______________________________________/\\\///__________________________________________________
__________________________/\\\/_____________\/\\\_______\/\\\____\/\\\_______________________/\\\__________/\\\______________________________________________________
_____/\\\\\\\\__________/\\\/_______________\/\\\\\\\\\\\\\/_____\/\\\_____/\\\\\\\\\_____/\\\\\\\\\\\__/\\\\\\\\\_______/\\\\\_____/\\/\\\\\\\_____/\\\\\__/\\\\\___
___/\\\/////\\\_______/\\\/_________________\/\\\/////////_______\/\\\____\////////\\\___\////\\\////__\////\\\//______/\\\///\\\__\/\\\/////\\\__/\\\///\\\\\///\\\_
__/\\\\\\\\\\\______/\\\/___________________\/\\\________________\/\\\______/\\\\\\\\\\_____\/\\\_________\/\\\_______/\\\__\//\\\_\/\\\___\///__\/\\\_\//\\\__\/\\\_
_\//\\///////_____/\\\/_____________________\/\\\________________\/\\\_____/\\\/////\\\_____\/\\\_/\\_____\/\\\______\//\\\__/\\\__\/\\\_________\/\\\__\/\\\__\/\\\_
__\//\\\\\\\\\\__/\\\\\\\\\\\\\\\___________\/\\\______________/\\\\\\\\\_\//\\\\\\\\/\\____\//\\\\\______\/\\\_______\///\\\\\/___\/\\\_________\/\\\__\/\\\__\/\\\_
___\//////////__\///////////////____________\///______________\/////////___\////////\//______\/////_______\///__________\/////_____\///__________\///___\///___\///__
<fg=cyan>Welcome to eZ Platform!</fg=cyan>
<options=bold>You may now complete the eZ Platform installation with ezplatform:install command, example of use:</options=bold>
<comment> $ php ezpublish/console ezplatform:install --env prod demo</comment>
<options=bold>After executing this, you can launch your browser* and get started.</options=bold>
* Assuming you have setup directory permissions and configured your web server (Apache/Nginx) correctly (see Install.md and doc/ folder in eZ Platform <root-directory>).
EOT
);
}
示例2: __construct
protected function __construct(CommandEvent $event)
{
$this->composerEvent = $event;
$this->io = $this->composerEvent->getIO();
$this->extras = $this->composerEvent->getComposer()->getPackage()->getExtra();
$this->fs = new Filesystem();
}
示例3: enableInstallMode
public static function enableInstallMode(CommandEvent $event)
{
if (!file_exists(SystemUtil::getInstallDoneFilePath())) {
SystemUtil::enableInstallMode();
}
$event->getIO()->write('CampaignChain: Enabled install mode.');
}
示例4: copyBootstrapFiles
/**
* Checks for the twitter/bootstrap package and copys all necessary files into the specified directory.
*
* Where the files are copied into must be specified in the extra section in the project's `composer.json`.
*
* "extra": {
* "bootstrap-public-dir": "src/Acme/MyBundle/Resources/public",
* ...
* }
*
* @param CommandEvent $event
*/
public static function copyBootstrapFiles(CommandEvent $event)
{
/** @var RootPackage $package */
$package = $event->getComposer()->getPackage();
/** @var Link[] $requires */
$requires = $package->getRequires();
// Show error if package was not found
if (!in_array(self::$bootstrapPackageKey, array_keys($requires))) {
echo PHP_EOL . "\tError: Could not find the Twitter Bootstrap package \"twitter/bootstrap\"." . PHP_EOL . PHP_EOL;
return;
}
$fs = new Filesystem();
// Check for package path
$packagePath = static::_getPackagePath($event->getComposer());
if (is_null($packagePath) or !$fs->exists($packagePath)) {
echo PHP_EOL . "\tError: The twitter bootstrap package doesn't seem to be installed." . PHP_EOL . PHP_EOL;
return;
}
$bootstrapPath = $packagePath . '/dist/';
// Check the public path where it should be copied to
$extra = $package->getExtra();
if (!isset($extra['bootstrap-public-dir']) or !$fs->exists($extra['bootstrap-public-dir'])) {
echo PHP_EOL . "\tError: Given bootstrap public directory doesn't exist: " . $extra['bootstrap-public-dir'] . PHP_EOL . PHP_EOL;
return;
}
$bootstrapPublicPath = $extra['bootstrap-public-dir'];
echo sprintf('Installing twitter bootstrap files into %s%s', $bootstrapPublicPath, PHP_EOL);
$files = array('js/bootstrap.js', 'js/bootstrap.min.js', 'fonts/glyphicons-halflings-regular.eot', 'fonts/glyphicons-halflings-regular.svg', 'fonts/glyphicons-halflings-regular.ttf', 'fonts/glyphicons-halflings-regular.woff');
foreach ($files as $file) {
$fs->copy($bootstrapPath . $file, $bootstrapPublicPath . '/' . $file, true);
}
}
示例5: getOptions
protected static function getOptions(CommandEvent $event)
{
$options = array_merge(array('symfony-app-dir' => 'app', 'symfony-web-dir' => 'web', 'symfony-assets-install' => 'hard'), $event->getComposer()->getPackage()->getExtra());
$options['symfony-assets-install'] = getenv('SYMFONY_ASSETS_INSTALL') ?: $options['symfony-assets-install'];
$options['process-timeout'] = $event->getComposer()->getConfig()->get('process-timeout');
return $options;
}
示例6: exec
public static function exec(CommandEvent $event)
{
$composer = $event->getComposer();
$installManager = $composer->getInstallationManager();
$repoManager = $composer->getRepositoryManager();
$packages = $repoManager->getLocalRepository()->getPackages();
foreach ($packages as $package) {
$path = $installManager->getInstallPath($package);
$extra = $package->getExtra();
if (array_key_exists('clean', $extra)) {
// we have things to remove, try to take them out
foreach ($extra['clean'] as $remove) {
$resolvePath = realpath($path . '/' . $remove);
if ($resolvePath !== false) {
if (is_dir($resolvePath)) {
self::unlinkDirectory($resolvePath);
// rmdir($resolvePath);
} elseif (is_file($resolvePath)) {
// unlink($resolvePath);
self::unlinkFile($resolvePath);
}
}
}
}
}
}
示例7: deployAssets
public static function deployAssets(CommandEvent $event)
{
$io = $event->getIO();
if (!$io->askConfirmation('Would you like to update assets? (Y/n) ', true)) {
return false;
}
}
示例8: installWelcomeText
/**
* Just dump welcome text on how to install eZ Platform.
*
* @param $event CommandEvent A instance
*/
public static function installWelcomeText(CommandEvent $event)
{
$event->getIO()->write(<<<'EOT'
________________/\\\\\\\\\\\\\\\____________/\\\\\\\\\\\\\____/\\\\\\________________________________________/\\\\\_________________________________________________
________________\////////////\\\____________\/\\\/////////\\\_\////\\\______________________________________/\\\///__________________________________________________
__________________________/\\\/_____________\/\\\_______\/\\\____\/\\\_______________________/\\\__________/\\\______________________________________________________
_____/\\\\\\\\__________/\\\/_______________\/\\\\\\\\\\\\\/_____\/\\\_____/\\\\\\\\\_____/\\\\\\\\\\\__/\\\\\\\\\_______/\\\\\_____/\\/\\\\\\\_____/\\\\\__/\\\\\___
___/\\\/////\\\_______/\\\/_________________\/\\\/////////_______\/\\\____\////////\\\___\////\\\////__\////\\\//______/\\\///\\\__\/\\\/////\\\__/\\\///\\\\\///\\\_
__/\\\\\\\\\\\______/\\\/___________________\/\\\________________\/\\\______/\\\\\\\\\\_____\/\\\_________\/\\\_______/\\\__\//\\\_\/\\\___\///__\/\\\_\//\\\__\/\\\_
_\//\\///////_____/\\\/_____________________\/\\\________________\/\\\_____/\\\/////\\\_____\/\\\_/\\_____\/\\\______\//\\\__/\\\__\/\\\_________\/\\\__\/\\\__\/\\\_
__\//\\\\\\\\\\__/\\\\\\\\\\\\\\\___________\/\\\______________/\\\\\\\\\_\//\\\\\\\\/\\____\//\\\\\______\/\\\_______\///\\\\\/___\/\\\_________\/\\\__\/\\\__\/\\\_
___\//////////__\///////////////____________\///______________\/////////___\////////\//______\/////_______\///__________\/////_____\///__________\///___\///___\///__
<fg=cyan>Welcome to eZ Platform!</fg=cyan>
<options=bold>Please read the INSTALL.md file to complete the installation.</options>
<options=bold>Assuming that your database information were correctly entered, you may install a clean database by running the install command:</options>
<comment> $ php app/console --env=prod ezplatform:install clean</comment>
EOT
);
}
示例9: onPostInstallCMD
/**
* Listener to the POST_INSTALL_CMD, POST_UPDATE_CMD and POST_CREATE_PROJECT_CMD events
* It contains the code that launch the execution of the finalize precedures
*
* @param \Composer\Script\CommandEvent $event Event to handle
*
*/
public function onPostInstallCMD(CommandEvent $event)
{
$packages = $event->getComposer()->getRepositoryManager()->getLocalRepository()->getPackages();
foreach ($packages as $package) {
$this->onEventHandler($package, "finalize");
}
$this->doRetry();
}
示例10: getConfigs
protected static function getConfigs(CommandEvent $event)
{
$extras = array_merge(array('app-version-key' => 'version_number'), $event->getComposer()->getPackage()->getExtra());
if (!isset($extras['incenteev-parameters'])) {
throw new \InvalidArgumentException('The parameter handler needs to be configured through the extra.incenteev-parameters setting.');
}
$configs = $extras['incenteev-parameters'];
return $configs;
}
示例11: postUpdateAndInstall
/**
* Called from composer
*
* @param CommandEvent $event
* @return void
*/
public static function postUpdateAndInstall(CommandEvent $event)
{
$scriptName = self::isWindowsOs() ? 'typo3cms.bat' : 'typo3cms';
$success = self::safeCopy($scriptName, './');
if (!$success) {
$event->getIO()->write(sprintf(self::COPY_FAILED_MESSAGE_TITLE, $scriptName));
$event->getIO()->write(sprintf(self::COPY_FAILED_MESSAGE, $scriptName));
}
}
示例12: postUpdateAndInstall
/**
* Post composer install or update tasks
*
* @param \Composer\Script\CommandEvent $event
*/
public static function postUpdateAndInstall(CommandEvent $event)
{
$options = array();
if ($event->isDevMode()) {
$options['options'] = 'setup/default/demo:1';
}
\TYPO3\Flow\Core\Booting\Scripts::executeCommand('aimeos.shop:aimeos:setup', array(), true, $options);
\TYPO3\Flow\Core\Booting\Scripts::executeCommand('aimeos.shop:aimeos:cache', array());
}
示例13: buildPathFromBase
/**
* Build a directory path starting on the project base
*
* @param CommandEvent $event
* @param string $directory
*/
private static function buildPathFromBase(CommandEvent $event, $directory)
{
/** @var Package $package */
$package = $event->getComposer()->getPackage();
$extra = $package->getExtra();
// Generate the complete path.
$basePath = getcwd();
$path = array_key_exists($directory, $extra) ? $extra[$directory] : self::$options[$directory];
$completePath = sprintf('%s/%s', $basePath, $path);
// Set values.
self::$options[self::CONSOLE_APPLICATION_BASE_DIR] = $basePath;
self::$options[$directory] = $completePath;
}
示例14: runCommand
protected static function runCommand(CommandEvent $event, Tool $tool, $command)
{
if ($event->getIO()->isVerbose()) {
$event->getIO()->write($command);
}
$process = new Process($command, getcwd(), null, null, $tool->getTimeout());
$process->run(function ($type, $buffer) use($event) {
if ($event->getIO()->isVerbose()) {
$event->getIO()->write($buffer, false);
}
});
return $process;
}
示例15: spacingParametersYml
private static function spacingParametersYml(CommandEvent $event)
{
if (!file_exists($file = 'vendor/incenteev/composer-parameter-handler/Processor.php')) {
return;
}
$content = file_get_contents($file);
$matches = 0;
$content = str_replace('Yaml::dump($actualValues, 99)', 'Yaml::dump($actualValues, 99, 2)', $content, $matches);
if ($matches) {
file_put_contents($file, $content, LOCK_EX);
$event->getIO()->write('Updated spacing for incenteev parameters');
}
}