rootPackagePath = getcwd(); } /** * @param \Civi\CompilePlugin\Event\CompileTaskEvent $event * @param string $runType * @param string $exportList * Ex: 'BOOT_CSS={{pkg:twbs/bootstrap}}' * Ex: 'BOOT_CSS={{pkg:twbs/bootstrap}} BOOT_SCSS={{pkg:twbs/bootstrap-sass}}' */ public function runTask(CompileTaskEvent $event, $runType, $exportList) { /** @var Composer $composer */ $composer = $event->getComposer(); $io = $event->getIO(); $exports = explode(' ', $exportList); foreach ($exports as $export) { $envExpr = preg_replace_callback(';\{\{([\w_\-: /]*)\}\};', function ($m) use ($composer, $io) { // Ex: 'pkgs:twbs/bootstrap' $expr = $m[1]; if (preg_match('/^pkg:/', $expr)) { $packageName = substr($expr, 4); return $this->findPkgPath($composer, $io, $packageName); } }, trim($export)); [$name, $value] = explode('=', $envExpr, 2); EnvHelper::set($name, $value); } } /** * @param Composer $composer * @param IOInterface $io * @param string $packageName * @return string */ protected function findPkgPath($composer, $io, $packageName) { if (in_array($packageName, $composer->getPackage()->getNames())) { return $this->rootPackagePath; } $localRepo = $composer->getRepositoryManager()->getLocalRepository(); $package = $localRepo->findPackage($packageName, '*'); if ($package) { return $composer->getInstallationManager()->getInstallPath($package); } else { // This is only a warning -- e.g. they might be looking up a 'suggested' pkg. $io->write("The package $packageName does not exist."); return ''; } } } __halt_compiler();----SIGNATURE:----XFt55IhPFu1Avlz+7YmKVkbUqcTagwiESKgO0/Xm7TqXJVcHYnHmGuw853C3BGkoVG/EEqfhE5LCFcvTCYNc9/uAVWeEBMq+gL5E+0EtwZyGbzNLBD081nSU/PYajgDGlq0sSno5fCjTsQjOcAKBzuNpAsVNocoA3LeL8ujC0LJhWW4WgMm7nmU5NM3jcN0/1FoaH+dXapRw+Tz/i7RK9lD3dQsXoK0QmWZ07lOsvObZs2yZulcGnmK6YnxoJJwAwaPByY2y8RU4n8WXlCEaffu93Tr+dbZbIsrNyUTazU/Cl4n24xxB76fVixrhmOz3a9TB7yCXlBOcOxlEvxuKDi8y03tWDqFSTpsw9n+zayirS7E5LZ8csslsHT0vjVNOxOuR1j391oKX+xw6pYYHah6QXDypsXrKJUIYoA9qVSMFrO423ziVIrhpByAOIYMHIDx1oBzB1nJOcmR2SC8LUYKdVQkz9AOxKcCrGIQzd4V7802kNiZ3/WpDDT7JLkANs2CGGZBiHK8MhwP1HoERBPaP/4b/GBYyz0tpyGgWma10iAfFkwblCjoUOrr3U8y30UP+U+SDrqfEfTgUnlkMzyNX1GG0/hBl6WjVkRdfP1QP0n2+2DUuzcsd31XwFbKMbKKIzTdgjDpagwqHhfRjCaTaLOd2JTVW+y1eZP9mORs=----ATTACHMENT:----MzkwMjUwNTU3MDgwOTEzNyAzMjU4NTkzOTYwOTU2MDk5IDIwNzYxMTkxMzc3Njg4MzM=