public function testGetRootPackageNameReturnsNullIfNoRootPackage()
 {
     $packageFile = new PackageFile('vendor/package');
     $package = new Package($packageFile, '/path');
     $this->collection->add($package);
     $this->assertNull($this->collection->getRootPackageName());
 }
 /**
  * Handles the "puli type --delete" command.
  *
  * @param Args $args The console arguments.
  *
  * @return int The status code.
  */
 public function handleDelete(Args $args)
 {
     $typeName = $args->getArgument('name');
     if (!$this->discoveryManager->hasRootTypeDescriptor($typeName)) {
         throw new RuntimeException(sprintf('The type "%s" does not exist in the package "%s".', $typeName, $this->packages->getRootPackageName()));
     }
     $this->discoveryManager->removeRootTypeDescriptor($typeName);
     return 0;
 }
 /**
  * Handles the "bind --delete" command.
  *
  * @param Args $args The console arguments.
  *
  * @return int The status code.
  */
 public function handleDelete(Args $args)
 {
     $bindingToRemove = $this->getBindingByUuidPrefix($args->getArgument('uuid'));
     if (!$bindingToRemove->getContainingPackage() instanceof RootPackage) {
         throw new RuntimeException(sprintf('Can only delete bindings from the package "%s".', $this->packages->getRootPackageName()));
     }
     $this->discoveryManager->removeRootBindingDescriptor($bindingToRemove->getUuid());
     return 0;
 }
Exemple #4
0
 /**
  * Handles the "puli map --delete" command.
  *
  * @param Args $args The console arguments.
  *
  * @return int The status code.
  */
 public function handleDelete(Args $args)
 {
     $repositoryPath = Path::makeAbsolute($args->getArgument('path'), $this->currentPath);
     if (!$this->repoManager->hasRootPathMapping($repositoryPath)) {
         throw new RuntimeException(sprintf('The path "%s" is not mapped in the package "%s".', $repositoryPath, $this->packages->getRootPackageName()));
     }
     $this->repoManager->removeRootPathMapping($repositoryPath);
     return 0;
 }