Register bundle's config.yml files
424948
protected function registerConfigs()
    {
        $hasNewConfigs = false;

        $yamlConfig = new YamlConfig('', $this->configFiles['config']);
        $parameters = $yamlConfig->read();

        $configs = $this->kernelConfig->getConfigs();

        if (!count($configs)) {
            return;
        }

        foreach ($configs as $config) {
            // Check if the config is already being imported.
            if (VariableUtil::recursiveArraySearch($config, $parameters['imports']) === false) {
                $hasNewConfigs = true;

                // Add the config to the imports
                $parameters['imports'][]['resource'] = $config;
            }
        }

        if (!$hasNewConfigs) {
            return;
        }

        $yamlConfig = new YamlConfig('', $this->configFiles['config']);
        $yamlConfig->write($parameters);
        $yamlConfig->clean();
    }
366564
protected function registerBaseBindings()
    {
        static::setInstance($this);

        $this->instance('app', $this);

        $this->instance(Container::class, $this);

        $this->instance(PackageManifest::class, new PackageManifest(
            new Filesystem, $this->basePath(), $this->getCachedPackagesPath()
        ));
    }
681316
protected function loadFixtureFiles()
    {
        foreach ($this->bundles as $bundle) {
            $file = '*';
            if (strpos($bundle, '/')) {
                list($bundle, $file) = explode('/', $bundle);
            }
            $path = $this->kernel->locateResource('@' . $bundle);
            $files = glob($path . $this->directory . '/'.$file.'.yml');
            $this->fixture_files = array_unique(array_merge($this->fixture_files, $files));
        }
    }
376704
public function registerBundles()
    {
        $bundles = [
            // Symfony standard bundles
            new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new \Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new \Symfony\Bundle\TwigBundle\TwigBundle(),
            new \Symfony\Bundle\MonologBundle\MonologBundle(),
            new \Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new \Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),

            // Added vendor bundles
            new \APY\DataGridBundle\APYDataGridBundle(),
            new \Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle(),
            new \Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle(),
            new \Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
            new \FOS\JsRoutingBundle\FOSJsRoutingBundle(),
            new \FOS\RestBundle\FOSRestBundle(),
            new \FOS\UserBundle\FOSUserBundle(),
            new \JMS\SerializerBundle\JMSSerializerBundle(),
            new \Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(),
            new \Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle(),
            new \Lexik\Bundle\TranslationBundle\LexikTranslationBundle(),
            new \Liip\ImagineBundle\LiipImagineBundle(),
            new \Limenius\LiformBundle\LimeniusLiformBundle(),
            new \Nelmio\ApiDocBundle\NelmioApiDocBundle(),
            new \Nelmio\CorsBundle\NelmioCorsBundle(),
            new \Scheb\TwoFactorBundle\SchebTwoFactorBundle(),
            new \Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),

            // Opifer bundles
            new \Opifer\CmsBundle\OpiferCmsBundle(),
            new \Opifer\ContentBundle\OpiferContentBundle(),
            new \Opifer\EavBundle\OpiferEavBundle(),
            new \Opifer\FormBundle\OpiferFormBundle(),
            new \Opifer\FormBlockBundle\OpiferFormBlockBundle(),
            new \Opifer\MediaBundle\OpiferMediaBundle(),
            new \Opifer\RedirectBundle\OpiferRedirectBundle(),
            new \Opifer\ReviewBundle\OpiferReviewBundle(),
            new \Opifer\MailingListBundle\OpiferMailingListBundle(),
            new \Opifer\Revisions\OpiferRevisionsBundle(),
            new \Opifer\BootstrapBlockBundle\OpiferBootstrapBlockBundle(),
        ];

        if (in_array($this->getEnvironment(), ['dev', 'test'])) {
            $bundles[] = new \Symfony\Bundle\DebugBundle\DebugBundle();
            $bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new \Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new \Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }
158618
def from_yaml(self, path):
        """"""
        bundles = YAMLLoader(path).load_bundles()
        for name in bundles:
            self.register(name, bundles[name])
852714
private function registerConfigs()
    {
        foreach ($this->files as $config) {
            $params = array();

            if ($config['_params'] != null) {
                if (isset($this->app[$config['_params']])) {
                    $params = $this->app[$config['_params']];
                }
            }

            $this->app->register(new ConfigServiceProvider($config['file'], $params));
        }

        unset($this->app['_params']);
        unset($this->app['_priority']);
    }
882763
protected function registerClasses()
    {
        $campaignchainBundlesContent = file_get_contents($this->configFiles['bundles']);
        $symfonyBundlesContent = file_get_contents($this->configFiles['kernel_symfony']);

        $hasNewBundles = false;

        $classes = $this->kernelConfig->getClasses();

        if (!count($classes)) {
            return;
        }

        foreach ($classes as $class) {
            // Check if the bundle is already registered in the kernel.
            if (
                strpos($campaignchainBundlesContent, $class) === false &&
                strpos($symfonyBundlesContent, $class) === false
            ) {
                $hasNewBundles = true;

                // Add the bundle class path to the CampaignChain bundles registry file.
                $campaignchainContentBundle = "\$bundles[] = new ".$class."();";

                $campaignchainBundlesContent .= "\xA".$campaignchainContentBundle;
            }
        }

        if (!$hasNewBundles) {
            return;
        }

        $fs = new Filesystem();
        $fs->dumpFile($this->configFiles['bundles'], $campaignchainBundlesContent);

    }
269056
function loadConfigFile(configInfo) {
    const { filePath } = configInfo;
    let config;

    switch (path.extname(filePath)) {
        case ".js":
            config = loadJSConfigFile(filePath);
            if (configInfo.configName) {
                config = config.configs[configInfo.configName];
                if (!config) {
                    throw configMissingError(configInfo.configFullName);
                }
            }
            break;

        case ".json":
            if (path.basename(filePath) === "package.json") {
                config = loadPackageJSONConfigFile(filePath);
                if (config === null) {
                    return null;
                }
            } else {
                config = loadJSONConfigFile(filePath);
            }
            break;

        case ".yaml":
        case ".yml":
            config = loadYAMLConfigFile(filePath);
            break;

        default:
            config = loadLegacyConfigFile(filePath);
    }

    return ConfigOps.merge(ConfigOps.createEmptyConfig(), config);
}
243767
private function registerPackageConfig()
	{
		if (isLaravel5())
		{
	        $this->app->bindShared($this->packageName.'.config', function($app)
			{
				$configNameSpace = 'vendor.'.$this->packageVendor.'.'.$this->packageName.'.';
		        // Register the corresponding config for package
				return new $this->packageConfigClass($app['config'], $configNameSpace);
			});
			
		}

	}
1157262
private function registerModule(Bundle $bundle)
    {
        $params = $this->getModule($this->rootDir.$bundle->getPath().DIRECTORY_SEPARATOR.'campaignchain.yml');

        // General installation routine.
        if (!is_array($params['modules']) || !count($params['modules'])) {
            return;
        }

        foreach ($params['modules'] as $identifier => $moduleParams) {
            $module = null;

            if ($bundle->getStatus()) {
                $status = $bundle->getStatus();
            } else {
                $status = $this->bundleConfigService->isRegisteredBundle($bundle);
            }

            /*
             * TODO: Detect whether a module has previously been registered
             * for this bundle, but the module is not anymore defined in
             * its campaignchain.yml.
             */
            if ($status == self::STATUS_REGISTERED_OLDER) {
                /** @var Module $module */
                $module = $this->em
                    ->getRepository('CampaignChainCoreBundle:Module')
                    ->findOneBy(
                        [
                            'bundle' => $bundle,
                            'identifier' => strtolower($identifier),
                        ]
                    );
            }

            switch ($bundle->getType()) {
                case 'campaignchain-channel':
                    $moduleEntity = 'ChannelModule';
                    break;
                case 'campaignchain-location':
                    $moduleEntity = 'LocationModule';
                    break;
                case 'campaignchain-campaign':
                    $moduleEntity = 'CampaignModule';
                    break;
                case 'campaignchain-milestone':
                    $moduleEntity = 'MilestoneModule';
                    break;
                case 'campaignchain-activity':
                    $moduleEntity = 'ActivityModule';
                    break;
                case 'campaignchain-operation':
                    $moduleEntity = 'OperationModule';
                    break;
                case 'campaignchain-report':
                case 'campaignchain-report-analytics':
                case 'campaignchain-report-budget':
                case 'campaignchain-report-sales':
                    $moduleEntity = 'ReportModule';
                    break;
                case 'campaignchain-security':
                    $moduleEntity = 'SecurityModule';
                    break;
            }

            if (!$module) {
                $entityClass = 'CampaignChain\\CoreBundle\\Entity\\'.$moduleEntity;
                /** @var Module $module */
                $module = new $entityClass();
                $module->setIdentifier(strtolower($identifier));
                $module->setBundle($bundle);
            }

            $module->setDisplayName($moduleParams['display_name']);

            /*
             * Tracking alias which allows the CTA tracking to match the
             * Location Identifier provided by the tracking script to a module.
             */
            if (isset($moduleParams['tracking_alias']) && strlen($moduleParams['tracking_alias'])) {
                $module->setTrackingAlias($moduleParams['tracking_alias']);
            }

            if (isset($moduleParams['description'])) {
                $module->setDescription($moduleParams['description']);
            }

            // Verify routes.
            if (in_array(
                $bundle->getType(),
                ['campaignchain-activity', 'campaignchain-channel', 'campaignchain-campaign', 'campaignchain-milestone']
            )) {
                // Throw error if no routes defined.
                if (
                    !isset($moduleParams['routes'])
                    || !is_array($moduleParams['routes'])
                    || !count($moduleParams['routes'])
                ) {
                    throw new \Exception(
                        'The module "'.$identifier
                        .'" in bundle "'.$bundle->getName().'"'
                        .' does not provide any of the required routes.'
                    );
                } else {
                    // Throw error if one or more routes are missing.
                    $hasMissingRoutes = false;
                    $missingRoutes = '';

                    foreach ($this->requiredRoutes[$bundle->getType()] as $requiredRoute) {
                        if (!array_key_exists($requiredRoute, $moduleParams['routes'])) {
                            $hasMissingRoutes = true;
                            $missingRoutes .= $requiredRoute.', ';
                        }
                    }

                    if ($hasMissingRoutes) {
                        throw new \Exception(
                            'The module "'.$identifier
                            .'" in bundle "'.$bundle->getName().'"'
                            .' must define the following route(s): '
                            .rtrim($missingRoutes, ', ').'.'
                        );
                    } else {
                        $module->setRoutes($moduleParams['routes']);
                    }
                }
            } elseif (isset($moduleParams['routes']) && is_array($moduleParams['routes']) && count(
                    $moduleParams['routes']
                )
            ) {
                $module->setRoutes($moduleParams['routes']);
            }

            if (isset($moduleParams['services']) && is_array($moduleParams['services']) && count(
                    $moduleParams['services']
                )
            ) {
                $module->setServices($moduleParams['services']);
            }
            if (isset($moduleParams['hooks']) && is_array($moduleParams['hooks']) && count($moduleParams['hooks'])) {
                // TODO: Check that there's only 1 trigger hook included.
                $module->setHooks($moduleParams['hooks']);
            }
            if (isset($moduleParams['system']) && is_array($moduleParams['system']) && count($moduleParams['system'])) {
                $this->systemParams[] = $moduleParams['system'];
            }
            // Are metrics for the reports defined?
            if (isset($moduleParams['metrics']) && is_array($moduleParams['metrics']) && count(
                    $moduleParams['metrics']
                )
            ) {
                foreach ($moduleParams['metrics'] as $metricType => $metricNames) {
                    switch ($metricType) {
                        case 'activity':
                            $metricClass = 'ReportAnalyticsActivityMetric';
                            break;
                        case 'location':
                            $metricClass = 'ReportAnalyticsLocationMetric';
                            break;
                        default:
                            throw new \Exception(
                                "Unknown metric type '".$metricType."'."
                                ."Pick 'activity' or 'location' instead."
                            );
                            break;
                    }
                    foreach ($metricNames as $metricName) {
                        $metric = $this->em->getRepository('CampaignChainCoreBundle:'.$metricClass)
                            ->findOneBy(
                                [
                                    'name' => $metricName,
                                    'bundle' => $bundle->getName(),
                                ]
                            );

                        // Does the metric already exist?
                        if ($metric) {
                            /*
                             * Throw error if bundle is new and metric
                             * has already been registered.
                             */
                            if ($status == self::STATUS_REGISTERED_NO) {
                                throw new \Exception(
                                    "Metric '".$metricName."' of type '".$metricType."'"
                                    .' already exists for bundle '.$bundle->getName().'. '
                                    .'Please define another name '
                                    .'in campaignchain.yml of '.$bundle->getName().'.'
                                );
                            }
                            // Skip if same or older version of bundle.
                            continue;
                        } else {
                            // Create new metric.
                            $metricNamespacedClass = 'CampaignChain\\CoreBundle\\Entity\\'.$metricClass;
                            $metric = new $metricNamespacedClass();
                            $metric->setName($metricName);
                            $metric->setBundle($bundle->getName());
                            $this->em->persist($metric);
                        }
                    }
                }
            }

            // Process the params specific to a module type.

            // Params that must be defined for Operation modules
            if ($bundle->getType() == 'campaignchain-operation' && !isset($moduleParams['params']['owns_location'])) {
                throw new \Exception(
                    "You must set the 'owns_location' parameter in campaignchain.yml to 'true' or 'false' for module '".$identifier."' in bundle '".$bundle->getName(
                    )."'."
                );
            }

            if (isset($moduleParams['params'])) {
                $module->setParams($moduleParams['params']);
            }

            // Add new module to new bundle.
            $reflect = new \ReflectionClass($module);
            $addModuleMethod = 'add'.$reflect->getShortName();
            $bundle->$addModuleMethod($module);

            // If a campaign module, remember the conversion to other campaign types.
            if (
                $bundle->getType() == 'campaignchain-campaign' &&
                isset($moduleParams['conversions']) &&
                is_array($moduleParams['conversions']) &&
                count($moduleParams['conversions'])
            ) {
                $this->campaignConversions[$bundle->getName()][$module->getIdentifier()] = $moduleParams['conversions'];
            }

            // If an activity or Location module, remember the related channels.
            if (
                isset($moduleParams['channels']) && is_array($moduleParams['channels']) && count($moduleParams['channels'])
            ) {
                $this->channelRelationships[$moduleEntity][$bundle->getName()][$module->getIdentifier()] = $moduleParams['channels'];
            }
        }
    }
244941
function registerJytPlugins() {
    var rootDir = this.pancakes.getRootDir();
    var pluginDir = path.normalize(rootDir + '/app/common/jyt.plugins');
    var me = this;

    // if plugin dir doesn't exist, just return
    if (!fs.existsSync(pluginDir)) { return;  }

    // else get all plugin files from the jyt.plugins dir
    var pluginFiles = fs.readdirSync(pluginDir);
    var deps = { dependencies: me.getJangularDeps() };
    _.each(pluginFiles, function (pluginFile) {
        var name = me.dotToCamelCase(pluginFile);
        var pluginFlapjack = me.pancakes.requireModule(pluginDir + delim + pluginFile);
        var plugin = me.pancakes.cook(pluginFlapjack, deps);
        jangular.registerPlugin(name, plugin);
        me.jangularDeps[name] = plugin;
    });
}
963792
function createBundle(log = logger.log.bind(logger)) {
  if (!npm.can.prepare()) {
    log('building ts-jest')
    npm.spawnSync(['-s', 'run', 'build'], { cwd: rootDir })
  }
  log('creating ts-jest bundle')
  const res = npm.spawnSync(['-s', 'pack'], { cwd: rootDir })
  return join(rootDir, res.stdout.toString().trim())
}
1056871
protected function registerSecurity()
    {
        /*
         * Re-create the security.yml file to avoid duplicates in merged array
         * that occur upon multiple parsing.
         */
        $fs = new Filesystem();
        if(!$fs->exists($this->configFiles['security'])){
            $fs->copy(
                $this->configFiles['security_dist'],
                $this->configFiles['security'],
                true
            );
        }

        $yamlConfig = new YamlConfig('', $this->configFiles['security_dist']);
        $appParameters = $yamlConfig->read();

        // Read content of all security.yml files and merge the arrays.
        $securityFiles = $this->kernelConfig->getSecurities();
        if (!count($securityFiles)) {
            return;
        }

        foreach ($securityFiles as $securityFile) {
            $yamlConfig = new YamlConfig('', $securityFile);
            $bundleParameters = $yamlConfig->read();
            $appParameters = VariableUtil::arrayMerge($bundleParameters, $appParameters);
        }

        $yamlConfig = new YamlConfig('', $this->configFiles['security']);
        $yamlConfig->write($appParameters, 5);
        $yamlConfig->clean();
    }
547817
public static function register($bundle, $config = array())
	{
		$defaults = array('handles' => null, 'auto' => false);

		// If the given configuration is actually a string, we will assume it is a
		// location and set the bundle name to match it. This is common for most
		// bundles that simply live in the root bundle directory.
		if (is_string($config))
		{
			$bundle = $config;

			$config = array('location' => $bundle);
		}

		// If no location is set, we will set the location to match the name of
		// the bundle. This is for bundles that are installed on the root of
		// the bundle directory so a location was not set.
		if ( ! isset($config['location']))
		{
			$config['location'] = $bundle;
		}

		static::$bundles[$bundle] = array_merge($defaults, $config);

		// It is possible for the developer to specify auto-loader mappings
		// directly on the bundle registration. This provides a convenient
		// way to register mappings without a bootstrap.
		if (isset($config['autoloads']))
		{
			static::autoloads($bundle, $config);
		}
	}
823957
def register_options(cls, register):
    """"""
    super(BundleMixin, cls).register_options(register)
    register('--archive', choices=list(archive.TYPE_NAMES),
             fingerprint=True,
             help='Create an archive of this type from the bundle. '
                  'This option is also defined in app target. '
                  'Precedence is CLI option > target option > pants.ini option.')
    # `target.id` ensures global uniqueness, this flag is provided primarily for
    # backward compatibility.
    register('--use-basename-prefix', advanced=True, type=bool,
             help='Use target basename to prefix bundle folder or archive; otherwise a unique '
                  'identifier derived from target will be used.')
465868
protected function arrangeBundlesForEnvironment()
    {
        foreach ($this->autoloaderCollection as $autoloader) {
            $autoloaderBundles = $autoloader->getBundles();
            foreach ($autoloaderBundles as $environment => $bundles) {
                foreach ($bundles as $bundle) {
                    $this->environmentsBundles[$environment][] = $bundle;
                }
            }
        }
        
        $this->register('all');
        $this->register($this->environment);
        $this->orderBundles();
    }
949004
protected function registerConfig()
    {
        $location = __DIR__ . '/../config/' . $this->shortName . '.php';

        $this->mergeConfigFrom(
            $location, $this->shortName
        );

        $this->publishes([
            $location => config_path($this->shortName . '.php'),
        ], 'config');
    }