本文整理汇总了PHP中Composer\Script\CommandEvent::getIO方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandEvent::getIO方法的具体用法?PHP CommandEvent::getIO怎么用?PHP CommandEvent::getIO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\Script\CommandEvent
的用法示例。
在下文中一共展示了CommandEvent::getIO方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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();
}
示例2: 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));
}
}
示例3: 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;
}
示例4: executeCommand
/**
* Executes a command
*
* @param CommandEvent $event Event
* @param string $consoleDir Console dir
* @param string $cmd Command
* @param int $timeout Timeout
*
* @return void
*/
protected static function executeCommand(CommandEvent $event, $consoleDir, $cmd, $timeout = 300)
{
$php = escapeshellarg(self::getPhp(false));
$console = escapeshellarg($consoleDir . '/console');
if ($event->getIO()->isDecorated()) {
$console .= ' --ansi';
}
$process = new Process($php . ' ' . $console . ' ' . $cmd, null, null, null, $timeout);
$process->run(function ($type, $buffer) use($event) {
$event->getIO()->write($buffer, false);
});
if (!$process->isSuccessful()) {
throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command.', escapeshellarg($cmd)));
}
}
示例5: executeCommand
protected static function executeCommand(CommandEvent $event, $consoleDir, $cmd, $timeout = 300)
{
$php = escapeshellarg(static::getPhp(false));
$phpArgs = implode(' ', array_map('escapeshellarg', static::getPhpArguments()));
$console = escapeshellarg($consoleDir . '/console');
if ($event->getIO()->isDecorated()) {
$console .= ' --ansi';
}
$process = new Process($php . ($phpArgs ? ' ' . $phpArgs : '') . ' ' . $console . ' ' . $cmd, null, null, null, $timeout);
$process->run(function ($type, $buffer) use($event) {
$event->getIO()->write($buffer, false);
});
if (!$process->isSuccessful()) {
throw new \RuntimeException(sprintf("An error occurred when executing the \"%s\" command:\n\n%s\n\n%s.", escapeshellarg($cmd), $process->getOutput(), $process->getErrorOutput()));
}
}
示例6: enableInstallMode
public static function enableInstallMode(CommandEvent $event)
{
if (!file_exists(SystemUtil::getInstallDoneFilePath())) {
SystemUtil::enableInstallMode();
}
$event->getIO()->write('CampaignChain: Enabled install mode.');
}
示例7: 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
);
}
示例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: deployAssets
public static function deployAssets(CommandEvent $event)
{
$io = $event->getIO();
if (!$io->askConfirmation('Would you like to update assets? (Y/n) ', true)) {
return false;
}
}
示例10: bootstrap
public static function bootstrap(CommandEvent $event)
{
$webroot = $event->getIO()->askConfirmation('<info>Do you want your web directory to be a separate folder to root? [y/n] </info>', false);
if ($webroot) {
$webname = $event->getIO()->ask('<info>What do you want your public directory to be named? [default: public] </info>', 'public');
$webname = trim($webname, '/');
$assetDir = './' . $webname;
} else {
$webname = null;
$assetDir = '.';
}
$generator = new BootstrapGenerator($webroot, $webname);
$generator->create();
$options = array_merge(self::getOptions($event), ['bolt-web-dir' => $assetDir]);
self::installAssets($event, $options);
$event->getIO()->write('<info>Your project has been setup</info>');
}
示例11: executeCheck
protected static function executeCheck(CommandEvent $event, $appDir)
{
$phpFinder = new PhpExecutableFinder();
$php = escapeshellarg($phpFinder->find());
$check = escapeshellarg($appDir . '/check.php');
$process = new Process($php . ' ' . $check);
$process->run(function ($type, $buffer) use($event) {
$event->getIO()->write($buffer, false);
});
}
示例12: setPermissions
public static function setPermissions(CommandEvent $event)
{
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
$event->getIO()->write('<info>No permissions setup is required on Windows.</info>');
return;
}
$event->getIO()->write('Setting up permissions.');
try {
self::setPermissionsSetfacl($event);
return;
} catch (ProcessFailedException $setfaclException) {
$event->getIO()->write(sprintf('<error>%s</error>', $setfaclException->getMessage()));
$event->getIO()->write('<info>Trying chmod...</info>');
}
try {
self::setPermissionsChmod($event);
return;
} catch (ProcessFailedException $chmodException) {
$event->getIO()->write(sprintf('<error>%s</error>', $chmodException->getMessage()));
}
}
示例13: replaceViews
public static function replaceViews(CommandEvent $event)
{
$event->getIO()->write('Copy ReCaptcha views to app/Resource/DS/ReCaptcha/views.');
$directory = getcwd();
self::$fileSystem = new Filesystem();
$directory .= '/app/Resources';
self::makeDirIfNOtExist($directory);
$directory .= '/DS';
self::makeDirIfNOtExist($directory);
$directory .= '/ReCaptcha';
self::makeDirIfNOtExist($directory);
$directory .= '/views';
self::makeDirIfNOtExist($directory);
if (self::$fileSystem->exists($directory . '/form_div_layout.html.twig')) {
if (!$event->getIO()->askConfirmation(sprintf('form_div_layout.html.twig already exist in %s. Would you like to rewrite this file? [y/N] ', $directory), false)) {
return;
}
}
self::$fileSystem->copy(__DIR__ . '/../Resources/views/form_div_layout.html.twig', $directory . '/form_div_layout.html.twig', true);
$event->getIO()->write('Files creation operation completed successfully.');
}
示例14: checkAndInstall
/**
* @static
*
* @param \Composer\Script\CommandEvent $event
*/
public static function checkAndInstall($event)
{
$appDir = getcwd() . '/app';
$resourcesPath = $appDir . '/Resources';
if (is_dir($resourcesPath)) {
$filesystem = new Filesystem();
$jackrabbitDir = $resourcesPath . '/java/jackrabbit';
$filesystem->ensureDirectoryExists($jackrabbitDir);
if (!self::check($jackrabbitDir) && false !== ($file = self::download($event->getIO(), $jackrabbitDir))) {
self::install($file, $appDir);
}
}
}
示例15: removeGitStuff
public static function removeGitStuff(CommandEvent $event)
{
if ($event->getIO()->askConfirmation('Remove the GIT related stuff? [Y/n] ')) {
$fs = new Filesystem();
foreach (static::getPath() as $path) {
$filename = $path . '/.gitkeep';
if ($fs->exists($filename)) {
$fs->remove($filename);
}
}
$fs->remove(static::getPath('root') . '/.git');
}
}