/**
  * Checks the syntax of the given $packageKey and quits with an error message if it's not valid
  *
  * @param string $packageKey
  * @return void
  */
 protected function validatePackageKey($packageKey)
 {
     if (!$this->packageManager->isPackageKeyValid($packageKey)) {
         $this->outputLine('Package key "%s" is not valid. Only UpperCamelCase with alphanumeric characters in the format <VendorName>.<PackageKey>, please!', array($packageKey));
         exit(1);
     }
 }
 /**
  * Kickstart a new site package
  *
  * This command generates a new site package with basic TypoScript and Sites.xml
  *
  * @param string $packageKey The packageKey for your site
  * @param string $siteName The siteName of your site
  * @return string
  */
 public function siteCommand($packageKey, $siteName)
 {
     if (!$this->packageManager->isPackageKeyValid($packageKey)) {
         $this->outputLine('Package key "%s" is not valid. Only UpperCamelCase in the format "Vendor.PackageKey", please!', array($packageKey));
         $this->quit(1);
     }
     if ($this->packageManager->isPackageAvailable($packageKey)) {
         $this->outputLine('Package "%s" already exists.', array($packageKey));
         $this->quit(1);
     }
     $generatedFiles = $this->generatorService->generateSitePackage($packageKey, $siteName);
     $this->outputLine(implode(PHP_EOL, $generatedFiles));
 }
 /**
  * Kickstart a new site package
  *
  * This command generates a new site package with basic TypoScript and Sites.xml
  *
  * @param string $packageKey The packageKey for your site
  * @param string $siteName The siteName of your site
  * @return string
  */
 public function siteCommand($packageKey, $siteName)
 {
     if (!$this->packageManager->isPackageKeyValid($packageKey)) {
         $this->outputLine('Package key "%s" is not valid. Only UpperCamelCase with alphanumeric characters and underscore, please!', array($packageKey));
         $this->quit(1);
     }
     if ($this->packageManager->isPackageAvailable($packageKey)) {
         $this->outputLine('Package "%s" already exists.', array($packageKey));
         $this->quit(1);
     }
     $generatedFiles = $this->generatorService->generateSitePackage($packageKey, $siteName);
     $this->outputLine(implode(PHP_EOL, $generatedFiles));
 }
 /**
  * Create a new package
  *
  * This command creates a new package which contains only the mandatory
  * directories and files.
  *
  * @Flow\FlushesCaches
  * @param string $packageKey The package key of the package to create
  * @param string $packageType The package type of the package to create
  * @return string
  * @see typo3.kickstart:kickstart:package
  */
 public function createCommand($packageKey, $packageType = PackageInterface::DEFAULT_COMPOSER_TYPE)
 {
     if (!$this->packageManager->isPackageKeyValid($packageKey)) {
         $this->outputLine('The package key "%s" is not valid.', [$packageKey]);
         $this->quit(1);
     }
     if ($this->packageManager->isPackageAvailable($packageKey)) {
         $this->outputLine('The package "%s" already exists.', [$packageKey]);
         $this->quit(1);
     }
     if (!ComposerUtility::isFlowPackageType($packageType)) {
         $this->outputLine('The package must be a Flow package, but "%s" is not a valid Flow package type.', [$packageType]);
         $this->quit(1);
     }
     $package = $this->packageManager->createPackage($packageKey, null, null, null, ['type' => $packageType]);
     $this->outputLine('Created new package "' . $packageKey . '" at "' . $package->getPackagePath() . '".');
 }
 /**
  * Create a new package
  *
  * This command creates a new package which contains only the mandatory
  * directories and files.
  *
  * @Flow\FlushesCaches
  * @param string $packageKey The package key of the package to create
  * @param string $packageType The package type of the package to create
  * @return string
  * @see typo3.kickstart:kickstart:package
  */
 public function createCommand($packageKey, $packageType = 'typo3-flow-package')
 {
     if (!$this->packageManager->isPackageKeyValid($packageKey)) {
         $this->outputLine('The package key "%s" is not valid.', array($packageKey));
         $this->quit(1);
     }
     if ($this->packageManager->isPackageAvailable($packageKey)) {
         $this->outputLine('The package "%s" already exists.', array($packageKey));
         $this->quit(1);
     }
     if (substr($packageType, 0, 11) !== 'typo3-flow-') {
         $this->outputLine('The package must be a Flow package, but "%s" is not a valid Flow package type.', array($packageKey));
         $this->quit(1);
     }
     $package = $this->packageManager->createPackage($packageKey, null, null, $packageType);
     $this->outputLine('Created new package "' . $packageKey . '" at "' . $package->getPackagePath() . '".');
 }