Exemple #1
0
 /**
  * Saves a root module file.
  *
  * The module file is saved to the same path that it was read from.
  *
  * @param RootModuleFile $moduleFile The module file to save.
  *
  * @throws WriteException         If the file cannot be written.
  * @throws InvalidConfigException If the file contains invalid configuration.
  */
 public function saveRootModuleFile(RootModuleFile $moduleFile)
 {
     $this->saveFile($moduleFile, $moduleFile->getPath(), array('targetVersion' => $moduleFile->getVersion()));
     if ($this->factoryManager) {
         $this->factoryManager->autoGenerateFactoryClass();
     }
 }
 /**
  * Saves a configuration file.
  *
  * The configuration file is saved to the same path that it was read from.
  *
  * @param ConfigFile $configFile The configuration file to save.
  *
  * @throws IOException If the file cannot be written.
  */
 public function saveConfigFile(ConfigFile $configFile)
 {
     $this->writer->writeConfigFile($configFile, $configFile->getPath());
     if ($this->factoryManager) {
         $this->factoryManager->autoGenerateFactoryClass();
     }
 }
 /**
  * Saves a root package file.
  *
  * The package file is saved to the same path that it was read from.
  *
  * @param RootPackageFile $packageFile The package file to save.
  *
  * @throws IOException If the file cannot be written.
  */
 public function saveRootPackageFile(RootPackageFile $packageFile)
 {
     $this->writer->writePackageFile($packageFile, $packageFile->getPath());
     if ($this->factoryManager) {
         $this->factoryManager->autoGenerateFactoryClass();
     }
 }
 /**
  * Saves a root package file.
  *
  * The package file is saved to the same path that it was read from.
  *
  * @param RootPackageFile $packageFile The package file to save.
  *
  * @throws StorageException If the file cannot be written.
  */
 public function saveRootPackageFile(RootPackageFile $packageFile)
 {
     $serialized = $this->serializer->serializeRootPackageFile($packageFile);
     $this->storage->write($packageFile->getPath(), $serialized);
     if ($this->factoryManager) {
         $this->factoryManager->autoGenerateFactoryClass();
     }
 }
Exemple #5
0
 /**
  * Saves a configuration file.
  *
  * The configuration file is saved to the same path that it was read from.
  *
  * @param ConfigFile $configFile The configuration file to save.
  *
  * @throws StorageException If the file cannot be written.
  */
 public function saveConfigFile(ConfigFile $configFile)
 {
     $serialized = $this->serializer->serializeConfigFile($configFile);
     $this->storage->write($configFile->getPath(), $serialized);
     if ($this->factoryManager) {
         $this->factoryManager->autoGenerateFactoryClass();
     }
 }
Exemple #6
0
 /**
  * Handles the "build" command.
  *
  * @param Args $args The console arguments.
  *
  * @return int The status code.
  */
 public function handle(Args $args)
 {
     $target = $args->getArgument('target');
     if (!in_array($target, self::$targets)) {
         throw new RuntimeException(sprintf('Invalid build target "%s". Expected one of: "%s"', $target, implode('", "', self::$targets)));
     }
     if ('all' === $target || 'factory' === $target) {
         $this->factoryManager->autoGenerateFactoryClass();
     }
     if ('all' === $target || 'repository' === $target) {
         $this->repoManager->clearRepository();
         $this->repoManager->buildRepository();
     }
     if ('all' === $target || 'discovery' === $target) {
         $this->discoveryManager->clearDiscovery();
         $this->discoveryManager->buildDiscovery();
     }
     return 0;
 }
 /**
  * Saves a configuration file.
  *
  * The configuration file is saved to the same path that it was read from.
  *
  * @param ConfigFile $configFile The configuration file to save.
  *
  * @throws WriteException         If the file cannot be written.
  * @throws InvalidConfigException If the file contains invalid configuration.
  */
 public function saveConfigFile(ConfigFile $configFile)
 {
     try {
         $jsonData = $this->configFileConverter->toJson($configFile);
     } catch (ConversionFailedException $e) {
         throw new InvalidConfigException(sprintf('The data written to %s could not be converted: %s', $configFile->getPath(), $e->getMessage()), 0, $e);
     }
     $json = $this->encode($jsonData, $configFile->getPath());
     $this->storage->write($configFile->getPath(), $json);
     if ($this->factoryManager) {
         $this->factoryManager->autoGenerateFactoryClass();
     }
 }