/**
  * Loads the module repository for a given project.
  *
  * @param ProjectContext    $context           The project context.
  * @param ModuleFileStorage $moduleFileStorage The module file storage.
  *
  * @throws FileNotFoundException  If the install path of a module not exist.
  * @throws NoDirectoryException   If the install path of a module points to a file.
  * @throws InvalidConfigException If a configuration file contains invalid configuration.
  * @throws NameConflictException  If a module has the same name as another loaded module.
  */
 public function __construct(ProjectContext $context, ModuleFileStorage $moduleFileStorage)
 {
     $this->context = $context;
     $this->rootDir = $context->getRootDirectory();
     $this->rootModuleFile = $context->getRootModuleFile();
     $this->moduleFileStorage = $moduleFileStorage;
 }
Beispiel #2
0
 public function testCreateCanonicalizesRootDirectory()
 {
     $config = new Config();
     $rootPackageFile = new RootPackageFile();
     $context = new ProjectContext(null, __DIR__ . '/../Context', $config, $rootPackageFile);
     $this->assertSame(__DIR__, $context->getRootDirectory());
 }
 /**
  * Loads the package repository for a given project.
  *
  * @param ProjectContext     $context            The project context.
  * @param PackageFileStorage $packageFileStorage The package file storage.
  *
  * @throws FileNotFoundException  If the install path of a package not exist.
  * @throws NoDirectoryException   If the install path of a package points to a file.
  * @throws InvalidConfigException If a configuration file contains invalid configuration.
  * @throws NameConflictException  If a package has the same name as another loaded package.
  */
 public function __construct(ProjectContext $context, PackageFileStorage $packageFileStorage)
 {
     $this->context = $context;
     $this->rootDir = $context->getRootDirectory();
     $this->rootPackageFile = $context->getRootPackageFile();
     $this->packageFileStorage = $packageFileStorage;
 }
 /**
  * Creates a new factory generator.
  *
  * @param ProjectContext        $context           The project context.
  * @param GeneratorRegistry     $generatorRegistry The registry providing
  *                                                 the generators for the
  *                                                 services returned by the
  *                                                 factory.
  * @param ClassWriter           $classWriter       The writer that writes
  *                                                 the class to a file.
  * @param ServerCollection|null $servers           The configured servers.
  */
 public function __construct(ProjectContext $context, GeneratorRegistry $generatorRegistry, ClassWriter $classWriter, ServerCollection $servers = null)
 {
     $this->context = $context;
     $this->config = $context->getConfig();
     $this->rootDir = $context->getRootDirectory();
     $this->generatorRegistry = $generatorRegistry;
     $this->classWriter = $classWriter;
     $this->servers = $servers;
 }
 /**
  * {@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;
 }
Beispiel #6
0
 /**
  * Creates a repository manager.
  *
  * @param ProjectContext     $context
  * @param EditableRepository $repo
  * @param ModuleList         $modules
  * @param JsonStorage        $jsonStorage
  */
 public function __construct(ProjectContext $context, EditableRepository $repo, ModuleList $modules, JsonStorage $jsonStorage)
 {
     $this->context = $context;
     $this->dispatcher = $context->getEventDispatcher();
     $this->repo = $repo;
     $this->config = $context->getConfig();
     $this->rootDir = $context->getRootDirectory();
     $this->rootModule = $modules->getRootModule();
     $this->rootModuleFile = $context->getRootModuleFile();
     $this->modules = $modules;
     $this->jsonStorage = $jsonStorage;
 }
 /**
  * Creates a repository manager.
  *
  * @param ProjectContext     $context
  * @param EditableRepository $repo
  * @param PackageCollection  $packages
  * @param PackageFileStorage $packageFileStorage
  */
 public function __construct(ProjectContext $context, EditableRepository $repo, PackageCollection $packages, PackageFileStorage $packageFileStorage)
 {
     $this->context = $context;
     $this->dispatcher = $context->getEventDispatcher();
     $this->repo = $repo;
     $this->config = $context->getConfig();
     $this->rootDir = $context->getRootDirectory();
     $this->rootPackage = $packages->getRootPackage();
     $this->rootPackageFile = $context->getRootPackageFile();
     $this->packages = $packages;
     $this->packageFileStorage = $packageFileStorage;
 }