本文整理汇总了PHP中Composer\Script\CommandEvent::isDevMode方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandEvent::isDevMode方法的具体用法?PHP CommandEvent::isDevMode怎么用?PHP CommandEvent::isDevMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\Script\CommandEvent
的用法示例。
在下文中一共展示了CommandEvent::isDevMode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
示例2: createDoctrineSchema
/**
* Creates the doctrine schema.
*
* @param CommandEvent $event
*/
public static function createDoctrineSchema(CommandEvent $event)
{
if (PreInstallHandler::$firstInstall) {
$envs = $event->isDevMode() ? ['dev', 'test'] : ['prod'];
self::dropDoctrineSchema($event, $envs);
foreach ($envs as $env) {
static::executeCommand($event, static::getConsoleDir($event, 'create doctrine schema'), sprintf('doctrine:schema:create --env=%s', $env));
}
}
}
示例3: setupDatabase
/**
* Sets up the shop database.
*
* @param CommandEvent $event CommandEvent instance
* @throws \RuntimeException If an error occured
*/
public static function setupDatabase(CommandEvent $event)
{
$options = $env = array();
if ($event->isDevMode()) {
$options[] = '--option=setup/default/demo:1';
} else {
$env[] = '--env=prod';
}
self::executeCommand($event, 'aimeos:setup', $options + $env);
self::executeCommand($event, 'aimeos:cache', $env);
}
示例4: postInstall
/**
* Updates the Puli repository after Composer installations/updates.
*
* @param CommandEvent $event The Composer event.
*/
public function postInstall(CommandEvent $event)
{
// Plugin has been uninstalled
if (!file_exists(__FILE__)) {
return;
}
if (!$this->initialized) {
$this->initialize($event->getComposer(), $event->getIO());
}
// This method is called twice. Run it only once.
if (!$this->runPostInstall) {
return;
}
$this->runPostInstall = false;
$io = $event->getIO();
$io->write('<info>Looking for updated Puli packages</info>');
$rootPackage = $event->getComposer()->getPackage();
$composerPackages = $this->loadComposerPackages($event->getComposer());
$prodPackageNames = $this->filterProdPackageNames($composerPackages, $rootPackage);
$env = $event->isDevMode() ? PuliPackage::ENV_DEV : PuliPackage::ENV_PROD;
try {
$puliPackages = $this->loadPuliPackages();
} catch (PuliRunnerException $e) {
$this->printWarning($io, 'Could not load Puli packages', $e);
return;
}
// Don't remove non-existing packages in production environment
// Removed packages could be dev dependencies (i.e. "require-dev"
// of the root package or "require" of another dev dependency), and
// we can't find out whether they are since Composer doesn't load them
if (PuliPackage::ENV_PROD !== $env) {
$this->removeRemovedPackages($composerPackages, $puliPackages, $io);
}
$this->installNewPackages($composerPackages, $prodPackageNames, $puliPackages, $io, $event->getComposer());
// Don't print warnings for non-existing packages in production
if (PuliPackage::ENV_PROD !== $env) {
$this->checkForNotFoundErrors($puliPackages, $io);
}
$this->checkForNotLoadableErrors($puliPackages, $io);
$this->adoptComposerName($puliPackages, $io, $event->getComposer());
$this->buildPuli($io);
}
示例5: onInstallOrUpdate
/**
* Handle an event callback for an install or update command by checking
* for "merge-patterns" in the "extra" data and merging package contents
* if found.
*
* @param CommandEvent $event
*/
public function onInstallOrUpdate(CommandEvent $event)
{
$config = $this->readConfig($this->composer->getPackage());
if (isset($config['recurse'])) {
$this->recurse = (bool) $config['recurse'];
}
if ($config['include']) {
$this->loader = new ArrayLoader();
$this->duplicateLinks = array('require' => array(), 'require-dev' => array());
$this->devMode = $event->isDevMode();
$this->mergePackages($config);
}
}