@since 0.0.1
@author Igor Ivanovic
@method View#setModulesViewsPath

@description
Set modules path
547832
function View_setModulesViewsPath(dir) {
            var list, name, moduleToLoad, LoadedModule, moduleInstance;
            if (this.isDir(dir)) {
                list = this.readDir(dir);
                while (true) {
                    name = list.shift();

                    if (!name) {
                        break;
                    }

                    moduleToLoad = dir + '/' + name;

                    try {
                        LoadedModule = di.load(moduleToLoad);
                    } catch (e) {
                        throw new error.HttpError(500, {path: moduleToLoad}, 'Missing module', e);
                    }

                    if (!Type.assert(Type.FUNCTION, LoadedModule)) {
                        throw new error.HttpError(500, {path: moduleToLoad}, 'Module must be function type');
                    }

                    moduleInstance = new LoadedModule(name);

                    if (!(moduleInstance instanceof ModuleInterface)) {
                        throw new error.HttpError(500, moduleInstance, 'Module must be instance of ModuleInterface "core/module"');
                    }

                    this.normalizers.push(moduleInstance.getViewsPath());

                    this.config.themes.forEach(function (name) {
                        this.paths.push(moduleInstance.getViewsPath() + name + '/');
                    }.bind(this));
                }

            }
        }
792378
protected function loadViews()
    {
        $view_path = __DIR__.'/../resources/views';
        $this->loadViewsFrom($view_path, 'crudapi');
        $this->publishes(
            [
                $view_path => base_path('resources/views/Taskforcedev/crudapi'),
            ], 'crudapi-views'
        );
    }
804794
function addPageSetsModule(clientFramework) {
    let appModulePath;
    try {
        if (clientFramework !== 'angular1') {
            appModulePath = `${CLIENT_MAIN_SRC_DIR}app/app.module.ts`;
            const fullPath = path.join(process.cwd(), appModulePath);

            let args = {
                file: appModulePath
            };

            args.haystack = this.fs.read(fullPath);

            args.needle = `import { ${this.angularXAppName}EntityModule } from './entities/entity.module';`;
            args.splicable = [`import { ${this.angularXAppName}PageSetsModule } from './pages/page-sets.module';`]
            args.haystack = jhipsterUtils.rewrite(args);

            args.needle = `${this.angularXAppName}AccountModule,`;
            args.splicable = [`${this.angularXAppName}PageSetsModule,`]
            args.haystack = jhipsterUtils.rewrite(args);

            this.fs.write(fullPath, args.haystack);

        }
    } catch (e) {
        this.log(`${chalk.yellow('\nUnable to find ') + appModulePath + chalk.yellow('. Reference to PageSets module not added to App module.\n')}`);
        this.log('Error:', e);
    }
}
587875
protected function initializeModules() {
		self::$modules = Configuration::modules( $this->settings );
		self::$actions = Configuration::actions( self::$modules );

		foreach ( self::$modules as $module ) {
			$module->_initialize();
		}
	}
1041825
function initPaths (args) {
    // set path where controller is mounted
    this.path = typeof args.path === 'string' ? args.path : ''
    // create paths if not already defined
    if (!this.paths) {
        this.paths = {}
    }
    // if paths is false then do not create any paths
    if (args.paths === false) {
        return
    }
    // get paths object
    var paths = requireValidOptionalObject(args.paths)
    // configure default paths and create paths from args
    _.each(args.paths, (methods, path) => {
        // if value is false then delete all default controllers for path
        if (methods === false) {
            delete this.paths[path]
            return
        }
        // iterate over methods for path
        _.each(methods, (spec, method) => {
            // if spec is false the delete any default controller for method
            if (spec === false) {
                // if path does not exist do nothing
                if (!this.paths[path]) {
                    return
                }
                // delete all entries for method
                delete this.paths[path][method]
                return
            }
            // if path does not exist create
            if (!this.paths[path]) {
                this.paths[path] = {}
            }
            // if methods does not exist create
            if (!this.paths[path][method]) {
                this.paths[path][method] = []
            }
            // args value is list of controllers for different roles
            if (Array.isArray(spec)) {
                // either add each spec or merge to existing spec
                _.each(spec, spec => {
                    // default role to all
                    if (!spec.role) {
                        spec.role = 'all'
                    }
                    // get existing controller if defined
                    var controller = this.getController(method, path, spec.role)
                    // if controller exists then merge config
                    if (controller) {
                        _.merge(controller, spec)
                    }
                    // otherwise add new controller spec
                    else {
                        this.paths[path][method].push(spec)
                    }
                })
            }
            // if spec is an object then either apply arguments to existing
            // default controller or create new controller
            else if (spec && typeof spec === 'object') {
                // default role to all
                if (!spec.role) {
                    spec.role = 'all'
                }
                // get existing controller if defined
                var controller = this.getController(method, path, spec.role)
                // if controller exists then merge config
                if (controller) {
                    _.merge(controller, spec)
                }
                // otherwise add new controller spec
                else {
                    this.paths[path][method].push(spec)
                }
            }
            // error
            else {
                throw new Error('invalid controller '+spec+' at '+path+' '+method)
            }
        })
    })
    // iterate over paths validating spec and creating methods
    _.each(this.paths, (methods, path) => {
        // iterate over (http) methods
        _.each(methods, (specs, httpMethod) => {
            // require supported http method
            assert.ok(httpMethods[httpMethod], 'invalid http method '+httpMethod+' for '+path)
            // iterate specs for different roles
            _.each(specs, spec => {
                // if spec is GET and has a template but no method
                // then do not require method
                if (spec.template && !spec.after && !spec.before && !spec.method) {
                    return
                }
                // if function is passed then construct spec
                if (typeof spec === 'function') {
                    spec = {method: spec}
                }
                // create default method if method not defined
                if (!spec.method) {
                    spec.method = function (args) {return args}
                }
                // create method name
                if (!spec.methodName) {
                    // get method name from function
                    var matches = spec.method.toString().match(/function\s*([^\s^\)]+)\s*\(/)
                    // use function name
                    if (matches && matches[1].length) {
                        spec.methodName = matches[1]
                    }
                    // use path and method for method name
                    else {
                        // remove non-word chars
                        path = path.replace(/\W/, '')
                        // set method name as methodPath
                        spec.methodName = httpMethod+ucfirst(path)
                    }
                }
                // if method is already immutable then leave as is so that the same
                // spec can be shared between routes
                if (spec.method.meta) {
                    return
                }
                // get method signature from module and method name
                var methodSignature = this.moduleName+'.'+spec.methodName
                // create immutable method
                spec.method = immutable.method(methodSignature, spec.method)
                // if there are before functions add
                if (spec.before) {
                    var beforeMethodName = spec.methodName+'Before'
                    // create immutable method
                    spec.before = immutable.method(this.moduleName+'.'+beforeMethodName, spec.before)
                    // bind before method
                    immutable.before(methodSignature, spec.before)
                }
                // if there are after functions add
                if (spec.after) {
                    var afterMethodName = spec.methodName+'After'
                    // create immutable method
                    spec.after = immutable.method(this.moduleName+'.'+afterMethodName, spec.after)
                    // find after method
                    immutable.after(methodSignature, spec.after)
                }
            })
        })
    })
}
1180172
protected function setView()
    {
        $views = [
            $this->controller,
            $this->action,
        ];

        $this->view = implode('.', array_filter($views));
    }
1197308
public function listModule()
    {
        $this->actionListModule();
        $this->setTitleListModule();
        $this->setBreadcrumbListModule();
        $this->setFilterListModule();
        $this->setPagerListModule();

        $this->setData('types', $this->getTypesModule());
        $this->setData('modules', (array) $this->getListModule());
        $this->setData('available_modules', $this->module->getList());

        $this->outputListModule();
    }
861105
protected void setModule(String moduleName, CmsBasicDialog dialog) {

        Window window = CmsVaadinUtils.getWindow(dialog);
        window.setContent(this);
        m_module = OpenCms.getModuleManager().getModule(moduleName).clone();
        CmsResourceInfo resInfo = new CmsResourceInfo(
            m_module.getName(),
            m_module.getNiceName(),
            CmsModuleApp.Icons.RESINFO_ICON);
        displayResourceInfoDirectly(Arrays.asList(resInfo));
        fillFields();
    }
1300214
function joinNodeModules(jsPaths){
    _.each(jsPaths, function(jsPath){
      var libPath = path.join(nodeModules, jsPath),
          flattenedLibPath = path.join(flattenedNodeModules, jsPath);

      if (fs.existsSync(libPath)) {
        defaultScripts.push(libPath);
      } else if (fs.existsSync(flattenedLibPath)) {
        defaultScripts.push(flattenedLibPath);
      } else {
        console.error('Could not find ' + jsPath);
      }
    });
  }
1095722
function setupViewPartials() {
  
  // Set view path association object
  this.views.pathAsoc = {};

  // Partial & template regexes
  var self = this;
  var exts = this.templateExtensions;
  var partialRegex = new RegExp('\/views\/(.+)\/partials\/[a-zA-Z0-9-_]+\\.(' + exts.join('|') + ')$');
  var templateRegex = new RegExp('\\.(' + exts.join('|') + ')$');
  var layoutPath = this.mvcpath + 'views/' + this.paths.layout;

  var viewsPath = this.mvcpath + 'views';
  
  var partialPaths = [];
  
  if (fs.existsSync(viewsPath)) {
    
    fileModule.walkSync(viewsPath, function(dirPath, dirs, files) {
      
      for (var path,file,i=0; i < files.length; i++) {

        file = files[i];
        path = dirPath + "/" + file;

        if (partialRegex.test(path)) {

          // Only build valid partial views
          partialPaths.push(path);
          buildPartialView.call(self, path);
          watchPartial.call(self, path, buildPartialView);

        } else if (templateRegex.test(file)) {

          // Build partial views for everything inside app.paths.layout

          if (path.indexOf(layoutPath) === 0) {
            partialPaths.push(path);
            buildPartialView.call(self, path);
            watchPartial.call(self, path, buildPartialView);
          }

          // Only add valid templates to view associations
          self.views.pathAsoc[self.relPath(path.replace(self.regex.templateFile, ''))] = path;

        }
      }
    });
    
  }
  
  // Add Builtin Partials
  
  var Helper = protos.lib.helper;
  var builtinHelper = new Helper();
  
  for (var m in builtinHelper) {
    if (builtinHelper[m] instanceof Function) {
      this.registerViewHelper(m, builtinHelper[m], builtinHelper);
    }
  }
  
  // Helper Partials
  
  Object.keys(this.helpers).forEach(function(alias) {
    var m, method, hkey, helper = self.helpers[alias];
    for (m in helper) {
      if (helper[m] instanceof Function) {
        method = helper[m];
        hkey = (alias == 'main')
          ? util.format('%s', m)
          : util.format('%s_%s', alias, m);
        self.registerViewHelper(hkey, method, helper);
      }
    }
  });
  
  // Event when view partials are loaded

  this.emit('view_partials_loaded', this.views.partials);
  
  // Set shortcode context
  // NOTE: Automatically resets on hot code loading, so it's good.
  
  var shortcodeContext = this.__shortcodeContext = {};
  
  // Only add shortcode filter to context if enabled on config
  
  if (this.config.shortcodeFilter) {
    
    // Register shortcodes from partials
  
    var shortcode = self.shortcode;
    var partials = self.views.partials;
  
    Object.keys(this.views.partials).forEach(function(partial) {
      if (partial[0] === '$') {
        shortcodeContext[partial.replace(/^\$/, '#')] = self.views.partials[partial];
      } else {
        shortcodeContext[partial] = function(buf, params, locals) {
          if (buf) params.content = buf; // Provide wrapped content in params.content
          params.__proto__ = locals; // Set locals as prototype of params
          return partials[partial].call(null, params); // Provide params to partial, which is passed as locals
        }
      }
    });

    this.addFilter('context', function(buf, locals) {
      buf = this.shortcode.parse(buf, locals, shortcodeContext);
      return buf;
    });
    
  }
  
  // Event when view shortcodes are loaded

  this.emit('view_shortcodes_loaded', shortcodeContext);

}
943565
function (pageId, isCommon, refpath) {
            var modulesPath = this._modulesPaths;
            if (isCommon) {
                modulesPath.common.push(refpath);
                return;
            }
            modulesPath.page[pageId] = modulesPath.page[pageId] || [];
            modulesPath.page[pageId].push(refpath);
        }
463622
protected function setControllerView()
    {
        if (View::exists($this->className)) {
            $this->controllerView = new View($this->className);
        } else {
            $this->controllerView = new View\Template('{@content}');
        }
    }
176587
private function _setView()
	{
		if (preg_match('/^[a-z0-9_-]+$/', $this->_requestVars[1])) {
			$this->_view = $this->_requestVars[1];
        } else {
        	$this->_view = $this->_requestVars[1] = self::DEFAULT_VIEW;
        }

        return $this;
	}
1083499
function subModulePath(subModule, node_modules) {
  var index = subModule.indexOf("/");
  var length = subModule.length;
  if (index <= 0 || index + 1 == length) {
    return null;
  }
  var module = subModule.substring(0, index);
  var relative = subModule.substring(index + 1, length);

  var moduleDirectory = path.join(node_modules, module);
  var filePath = path.join(moduleDirectory, relative);
  return realRequirPath(filePath);
}
32863
function () {
            this.unloadCommonModules();
            var pageModRefpaths = this._modulesPaths.page;
            for (var pageId in pageModRefpaths) {
                if (pageModRefpaths.hasOwnProperty(pageId)) {
                    this.unloadPageModules(pageId);
                }
            }
        }
578264
public function setupStubPath()
    {
        Stub::setBasePath(__DIR__ . '/Commands/stubs');

        if (app('modules')->config('stubs.enabled') === true) {
            Stub::setBasePath(app('modules')->config('stubs.path'));
        }
    }
854846
public function initializeModuleSystem()
    {
        $activatedModules = $this->moduleObjectBackend->loadObject();
        if (!is_array($activatedModules)) {
            $activatedModules = array();
        }
        
        $this->activatedModules = $activatedModules;
        
        foreach ($this->activatedModules as $activatedModule) {
            $this->initializeModule($activatedModule['path']);
        }
    }