Exemplo n.º 1
0
 public function handleDelete(Args $args)
 {
     $installerName = $args->getArgument('name');
     if (!$this->installerManager->hasInstallerDescriptor($installerName)) {
         throw new RuntimeException(sprintf('The installer "%s" does not exist.', $installerName));
     }
     $this->installerManager->removeRootInstallerDescriptor($installerName);
     return 0;
 }
 /**
  * {@inheritdoc}
  */
 public function addServer(Server $server)
 {
     $this->assertServersLoaded();
     if (!$this->installerManager->hasInstallerDescriptor($server->getInstallerName())) {
         throw NoSuchInstallerException::forInstallerName($server->getInstallerName());
     }
     $previousServers = $this->servers->toArray();
     $previousData = $this->serversData;
     $this->servers->add($server);
     $this->serversData[$server->getName()] = $this->serverToData($server);
     try {
         $this->persistServersData();
     } catch (Exception $e) {
         $this->servers->replace($previousServers);
         $this->serversData = $previousData;
         throw $e;
     }
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function prepareInstallation(AssetMapping $mapping)
 {
     $glob = $mapping->getGlob();
     $serverName = $mapping->getServerName();
     $resources = $this->repo->find($glob);
     if ($resources->isEmpty()) {
         throw NotInstallableException::noResourceMatches($glob);
     }
     if (!$this->servers->contains($serverName)) {
         throw NotInstallableException::serverNotFound($serverName);
     }
     $server = $this->servers->get($serverName);
     $installerName = $server->getInstallerName();
     if (!$this->installerManager->hasInstallerDescriptor($installerName)) {
         throw NotInstallableException::installerNotFound($installerName);
     }
     $installerDescriptor = $this->installerManager->getInstallerDescriptor($installerName);
     $installer = $this->loadInstaller($installerDescriptor);
     $rootDir = $this->context->getRootDirectory();
     $params = new InstallationParams($installer, $installerDescriptor, $resources, $mapping, $server, $rootDir);
     $installer->validateParams($params);
     return $params;
 }