Generate a site package and fill it with boilerplate data.

@param string $packageKey
@param string $siteName
@return array
967996
public function generateSitePackage($packageKey, $siteName)
    {
        $this->packageManager->createPackage($packageKey, [
            'type' => 'neos-site',
            "require" => [
                "neos/neos" => "*",
                "neos/nodetypes" => "*"
            ],
            "suggest" => [
                "neos/seo" => "*"
            ]
        ]);

        $this->generateSitesXml($packageKey, $siteName);
        $this->generateSitesRootFusion($packageKey, $siteName);
        $this->generateSitesPageFusion($packageKey, $siteName);
        $this->generateDefaultTemplate($packageKey, $siteName);
        $this->generateNodeTypesConfiguration($packageKey);
        $this->generateAdditionalFolders($packageKey);

        return $this->generatedFiles;
    }
883216
protected function generateDefaultTemplate($packageKey, $siteName)
    {
        $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Template/SiteTemplate.html';

        $contextVariables = [
            'siteName' => $siteName,
            'neosViewHelper' => '{namespace neos=Neos\Neos\ViewHelpers}',
            'fusionViewHelper' => '{namespace fusion=Neos\Fusion\ViewHelpers}',
            'siteNodeName' => $this->generateSiteNodeName($packageKey)
        ];

        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);

        $defaultTemplatePathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Templates/Page/Default.html';
        $this->generateFile($defaultTemplatePathAndFilename, $fileContent);
    }
539437
protected function createNewSiteConfigDir($site_name) {
    $config_dir = $this->getConfigValue('docroot') . '/' . $this->getConfigValue('cm.core.path') . '/' . $site_name;
    $result = $this->taskFilesystemStack()
      ->mkdir($config_dir)
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();
    if (!$result->wasSuccessful()) {
      throw new BltException("Unable to create $config_dir.");
    }
  }
1041814
protected function searchPackage($packageName)
    {
        $this->comment('Searching for package...');
        $packages = $this->packagist->search($packageName);
        $total = count($packages);

        if ($total === 0) {
            $this->comment('No packages found');
            exit;
        }
        $this->comment('Found ' . $total . ' packages:');

        foreach ($packages as $i => $package) {
            $this->getOutput()->writeln(sprintf(
                '[%d] <info>%s</info> (%s)',
                $i + 1,
                $package->getName(),
                $package->getDescription()
            ));
        }

        $this->choosePackage($packages);
    }
639043
public function isThemePackage($packageName)
    {
        $composerPackage = $this->findPackageGlobal($packageName);

        if (is_null($composerPackage) === true) {
            throw new \RuntimeException(sprintf('The theme: "%s" does not exist.', $packageName));
        }

        return $composerPackage->getType() == self::PACKAGE_TYPE_THEME;
    }
1113469
public function getAggregatePackageContaining($packageName)
    {
        foreach ($this->packages as $packageNode) {
            if ($packageNode->replaces($packageName)) {
                return $packageNode;
            }
        }

        return null;
    }
861824
public function getContents($cacheKey)
    {
        $cacheInfo = $this->getCache($cacheKey);
        if (!$cacheInfo) {
            throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name'=>$cacheKey]));
        }

        $this->localPath = $cacheInfo['path'];
        $this->storagePath = storage_path('cms/combiner/assets');

        /*
         * Analyse cache information
         */
        $lastModifiedTime = gmdate("D, d M Y H:i:s \G\M\T", array_get($cacheInfo, 'lastMod'));
        $etag = array_get($cacheInfo, 'etag');
        $mime = (array_get($cacheInfo, 'extension') == 'css')
            ? 'text/css'
            : 'application/javascript';

        /*
         * Set 304 Not Modified header, if necessary
         */
        header_remove();
        $response = Response::make();
        $response->header('Content-Type', $mime);
        $response->header('Cache-Control', 'private, max-age=604800');
        $response->setLastModified(new DateTime($lastModifiedTime));
        $response->setEtag($etag);
        $response->setPublic();
        $modified = !$response->isNotModified(App::make('request'));

        /*
         * Request says response is cached, no code evaluation needed
         */
        if ($modified) {
            $this->setHashOnCombinerFilters($cacheKey);
            $combiner = $this->prepareCombiner($cacheInfo['files']);
            $contents = $combiner->dump();
            $response->setContent($contents);
        }

        return $response;
    }
650109
private function _packageMapping($packageId = '')
    {
        $this->debug->debug(__FUNCTION__, 'Input PackageId: ' . json_encode($packageId));
        $this->debug->debug(__FUNCTION__, 'List Package: ' . json_encode($this->listPackage));
        if (array_key_exists($packageId, $this->listPackage)) {
            $result = $this->listPackage[$packageId];
        } else {
            $result = [
                'serviceId'   => '',
                'packageId'   => '',
                "commandId"   => "",
                "name"        => "",
                "nameDesc"    => "",
                "descCircle"  => "",
                "usePrice"    => '',
                "priceDesc"   => "",
                "priceCircle" => "",
                'renewCircle' => ''
            ];
        }
        $this->debug->info(__FUNCTION__, 'Final Result: ' . json_encode($result));

        return $result;
    }
592497
protected function createPackageFolder($packagePath)
    {
        $this->info('Create package folder.');

        if (File::exists($packagePath)) {
            $this->info('Package folder already exists. Skipping.');

            return;
        }

        if (! File::makeDirectory($packagePath, 0755, true)) {
            throw new RuntimeException('Cannot create package folder');
        }

        $this->info('Package folder was successfully created.');
    }
718797
public function configurePackageContents($packageXml, $code, $filesStructure)
    {
        $target = $this->getXmlChild($packageXml, 'contents')->addChild('target');
        $target->addAttribute('name', $code);

        foreach ($filesStructure['directories'] as $directory) {
            $this->buildXmlDir($target, $directory);
        }
        foreach ($filesStructure['files'] as $file) {
            $this->buildXmlFile($target, $file, $filesStructure['real_path']);
        }

        return $this;
    }
1373045
public function createProject($packageName, $packageVersion, $outputFolder)
    {
        $this->runCommand('create-project --prefer-dist ' . $packageName . ' ' . $outputFolder . ' "' . $packageVersion . '"');

        return $this;
    }
952124
private function getDependents(
        string $packageName,
        bool $returnContext,
        array $context = []
    ): array {
        if (!isset($context[$packageName])) {
            $context[$packageName] = $this->repository->getDependents(
                $packageName,
                null,
                false,
                false
            );

            foreach ($context[$packageName] as $key => $dependent) {
                $dependentContext = $this->getDependents($key, true, $context);
                $context          = array_merge(
                    $context,
                    $dependentContext
                );

                $context[$packageName] = array_merge(
                    $context[$packageName],
                    $dependentContext[$key]
                );
            }
        }

        if (!$returnContext) {
            return $context[$packageName];
        }

        return $context;
    }
975355
public function configurationAction($sitePackageKey = null)
    {
        $sitePackageKey = $sitePackageKey ?: $this->getDefaultSitePackageKey();

        $value = [];
        $value['sitePackage'] = $sitePackageKey;
        $value['ui'] = [
            'sitePackages' =>  $this->getSitePackages(),
            'viewportPresets' => $this->configurationService->getSiteConfiguration($sitePackageKey, 'ui.viewportPresets'),
            'localePresets' => $this->configurationService->getSiteConfiguration($sitePackageKey, 'ui.localePresets'),
            'hotkeys' => $this->configurationService->getSiteConfiguration($sitePackageKey, 'ui.hotkeys'),
            'preview' => $this->configurationService->getSiteConfiguration($sitePackageKey, 'preview')
        ];
        $value['styleguideObjects'] = $this->getStyleguideObjects($sitePackageKey);

        $this->view->assign('value', $value);
    }
1041442
public void addSite(String siteKey) {
		ValueMap gv = new ValueMap(siteKey);
		if (!this.valueMaps.contains(gv)) {
			this.valueMaps.add(gv);
		}
	}
589191
public static SiteLink makeSiteLink(String title, String siteKey) {
		return factory.getSiteLink(title, siteKey, Collections.emptyList());
	}
12133
public function generateDocumentation($packageKey)
    {
        $documentationPath = Files::concatenatePaths([$this->packageManager->getPackage($packageKey)->getPackagePath(), 'Documentation']);
        $contextVariables = [];
        $contextVariables['packageKey'] = $packageKey;

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/conf.py';
        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
        $targetPathAndFilename = $documentationPath . '/conf.py';
        $this->generateFile($targetPathAndFilename, $fileContent);

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/Makefile';
        $fileContent = file_get_contents($templatePathAndFilename);
        $targetPathAndFilename = $documentationPath . '/Makefile';
        $this->generateFile($targetPathAndFilename, $fileContent);

        $templatePathAndFilename = 'resource://Neos.Kickstarter/Private/Generator/Documentation/index.rst';
        $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
        $targetPathAndFilename = $documentationPath . '/index.rst';
        $this->generateFile($targetPathAndFilename, $fileContent);

        $targetPathAndFilename = $documentationPath . '/_build/.gitignore';
        $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10));
        $targetPathAndFilename = $documentationPath . '/_static/.gitignore';
        $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10));
        $targetPathAndFilename = $documentationPath . '/_templates/.gitignore';
        $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10));

        return $this->generatedFiles;
    }
648171
public function getPackageAssetsWebPath($package_name)
    {
        $package = $this->getPackage($package_name);
        return $this->buildWebPath($package->getAssetsPath());
    }