_loadRoutesFromPackages

Loads the routes from the packages routes configuration
779405
private function _loadRoutesFromPackages()
    {
        $this->_routes = array();

        foreach ($this->_packages as $package)
        {
            $packagePath    = 'application/packages/' . str_replace('\\', DIRECTORY_SEPARATOR, $package);
            $routes         = require $packagePath . DIRECTORY_SEPARATOR . 'configs/routes.php';

            foreach ($routes as $route => $value)
            {
                $value['package']       = $package;
                $this->_routes[$route]  = $value;
            }
        }
    }
1255346
function loadModules() {
  const nodeModulesPath = path.join(process.cwd(), plugin.config.modulesPath);

  return plugin.myrmex.fire('beforeNodeModulesLoad')
  .then(() => {
    // Retrieve paths of all node packages
    return Promise.promisify(fs.readdir)(nodeModulesPath);
  })
  .then(subdirs => {
    // Load all packages configurations
    const nodeModulePromises = [];
    _.forEach(subdirs, (subdir) => {
      const nodeModulePath = path.join(nodeModulesPath, subdir);
      // subdir is the name of the package, so we pass it as the second argument
      nodeModulePromises.push(loadNodeModule(nodeModulePath, subdir));
    });
    return Promise.all(nodeModulePromises);
  })
  .then(nodeModules => {
    // This event allows to inject code to add or delete or alter node modules configurations
    return plugin.myrmex.fire('afterNodeModulesLoad', nodeModules);
  })
  .spread(nodeModules => {
    return Promise.resolve(nodeModules);
  })
  .catch(e => {
    // In case the project does not have any node package yet, an exception will be thrown
    // We silently ignore it
    if (e.code === 'ENOENT' && path.basename(e.path) === 'modules') {
      return Promise.resolve([]);
    }
    return Promise.reject(e);
  });
}
1304329
def load(self, _=None):
        
        for k, v in self.layer.iteritems():
            self.add(k, v['module'], v.get('package'))
1029442
def default_load_paths
        paths = ["#{RADIANT_ROOT}/test/mocks/#{environment}"]

        # Add the app's controller directory
        paths.concat(Dir["#{RADIANT_ROOT}/app/controllers/"])

        # Followed by the standard includes.
        paths.concat %w(
          app
          app/metal
          app/models
          app/controllers
          app/helpers
          config
          lib
          vendor
        ).map { |dir| "#{RADIANT_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) }

        paths.concat builtin_directories
        paths.concat library_directories
      end
353470
public function loadPackages()
    {
        $path = base_path('src');
        
        $packages = collect();

        foreach (glob($path."/*") as $directory) {
            $name = basename($directory);

            $file = $directory."/Package.php";
            $class = "{$name}\Package";

            if (File::exists($file)) {
                require_once $file;
                $class = new $class($this, $directory, $name);
                $class->boot();

                $packages[] = $class;
            }
        }


        $packages->map(function ($package) {
            $package->register();
        });
    }
1198935
function loadMiddlewareModules (options)
  {
    var middlewareStackClasses = [];

    options.internalMiddleware.forEach (function (moduleName)
    {
      var module = require (moduleName);
      if (!module.middleware)
        util.fatal ('No middleware found on module %.', moduleName);
      if (module.options)
        extend (options, module.options);
      middlewareStackClasses.push (module.middleware);
    });

    if (options.externalMiddleware)
      options.externalMiddleware.forEach (function (info)
      {
        var module = require (info.load);
        if (module.options)
          extend (options, new module.options ());
        var target = info.before || info.after
          , i = middlewareStackClasses.indexOf (target);
        if (~i)
          util.fatal ("Can't locate the % middleware module for inserting %.", target, info.load);
        middlewareStackClasses.splice (i + (info.before ? 0 : 1), 0, module.middleware);
      });

    return middlewareStackClasses;
  }
280069
private void readPackageListFromURL(String urlpath, URL pkglisturlpath) throws Fault {
        try {
            URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL();
            readPackageList(link.openStream(), urlpath, false);
        } catch (URISyntaxException | MalformedURLException exc) {
            throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc);
        }
        catch (IOException exc) {
            throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc);
        }
    }
286828
protected function setupPackage()
    {
        $configuration = realpath(__DIR__.'/../config/credentials.php');
        $migrations = realpath(__DIR__.'/../migrations');

        $this->publishes([
            $configuration => config_path('credentials.php'),
            $migrations    => base_path('database/migrations'),
        ]);

        $this->mergeConfigFrom($configuration, 'credentials');

        $this->loadViewsFrom(realpath(__DIR__.'/../views'), 'credentials');
    }
1345989
protected function loadRoutes()
    {
        $path = $this->extensionPath;

        $routes = [
            'backend'  => [
                $path . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'backend.php',
                $path . DIRECTORY_SEPARATOR . 'backend.php',
                $path . DIRECTORY_SEPARATOR . 'routes.php',
            ],
            'frontend' => [
                $path . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'frontend.php',
                $path . DIRECTORY_SEPARATOR . 'frontend.php',
            ]
        ];
        foreach ($routes as $area => $routePaths) {
            foreach ($routePaths as $route) {
                if (!file_exists($route)) {
                    continue;
                }
                switch ($area) {
                    case 'frontend':
                        $this->loadFrontendRoutesFrom($route);
                        break;
                    case 'backend':
                        $this->loadBackendRoutesFrom($route);
                        break;
                }
            }
        }
    }
575107
def load(self):
        """"""
        if self._modules_loaded is True:
            return

        self.load_modules_from_python(routes.ALL_ROUTES)
        self.aliases.update(routes.ALL_ALIASES)
        self._load_modules_from_entry_points('softlayer.cli')

        self._modules_loaded = True
257054
function() {
      if (options.servePacked) {
        ss.bundler.forEach(function(bundler) {
          bundler.useLatestsPackedId();
        });
      }
      ss.bundler.load();
      //TODO convert options.dirs to relative paths stripping the lead '/' if present

      // Cache instances of code formatters and template engines here
      // This may change in the future as I don't like hanging system objects
      // on the 'ss' internal API object, but for now it solves a problem
      // we were having when repl.start() would erase vars cached inside a module
      ss.client.formatters = this.formatters.load();
      ss.client.templateEngines = this.templateEngine.load();
    }
1046268
function (params) {
        var self = this;
        this.parseParams(params);
        if (!this.loaded) {
          this.fetchApi(api).success(function (data) {
            packages = data;
            self.loaded = true;
            self.search();
          });
        }
        else {
          this.search();
        }
      }
885060
public function loadRoutes()
    {
        $packageName = $this->getPackageName();

        foreach (Config::get('amethyst.'.$packageName.'.http') as $groupName => $group) {
            foreach ($group as $configName => $config) {
                if (Arr::get($config, 'enabled')) {
                    Router::group($groupName, Arr::get($config, 'router'), function ($router) use ($config) {
                        $controller = Arr::get($config, 'controller');

                        $reflection = new \ReflectionClass($controller);

                        if ($reflection->hasMethod('index')) {
                            $router->get('/', ['as' => 'index', 'uses' => $controller.'@index']);
                        }

                        if ($reflection->hasMethod('store')) {
                            $router->put('/', ['as' => 'store', 'uses' => $controller.'@store']);
                        }

                        if ($reflection->hasMethod('erase')) {
                            $router->delete('/', ['as' => 'erase', 'uses' => $controller.'@erase']);
                        }

                        if ($reflection->hasMethod('create')) {
                            $router->post('/', ['as' => 'create', 'uses' => $controller.'@create']);
                        }

                        if ($reflection->hasMethod('update')) {
                            $router->put('/{id}', ['as' => 'update', 'uses' => $controller.'@update']);
                        }

                        if ($reflection->hasMethod('remove')) {
                            $router->delete('/{id}', ['as' => 'remove', 'uses' => $controller.'@remove']);
                        }

                        if ($reflection->hasMethod('show')) {
                            $router->get('/{id}', ['as' => 'show', 'uses' => $controller.'@show']);
                        }
                    });
                }
            }
        }
    }
960500
def load(force=False):
    

    if GRAFTS and not force:
        return GRAFTS

    # insert missing paths
    # this could be a configurated item
    userpath = settings.userpath
    if os.path.isdir(userpath) and userpath not in __path__:
        __path__.append(userpath)

    def notify_error(name):
        logging.error('unable to load %s package' % name)

    # autoload decorated functions
    walker = walk_packages(__path__, '%s.' % __name__, onerror=notify_error)
    for module_finder, name, ispkg in walker:
        loader = module_finder.find_module(name)
        mod = loader.load_module(name)
        for func in mod.__dict__.values():
            if is_graft(func):
                GRAFTS.append(func)

    # append setuptools modules
    for entry_point in iter_entry_points(group=settings.entry_point):
        try:
            func = entry_point.load()
            if is_graft(func):
                GRAFTS.append(func)
            else:
                notify_error(entry_point.name)
        except Exception as error:
            logging.exception(error)
            notify_error(entry_point.name)

    return GRAFTS
300973
public function loadViews()
    {
        $package = $this->base_path."/Resources/views";

        $this->getServiceProvider()->loadViewsFrom($package, $this->name);
    }
4942
public function loadBundlesRoutes()
    {
        $loadedBundles = array_keys($this->container->findTaggedServiceIds('bundle.config'));
        foreach ($loadedBundles as $serviceId) {
            $config = $this->container->get($serviceId);
            $recipes = $this->getLoaderRecipesByConfig($config);

            $this->loadRoutes($config, $this->getCallbackFromRecipes($recipes, self::ROUTE_RECIPE_KEY));
        }
    }
892136
def load_routes(self):
        
        for file_name in os.listdir(os.path.join(self._project_dir, 'controllers')):
            # ignore disabled controllers
            if not file_name.startswith('_'):
                module_name = file_name.split('.', 1)[0]
                module_path = "controllers.{}".format(module_name)
                module = import_module(module_path)
                controllers = [getattr(module, x) for x in dir(module) if x != 'Controller' and x.endswith('Controller')]
                controller = controllers[0]
                self._routes[module_name] = controller
        return self._routes