Ejemplo n.º 1
0
 /**
  * @param string           $pattern
  * @param CM_Site_Abstract $site
  * @return string[]
  */
 public static function rglobLibraries($pattern, CM_Site_Abstract $site)
 {
     $paths = array();
     foreach ($site->getModules() as $moduleName) {
         $libraryPath = CM_Util::getModulePath($moduleName) . 'library/' . $moduleName . '/';
         $paths = array_merge($paths, CM_Util::rglob($pattern, $libraryPath));
     }
     return $paths;
 }
Ejemplo n.º 2
0
 /**
  * @param CM_Site_Abstract $site
  * @return string
  * @throws CM_Exception_Invalid
  */
 private function _getAppClassName(CM_Site_Abstract $site)
 {
     foreach ($site->getModules() as $moduleName) {
         $file = new CM_File(DIR_ROOT . CM_Bootloader::getInstance()->getModulePath($moduleName) . 'library/' . $moduleName . '/App.js');
         if ($file->exists()) {
             return $moduleName . '_App';
         }
     }
     throw new CM_Exception_Invalid('No App class found');
 }
Ejemplo n.º 3
0
 public function __construct(CM_Site_Abstract $site)
 {
     $content = '';
     foreach (array_reverse($site->getModules()) as $moduleName) {
         $libraryPath = DIR_ROOT . CM_Bootloader::getInstance()->getModulePath($moduleName) . 'client-vendor/after-body/';
         foreach (CM_Util::rglob('*.js', $libraryPath) as $path) {
             $content .= (new CM_File($path))->read() . ';' . PHP_EOL;
         }
     }
     $this->_content = $content;
 }
Ejemplo n.º 4
0
 /**
  * @param string[] $sourceMainPaths
  * @param bool     $generateSourceMaps
  * @throws CM_Exception
  */
 protected function _appendSourceMainBrowserify($sourceMainPaths, $generateSourceMaps)
 {
     if ($generateSourceMaps && !$this->_js->isEmpty()) {
         throw new CM_Exception('Cannot generate source maps when output container already contains code.');
     }
     $sourcePaths = [];
     foreach (array_reverse($this->_site->getModules()) as $moduleName) {
         $sourcePaths[] = $this->_getPathInModule($moduleName, 'client-vendor/source');
     }
     $content = $this->_browserify($sourceMainPaths, $sourcePaths, $generateSourceMaps);
     $this->_js->append($content);
 }