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) { $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:----r8Gj4vEKEFYmLR1XpAfC3kQ3YPg2ioJGfIm4UlgOH1ANCEIPz0j6xf5sJvKKEVEvofZiOaMBBGl11E1NfMKniSLIeviNlZIwNv9XO6Wc2xYpf2x4r0wWo5JaEJ+f1Gz9/SntGJqB520iW+KafOEnIdEBP4MOK0pdTO3D9DT8DWiXSMMlUOJAXJkAy+vYTW9pTPKOcN2hLkLoQBg000jgTZ0N5HVogPYrD/TfIDrAzYGicMojpsmmEuogk2JB7GlvB1rSaG1rwjQAenJ//9dDYEIJubtBLtXOzYPBzs8d6Je8DaP0Ll2/lYhO0CS5FpDCjaSiulrKiejPtAhGTOO+2YHrFY97/0BnS1vP3epkteTio6Db+COgEx8EIrIjlRvbIUVQbovbTDFGYGwDJhx0YqG2pdoT638PcYFtGICvG53PK46KhreCXDW+P/col9rZWGk/WJexSnLw0ZKgvYeWaUW8Ar7xhGi/70lZZgJSkOOylVDoasXBSr0Fe5l2pHVNrlHbModqAS1SSHkOaFEWXRr9bb45EWCvVmp8roQcbw3JGk0OK5IfSc8eAMJqnOx8TdmqybWMdsqEdoP6wUo6nTqhxDu9hFtxnvvB6qi87r28Duk93WjpNgeRPUbEPBqKwoSSGbklwCzEG8W8eTpoeejU8B2YLJ/v0zX/Sl5wvcg=----ATTACHMENT:----NjgzMjUzMDMyOTE4NDIyMSA2NTczNjI4MTk4NTk3OTQ5IDg2NjMyODY5NjQ4NzE0MTk=