Register all managed paths with Composer.

This function configures Composer to treat all Studio-managed paths as local path repositories, so that packages
therein will be symlinked directly.
551411
public function registerStudioPackages()
    {
        $repoManager = $this->composer->getRepositoryManager();
        $composerConfig = $this->composer->getConfig();

        foreach ($this->getManagedPaths() as $path) {
            $this->io->writeError("[Studio] Loading path $path");

            $repoManager->prependRepository(new PathRepository(
                ['url' => $path],
                $this->io,
                $composerConfig
            ));
        }
    }
613906
function register_dependency( $path ){
	
		// register as not having been processed yet
		if( ! isset($this->dependencies[$path]) ){
			$this->dependencies[$path] = 0;
		}
		
		// return path suitable for use in include directive
		// consulting include path settings avoids hard coded paths 
		if( isset($this->incpaths) ){
			$path = PLUG_VIRTUAL_DIR . PLUGTool::map_deployment_virtual( $path );
			return relpath( $this->cwd, $path, $this->incpaths );
		}

		// else we must map this path to the target host with a full path
		$base = $this->conf_consts['PLUG_VIRTUAL_DIR'];
		return $base . PLUGTool::map_deployment_virtual( $path );
	}
57598
private function registerRoutes()
    {
        $config = $this->app->make('community_translation/config');
        $onlineTranslationPath = $config->get('options.onlineTranslationPath');
        $apiEntryPoint = $config->get('options.api.entryPoint');
        $handleRegex = '[A-Za-z0-9]([A-Za-z0-9\_]*[A-Za-z0-9])?';
        $localeRegex = '[a-zA-Z]{2,3}([_\-][a-zA-Z0-9]{2,3})?';
        $this->app->make(Router::class)->registerMultiple([
            // Online Translation
            "$onlineTranslationPath/{packageVersionID}/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::view',
                null,
                ['packageVersionID' => 'unreviewed|[1-9][0-9]*', 'localeID' => $localeRegex],
                [],
                '',
                [],
                ['GET'],
            ],
            "$onlineTranslationPath/action/save_comment/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::save_comment',
                null,
                ['localeID' => $localeRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$onlineTranslationPath/action/delete_comment/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::delete_comment',
                null,
                ['localeID' => $localeRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$onlineTranslationPath/action/load_all_places/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::load_all_places',
                null,
                ['localeID' => $localeRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$onlineTranslationPath/action/process_translation/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::process_translation',
                null,
                ['localeID' => $localeRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$onlineTranslationPath/action/load_translation/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::load_translation',
                null,
                ['localeID' => $localeRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$onlineTranslationPath/action/save_glossary_term/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::save_glossary_term',
                null,
                ['localeID' => $localeRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$onlineTranslationPath/action/delete_glossary_term/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::delete_glossary_term',
                null,
                ['localeID' => $localeRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$onlineTranslationPath/action/download/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::download',
                null,
                ['localeID' => $localeRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$onlineTranslationPath/action/upload/{localeID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::upload',
                null,
                ['localeID' => $localeRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$onlineTranslationPath/action/save_notifications/{packageID}" => [
                'Concrete\Package\CommunityTranslation\Controller\Frontend\OnlineTranslation::save_notifications',
                null,
                ['packageID' => '\d+'],
                [],
                '',
                [],
                ['POST'],
            ],
            // API Entry Points
            "$apiEntryPoint/rate-limit/" => [
                'CommunityTranslation\Api\EntryPoint::getRateLimit',
                null,
                [],
                [],
                '',
                [],
                ['GET'],
            ],
            "$apiEntryPoint/locales/" => [
                'CommunityTranslation\Api\EntryPoint::getLocales',
                null,
                [],
                [],
                '',
                [],
                ['GET'],
            ],
            "$apiEntryPoint/packages/" => [
                'CommunityTranslation\Api\EntryPoint::getPackages',
                null,
                [],
                [],
                '',
                [],
                ['GET'],
            ],
            "$apiEntryPoint/package/{packageHandle}/versions/" => [
                'CommunityTranslation\Api\EntryPoint::getPackageVersions',
                null,
                ['packageHandle' => $handleRegex],
                [],
                '',
                [],
                ['GET'],
            ],
            "$apiEntryPoint/package/{packageHandle}/{packageVersion}/locales/{minimumLevel}/" => [
                'CommunityTranslation\Api\EntryPoint::getPackageVersionLocales',
                null,
                ['packageHandle' => $handleRegex, 'minimumLevel' => '[0-9]{1,3}'],
                [],
                '',
                [],
                ['GET'],
            ],
            "$apiEntryPoint/package/{packageHandle}/{packageVersion}/translations/{localeID}/{formatHandle}/" => [
                'CommunityTranslation\Api\EntryPoint::getPackageVersionTranslations',
                null,
                ['packageHandle' => $handleRegex, 'localeID' => $localeRegex, 'formatHandle' => $handleRegex],
                [],
                '',
                [],
                ['GET'],
            ],
            "$apiEntryPoint/fill-translations/{formatHandle}/" => [
                'CommunityTranslation\Api\EntryPoint::fillTranslations',
                null,
                ['formatHandle' => $handleRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$apiEntryPoint/package/{packageHandle}/{packageVersion}/translatables/{formatHandle}/" => [
                'CommunityTranslation\Api\EntryPoint::importPackageVersionTranslatables',
                null,
                ['packageHandle' => $handleRegex, 'formatHandle' => $handleRegex],
                [],
                '',
                [],
                ['POST'],
            ],
            "$apiEntryPoint/translations/{localeID}/{formatHandle}/{approve}/" => [
                'CommunityTranslation\Api\EntryPoint::importTranslations',
                null,
                ['localeID' => $localeRegex, 'formatHandle' => $handleRegex, 'approve' => '[01]'],
                [],
                '',
                [],
                ['POST'],
            ],
            "$apiEntryPoint/import/package/" => [
                'CommunityTranslation\Api\EntryPoint::importPackage',
                null,
                [],
                [],
                '',
                [],
                ['PUT'],
            ],
            "$apiEntryPoint/{unrecognizedPath}" => [
                'CommunityTranslation\Api\EntryPoint::unrecognizedCall',
                null,
                ['unrecognizedPath' => '.*'],
            ],
            "$apiEntryPoint" => [
                'CommunityTranslation\Api\EntryPoint::unrecognizedCall',
            ],
        ]);
    }
789213
private function registerPublishableResources()
    {
        $basePath = dirname(__DIR__);
        $publishable = [
            'voyager_assets' => [
                "$basePath/publishable/assets" => public_path('vendor/tcg/voyager/assets'),
            ],
            'migrations' => [
                "$basePath/publishable/database/migrations/" => database_path('migrations'),
            ],
            'seeds' => [
                "$basePath/publishable/database/seeds/" => database_path('seeds'),
            ],
            'demo_content' => [
                "$basePath/publishable/demo_content/" => storage_path('app/public'),
            ],
            'config' => [
                "$basePath/publishable/config/voyager.php" => config_path('voyager.php'),
            ],
        ];

        foreach ($publishable as $group => $paths) {
            $this->publishes($paths, $group);
        }
    }
1102720
public function registerConsoleCommands()
    {
        $this->commands([
            \Plank\Mediable\Commands\ImportMediaCommand::class,
            \Plank\Mediable\Commands\PruneMediaCommand::class,
            \Plank\Mediable\Commands\SyncMediaCommand::class,
        ]);
    }
515240
private function setup()
	{
		$composer_psr4 = dirname(dirname(dirname(__DIR__))).'/composer/autoload_psr4.php';
		if (!file_exists($composer_psr4)) {
			exit("\nI can't find Composer data!");
		}

		$composer = require_once $composer_psr4;
		if (!isset($composer['Config\\'][0])) {
			exit("\nI can't find Composer data!");
		}

		//APP_CONFIGPATH defined in "index.php" or in bootstrape
    	if(!defined('_CONFIGPATH')){
      		define('_CONFIGPATH', isset($composer[''][0]) //Composer fallBack
		       ? $composer[''][0].'/Config' 
		       : dirname($vendorDir).'/Config');
    	}
    	static::$configDir = _CONFIGPATH;
    	static::$vendorDir = $vendorDir;
    	static::$baseDir = defined('_PHPPATH') ? _PHPPATH : dirname($vendorDir);
	}
501218
def register_plugin_dir(path):
    """"""
    import glob
    for f in glob.glob(path + '/*.py'):
        for k, v in load_plugins_from_module(f).items():
            if k:
                global_registry[k] = v
1068948
public static function autodiscover()
    {
        // Search through all composer packages in vendor
        foreach (glob(BASE_PATH . '/vendor/*', GLOB_ONLYDIR) as $vendor) {
            foreach (glob($vendor . '/*', GLOB_ONLYDIR) as $directory) {
                if (file_exists($directory . '/_register_database.php')) {
                    include_once($directory . '/_register_database.php');
                }
            }
        }
    }
587567
protected function registerPackage($vendor, $package, $relPackagePath)
    {
        $this->info('Register package in composer.json.');

        $composerJson = $this->loadComposerJson();

        if (! isset($composerJson['repositories'])) {
            Arr::set($composerJson, 'repositories', []);
        }

        $filtered = array_filter($composerJson['repositories'], function ($repository) use ($relPackagePath) {
            return $repository['type'] === 'path'
                && $repository['url'] === $relPackagePath;
        });

        if (count($filtered) === 0) {
            $this->info('Register composer repository for package.');

            $composerJson['repositories'][] = (object) [
                'type' => 'path',
                'url' => $relPackagePath,
            ];
        } else {
            $this->info('Composer repository for package is already registered.');
        }

        Arr::set($composerJson, "require.$vendor/$package", 'dev-master');

        $this->saveComposerJson($composerJson);

        $this->info('Package was successfully registered in composer.json.');
    }
622429
private function registerFilesystem()
    {
        $this->singleton(Contracts\Utilities\Filesystem::class, function ($app) {
            /**
             * @var  \Illuminate\Config\Repository      $config
             * @var  \Illuminate\Filesystem\Filesystem  $files
             */
            $config     = $app['config'];
            $files      = $app['files'];
            $filesystem = new Utilities\Filesystem($files, $config->get('log-viewer.storage-path'));

            $pattern = $config->get('log-viewer.pattern', []);

            $filesystem->setPattern(
                Arr::get($pattern, 'prefix',    Utilities\Filesystem::PATTERN_PREFIX),
                Arr::get($pattern, 'date',      Utilities\Filesystem::PATTERN_DATE),
                Arr::get($pattern, 'extension', Utilities\Filesystem::PATTERN_EXTENSION)
            );

            return $filesystem;
        });
    }
1251639
public function build()
    {
        $packages = [];

        if (file_exists($installed = $this->vendorPath.'/composer/installed.json')) {
            $packages = json_decode(file_get_contents($installed), true);
        }

        $this->write($this->map($packages));
    }
160127
protected function registerAvailableVersions()
    {
        $this->availableVersions = [];
        foreach ($this->packageManager->getAvailablePackages() as $package) {
            $this->registerVersionInDirectory($package, 'TYPO3CR');
            $this->registerVersionInDirectory($package, 'ContentRepository');
        }
        ksort($this->availableVersions);
    }
71406
protected function registerRoutings()
    {
        $yamlConfig = new YamlConfig('', $this->configFiles['routing']);
        $parameters = $yamlConfig->read();

        $hasNewRoutings = false;

        $routings = $this->kernelConfig->getRoutings();

        if (!count($routings)) {
            return false;
        }

        foreach ($routings as $routing) {
            // Check if the routing is already defined.
            if (isset($parameters[$routing['name']])) {
                continue;
            }

            $hasNewRoutings = true;

            // Add the config to the imports
            $parameters[$routing['name']] = array(
                'resource' => $routing['resource'],
                'prefix' => $routing['prefix'],
            );
        }

        if (!$hasNewRoutings) {
            return;
        }

        $yamlConfig = new YamlConfig('', $this->configFiles['routing']);
        $yamlConfig->write($parameters);
        $yamlConfig->clean();
    }
441782
public static function registerApp(string $path, ?string $app = null): void
    {
        self::initialize();
        if ($app === null) {
            $app = '*';
        }
        if (isset(self::$repositories[$app])) {
            throw new ConfigException('Application ' . $app . ' already registered.');
        }
        $path = rtrim($path, '/');
        if (!is_dir($path)) {
            throw new ConfigException('Path ' . $path . ' does not exist.');
        }
        self::$repositories[$app] = new Repository($path);
    }
995761
protected function registerAssetSymlinker()
    {
//        $this->app->singleton('asset.symlinker', function() {
//            $publicPath = sandbox_path('packages/antares');
//
//            return new AssetSymlinker(new Filesystem, $publicPath);
//        });

        $this->app->singleton(AssetSymlinker::class, function() {
            $publicPath = sandbox_path('packages/antares');

            return new AssetSymlinker(new Filesystem, $publicPath);
        });

        $this->app->alias(AssetSymlinker::class, 'asset.symlinker');
    }
718442
protected function registerFoundation()
    {
        $this->app['orchestra.installed'] = false;

        $this->app->singleton('orchestra.app', function (Application $app) {
            return new Foundation($app, new RouteResolver($app));
        });
    }
345113
private function resolveAutomaticallyIgnoredPaths()
    {
        foreach ($this->paths as $path) {
            if (is_array($path)) {
                $path = $path['home'];
            }
            if (!Str::endsWith($path, $this->normalizePath('_template/'))) {
                $ignoredPath = $this->normalizePath(realpath($path.'/composer.json'));

                if (!in_array($ignoredPath, $this->automaticallyResolvedIgnoredPaths)) {
                    $this->automaticallyResolvedIgnoredPaths[] = $ignoredPath;
                }
            }
        }

        // Add the '_newup' directory.
        $this->automaticallyResolvedIgnoredPaths[] = $this->normalizePath('_newup\*');
    }