/** * Event handler for composer package events * * @param \Composer\EventDispatcher\Event $event */ public static function handle($event) { try { $operation = $event->getOperation(); if (method_exists($operation, 'getPackage')) { $installedPackage = $operation->getPackage(); } elseif (method_exists($operation, 'getTargetPackage')) { $installedPackage = $operation->getTargetPackage(); } else { return; } } catch (\Exception $e) { return; } $rootExtra = $event->getComposer()->getPackage()->getExtra(); $extra = $installedPackage->getExtra(); if (isset($extra['bolt-assets'])) { $type = $installedPackage->getType(); $pathToPublic = $rootExtra['bolt-web-path']; // Get the path from extensions base through to public $destParts = [getcwd(), $pathToPublic, 'extensions', 'vendor', $installedPackage->getName(), $extra['bolt-assets']]; $dest = realpath(join(DIRECTORY_SEPARATOR, $destParts)); if ($type === 'bolt-extension' && isset($extra['bolt-assets'])) { $sourceParts = [getcwd(), 'vendor', $installedPackage->getName(), $extra['bolt-assets']]; $source = join(DIRECTORY_SEPARATOR, $sourceParts); self::mirror($source, $dest); } } }
/** * @param Event $event */ public function dispatch(Event $event) { if (!isset($this->listeners[$event->getName()])) { return; } foreach ($this->listeners[$event->getName()] as $listener) { call_user_func_array($listener, array($event)); } }
public function startInteractiveCommands(Event $event) { $io = $event->getIO(); $io->write("<info>Starting comodojo base configuration</info>"); $io->write("<info>Please answer the following questions as accurately and honestly as possible...</info>"); InteractiveConfiguration::start($this->configuration, $io); StaticConfigurationDumper::dump($this->configuration); $io->write("<info>Static configuration dumped.</info>"); $io->write("<info>Remember to exec 'php comodojo.php install' to complete installation of framework.</info>"); $io->write("<info>Have fun!</info>"); }
public function __construct($name, $commandName, $input, $output) { parent::__construct($name); $this->commandName = $commandName; $this->input = $input; $this->output = $output; }
/** * Constructs a PatchEvent object. * * @param string $eventName * @param PackageInterface $package * @param string $url * @param string $description */ public function __construct($eventName, PackageInterface $package, $url, $description) { parent::__construct($eventName); $this->package = $package; $this->url = $url; $this->description = $description; }
/** * Constructor. * * @param string $name The event name * @param Composer $composer The composer object * @param IOInterface $io The IOInterface object * @param boolean $devMode Whether or not we are in dev mode * @param array $events Arguments passed by the user */ public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array()) { parent::__construct($name, $args); $this->composer = $composer; $this->io = $io; $this->devMode = $devMode; }
/** * Constructor. * * @param string $name The event name * @param string $commandName The command name * @param InputInterface $input * @param OutputInterface $output * @param array $events Arguments passed by the user */ public function __construct($name, $commandName, $input, $output, array $args = array()) { parent::__construct($name, $args); $this->commandName = $commandName; $this->input = $input; $this->output = $output; }
/** * Constructor. * * @param string $eventName * @param Composer $composer * @param IOInterface $io * @param PolicyInterface $policy * @param Pool $pool * @param CompositeRepository $installedRepo * @param Request $request * @param OperationInterface[] $operations */ public function __construct($eventName, Composer $composer, IOInterface $io, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array()) { parent::__construct($eventName); $this->composer = $composer; $this->io = $io; $this->policy = $policy; $this->pool = $pool; $this->installedRepo = $installedRepo; $this->request = $request; $this->operations = $operations; }
/** * Finds all listeners defined as scripts in the package * * @param Event $event Event object * @return array Listeners */ protected function getScriptListeners(Event $event) { $package = $this->composer->getPackage(); $scripts = $package->getScripts(); if (empty($scripts[$event->getName()])) { return array(); } if ($this->loader) { $this->loader->unregister(); } $generator = $this->composer->getAutoloadGenerator(); $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages(); $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages); $map = $generator->parseAutoloads($packageMap, $package); $this->loader = $generator->createLoader($map); $this->loader->register(); return $scripts[$event->getName()]; }
/** * @param string $name * @param InstalledPackage $package */ public function __construct($name, InstalledPackage $package) { parent::__construct($name); $this->package = $package; }
/** * Push an event to the stack of active event * * @param Event $event * @throws \RuntimeException * @return number */ protected function pushEvent(Event $event) { $eventName = $event->getName(); if (in_array($eventName, $this->eventStack)) { throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName)); } return array_push($this->eventStack, $eventName); }
public function __construct($name, RemoteFilesystem $rfs, $processedUrl) { parent::__construct($name); $this->rfs = $rfs; $this->processedUrl = $processedUrl; }
/** * getPluginComposerData * * @param Event $event * * @return mixed * @throws \Exception */ protected function getPluginComposerData(Event $event) { $extra = $event->getComposer()->getPackage()->getExtra(); if (!isset($extra['xpressengine-plugin']['path'])) { throw new \Exception('xpressengine-installer: extra > xpressengine-plugin > path is needed.'); } $path = $extra['xpressengine-plugin']['path']; $this->path = $path; if (!file_exists($path)) { throw new \Exception("file [{$path}] not exists."); } return json_decode(file_get_contents($path), true); }
/** * @param string $name * @param Entry $deployEntry */ public function __construct($name, Entry $deployEntry) { parent::__construct($name); $this->deployEntry = $deployEntry; }
/** * Constructor. * * @param string $name The event name * @param array $repos The list of vcs repositories config */ public function __construct($name, array $repos) { parent::__construct($name); $this->repositories = $repos; }
/** * @param string $name * @param PackageInterface $package */ public function __construct($name, PackageInterface $package) { parent::__construct($name); $this->package = $package; }