/**
  * @param InstalledRepositoryInterface $repo
  * @param PackageInterface             $package
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if ($package->isDev()) {
         $this->symlinkInstaller->install($repo, $package);
     } else {
         $this->defaultInstaller->install($repo, $package);
     }
 }
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $pluginName = self::assertBarberryPlugin($package);
     parent::install($repo, $package);
     $this->registerAutoloader($package);
     $this->installPlugin($package, $pluginName);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     $path = $this->getInstallPath($package);
     $ns = $this->primaryNamespace($package);
     $this->updateConfig($ns, $path);
 }
Ejemplo n.º 4
0
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $this->rcubeVersionCheck($package);
     parent::install($repo, $package);
     // post-install: activate plugin in Roundcube config
     $config_file = $this->rcubeConfigFile();
     $extra = $package->getExtra();
     $plugin_name = $this->getPluginName($package);
     if (is_writeable($config_file) && php_sapi_name() == 'cli') {
         $answer = $this->io->askConfirmation("Do you want to activate the plugin {$plugin_name}? [N|y] ", false);
         if (true === $answer) {
             $this->rcubeAlterConfig($plugin_name, true);
         }
     }
     // initialize database schema
     if (!empty($extra['roundcube']['sql-dir'])) {
         if ($sqldir = realpath($this->getVendorDir() . "/{$plugin_name}/" . $extra['roundcube']['sql-dir'])) {
             system(getcwd() . "/vendor/bin/rcubeinitdb.sh --package={$plugin_name} --dir={$sqldir}");
         }
     }
     // run post-install script
     if (!empty($extra['roundcube']['post-install-script'])) {
         $this->rcubeRunScript($extra['roundcube']['post-install-script'], $package);
     }
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if ($this->isInstallFromSpressRoot() && self::TYPE_PLUGIN === $package->getType()) {
         return;
     }
     parent::install($repo, $package);
 }
 /**
  * Installs specific package.
  *
  * @param  InstalledRepositoryInterface $repo    repository in which to check
  * @param  PackageInterface             $package package instance
  * @throws InvalidArgumentException
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (substr($package->getPrettyName(), -strlen('-component')) !== '-component') {
         throw new \InvalidArgumentException('The name of any package typed `nooku-component` must be formatted as `vendor/name-component`. Aborting.');
     }
     parent::install($repo, $package);
     $this->_installAutoloader($package);
 }
Ejemplo n.º 7
0
 /**
  * Installs specific package.
  *
  * @param InstalledRepositoryInterface $repo repository in which to check
  * @param PackageInterface $package package instance
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $extra = $package->getExtra();
     if (array_key_exists('pxb-config', $extra)) {
         $this->loadModule($package, $extra['pxb-config']);
     }
     parent::install($repo, $package);
 }
Ejemplo n.º 8
0
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $extra = $package->getExtra();
     if (empty($extra['class'])) {
         throw new \UnexpectedValueException('Error while installing ' . $package->getPrettyName() . ', composer-plugin packages should have a class defined in their extra key to be usable.');
     }
     parent::install($repo, $package);
     $this->composer->getPluginManager()->registerPackage($package, true);
 }
 /**
  * Add symlinks for Contao sources after installing a package.
  *
  * {@inheritdoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $this->logVerbose(sprintf('Installing Contao sources for %s', $package->getName()));
     parent::install($repo, $package);
     $this->addSymlinks($package, $this->getContaoRoot(), $this->getSources($package));
     $this->addCopies($package, $this->getFilesRoot(), $this->getUserFiles($package), self::DUPLICATE_IGNORE);
     $this->addRunonces($package, $this->getRunonces($package));
     $this->logVerbose('');
 }
Ejemplo n.º 10
0
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     if (is_null($this->package_installer)) {
         $this->io->write('<error>PackageInstaller not ready or missing configuration: package could not be installed.</error>');
     } else {
         $this->packageInstall($package);
     }
 }
Ejemplo n.º 11
0
 /**
  * {@inheritDoc}
  */
 public function install(PackageInterface $package)
 {
     $extra = $package->getExtra();
     if (empty($extra['class'])) {
         throw new \UnexpectedValueException('Error while installing ' . $package->getPrettyName() . ', composer-installer packages should have a class defined in their extra key to be usable.');
     }
     parent::install($package);
     $this->registerInstaller($package);
 }
 /**
  * @param InstalledRepositoryInterface $repo
  * @param PackageInterface             $package
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!is_readable($this->getInstallPath($package))) {
         parent::install($repo, $package);
     } elseif (!$repo->hasPackage($package)) {
         $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
         $repo->addPackage(clone $package);
     }
     $this->createPackageVendorSymlink($package);
     $this->packageDataManager->addPackageUsage($package);
 }
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $this->initGingerBackend();
     $extra = $package->getExtra();
     if (!isset($extra['plugin-namespace'])) {
         throw new Exception\RuntimeException(sprintf('Missing the key -plugin-namespace- in the -extra- property of the plugin -%s- composer.json.', $package->getName()));
     }
     parent::install($repo, $package);
     $pluginInstalledEvent = new Cqrs\PluginInstalledEvent(array('plugin_name' => $package->getName(), 'plugin_type' => $package->getType(), 'plugin_version' => $package->getVersion(), 'plugin_namespace' => $extra['plugin-namespace']));
     $this->getServiceManager()->get('malocher.cqrs.gate')->getBus()->publishEvent($pluginInstalledEvent);
 }
Ejemplo n.º 14
0
 /**
  * @inheritdoc
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     // install the package the normal composer way
     parent::install($repo, $package);
     // add the package to yiisoft/extensions.php
     $this->addPackage($package);
     // ensure the yii2-dev package also provides Yii.php in the same place as yii2 does
     if ($package->getName() == 'yiisoft/yii2-dev') {
         $this->linkBaseYiiFiles();
     }
 }
Ejemplo n.º 15
0
 /**
  * @depends testInstallerCreationShouldNotCreateVendorDirectory
  * @depends testInstallerCreationShouldNotCreateBinDirectory
  */
 public function testInstall()
 {
     $library = new LibraryInstaller($this->vendorDir, $this->binDir, $this->dm, $this->repository, $this->io);
     $package = $this->createPackageMock();
     $package->expects($this->once())->method('getPrettyName')->will($this->returnValue('some/package'));
     $this->dm->expects($this->once())->method('download')->with($package, $this->vendorDir . '/some/package');
     $this->repository->expects($this->once())->method('addPackage')->with($package);
     $library->install($package);
     $this->assertFileExists($this->vendorDir, 'Vendor dir should be created');
     $this->assertFileExists($this->binDir, 'Bin dir should be created');
 }
Ejemplo n.º 16
0
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     $extra = $package->getExtra();
     if (isset($extra['module'])) {
         $data = array('modules' => array($extra['module'] => array('active' => 'true', 'codePool' => 'community')));
         $xml = new SimpleXMLElement('<config/>');
         array_walk_recursive($data, array($xml, 'addChild'));
         file_put_contents('app/etc/modules/' . $extra['module'] . '.xml', $xml->asXML());
     }
 }
 /**
  * @param InstalledRepositoryInterface $repository
  * @param PackageInterface             $package
  *
  * @return array
  */
 public function install(InstalledRepositoryInterface $repository, PackageInterface $package)
 {
     $hooks = [];
     $extra = $package->getExtra();
     if (isset($extra["hooks"])) {
         $hooks = $extra["hooks"];
     }
     foreach ($hooks as $hook) {
         $this->addHook($hook);
     }
     parent::install($repository, $package);
 }
 /**
  * Perform the install steps
  *
  * @param InstalledRepositoryInterface $repository
  * @param PackageInterface $package
  */
 public function install(InstalledRepositoryInterface $repository, PackageInterface $package)
 {
     parent::install($repository, $package);
     //Copy the console and AppBoot files
     $rootDir = dirname($this->vendorDir);
     $appDir = $rootDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR;
     if (false === is_dir($appDir)) {
         mkdir($appDir);
     }
     $installDir = $this->getInstallPath($package);
     $installAppDir = $installDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR;
     copy($installAppDir . 'console', $appDir . 'console');
     copy($installAppDir . 'AppBoot.php', $appDir . 'AppBoot.php');
     chmod($appDir . 'console', 0755);
 }
Ejemplo n.º 19
0
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     if ($this->shouldInstallAssets($package)) {
         $assetsPath = $this->getAssetsPath($package);
         $package_name = $package->getPrettyName();
         if ($this->shouldCreateAssetsDest($package_name)) {
             if (!$this->createAssetsDest($package_name)) {
                 throw new \Exception('Could not create assets destination.');
             }
         }
         $this->installCssAssets($assetsPath, $package_name);
         $this->installJavaScriptAssets($assetsPath, $package_name);
     }
 }
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if (!$this->_isValidName($package->getPrettyName())) {
         throw new \InvalidArgumentException('Invalid package name `' . $package->getPrettyName() . '`. ' . 'Name should be of the format `vendor/xyz_name`, where xyz is a valid Joomla extension type (' . implode(', ', $this->_package_prefixes) . ').');
     }
     parent::install($repo, $package);
     if (!$this->_application->install($this->getInstallPath($package))) {
         // Get all error messages that were stored in the message queue
         $descriptions = $this->_getApplicationMessages();
         $error = 'Error while installing ' . $package->getPrettyName();
         if (count($descriptions)) {
             $error .= ':' . PHP_EOL . implode(PHP_EOL, $descriptions);
         }
         throw new \RuntimeException($error);
     }
 }
Ejemplo n.º 21
0
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $extra = $package->getExtra();
     if (empty($extra['class'])) {
         throw new \UnexpectedValueException('Error while installing ' . $package->getPrettyName() . ', composer-plugin packages should have a class defined in their extra key to be usable.');
     }
     parent::install($repo, $package);
     try {
         $this->composer->getPluginManager()->registerPackage($package, true);
     } catch (\Exception $e) {
         // Rollback installation
         $this->io->writeError('Plugin installation failed, rolling back');
         parent::uninstall($repo, $package);
         throw $e;
     }
 }
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     $vagrantfile = $this->getInstallPath($package) . '/Vagrantfile';
     if (!file_exists($vagrantfile)) {
         throw new \RuntimeException("\nCouldn't find package's Vagrantfile.");
     }
     if (!($cwd = getcwd())) {
         throw new \RuntimeException("\nCan't access cwd.");
     }
     $template = dirname(dirname(dirname(dirname(__FILE__)))) . '/Vagrantfile';
     $template = file_get_contents($template);
     $template = str_replace("# VAGRANTFILE = ", "VAGRANTFILE = \"{$vagrantfile}\"", $template);
     if (false === file_put_contents($cwd . "/Vagrantfile", $template)) {
         throw new \RuntimeException("\nCouldn't write to Vagrantfile in project root.");
     }
 }
Ejemplo n.º 23
0
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     $binDir = rtrim($this->composer->getConfig()->get('bin-dir'), '/');
     $this->filesystem->ensureDirectoryExists($binDir);
     $packageExtra = $package->getExtra();
     $phars = glob($this->getInstallPath($package) . '/*.phar');
     $pathToPhar = realpath(reset($phars));
     if (isset($packageExtra['bin-name'])) {
         $link = $binDir . '/' . $packageExtra['bin-name'];
     } else {
         $link = $binDir . '/' . basename($pathToPhar);
     }
     $relativeBin = $this->filesystem->findShortestPath($link, $pathToPhar);
     if (false === symlink($relativeBin, $link)) {
         throw new \ErrorException();
     }
     @chmod($link, 0777 & ~umask());
 }
Ejemplo n.º 24
0
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $installedModules = $this->getInstalledModules();
     $filePath = $this->getConfigFilePath();
     // Get package information
     $name = $package->getPrettyName();
     $autoload = $package->getAutoload();
     // Check if psr-4 key exists
     if (array_key_exists('psr-4', $autoload)) {
         $module = array('name' => $name, 'namespaces' => array_keys($autoload['psr-4']));
         // Add package to modules list
         array_push($installedModules, $module);
         // Remove duplicated entries
         $installedModules = array_unique($installedModules, SORT_REGULAR);
         // Write to file
         $prettyJson = json_encode($installedModules, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
         file_put_contents($filePath, $prettyJson);
     }
     // Add package to project
     parent::install($repo, $package);
 }
Ejemplo n.º 25
0
 /**
  * Install the package.
  *
  * @since 0.1.0
  *
  * @param InstalledRepositoryInterface $repo    The repository from where the package was fetched.
  * @param PackageInterface             $package The package to install.
  *
  * @throws InvalidArgumentException If the package name does not match the required pattern.
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $path = $this->getInstallPath($package);
     if ($this->io->isVerbose()) {
         $this->io->write(sprintf(_('Symlinking PHP Composter action %1$s'), $path), true);
     }
     parent::install($repo, $package);
     foreach ($this->getHooks($package) as $prioritizedHook => $method) {
         $array = explode('.', $prioritizedHook);
         if (count($array) > 1) {
             list($priority, $hook) = $array;
         } else {
             $hook = $array[0];
             $priority = 10;
         }
         if ($this->io->isVeryVerbose()) {
             $this->io->write(sprintf(_('Adding method "%1$s" to hook "%2$s" with priority %3$s'), $method, $hook, $priority), true);
         }
         HookConfig::addEntry($hook, $method, $priority);
     }
 }
Ejemplo n.º 26
0
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     // install files
     if (!parent::isInstalled($repo, $package)) {
         parent::install($repo, $package);
     }
     // parse config xml
     $dir = $this->composer->getConfig()->get('vendor-dir');
     $config = $dir . '/' . $package->getName() . '/config.xml';
     if (is_file($config)) {
         // make service autoloadable
         $classLoader = $this->getClassLoader($package);
         $classLoader->register();
         try {
             // create service
             $hm = $this->container->get('handlerManager');
             $handler = $hm->getHandler('AmunService\\Core\\Service');
             $record = $handler->getRecord();
             if ($package->getInstallationSource() == 'source') {
                 $source = $package->getSourceUrl();
             } else {
                 if ($package->getInstallationSource() == 'dist') {
                     $source = $package->getDistUrl();
                 }
             }
             $record->setSource($source);
             $record->setAutoloadPath($this->getAutoloadPath($package, $config));
             $record->setConfig($config);
             $record->setName($package->getPrettyName());
             $record->setLink($package->getHomepage());
             $record->setLicense(implode(', ', $package->getLicense()));
             $record->setVersion($package->getPrettyVersion());
             $handler->create($record);
         } catch (\Exception $e) {
             $this->container->get('logger')->error($e->getMessage());
         }
         $classLoader->unregister();
     }
 }
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     $this->createSaltSeed();
     $this->createWpConfig();
 }
 /**
  * {@inheritDoc}
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     $this->installAssets($package);
 }
Ejemplo n.º 29
0
 /**
  * Installs specific package
  *
  * @param InstalledRepositoryInterface $repo    repository in which to check
  * @param PackageInterface             $package package instance
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     if ($package->getType() === 'magento-core' && !$this->preInstallMagentoCore()) {
         return;
     }
     parent::install($repo, $package);
     // skip marshal and apply default behavior if extra->map does not exist
     if (!$this->hasExtraMap($package)) {
         return;
     }
     $strategy = $this->getDeployStrategy($package);
     $strategy->setMappings($this->getParser($package)->getMappings());
     $deployManagerEntry = new Entry();
     $deployManagerEntry->setPackageName($package->getName());
     $deployManagerEntry->setDeployStrategy($strategy);
     $this->deployManager->addPackage($deployManagerEntry);
     if ($this->appendGitIgnore) {
         $this->appendGitIgnore($package, $this->getGitIgnoreFileLocation());
     }
 }
 /**
  * Installs specific package.
  *
  * @param InstalledRepositoryInterface $repo repository in which to check
  * @param PackageInterface $package package instance
  */
 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     parent::install($repo, $package);
     $path = $this->getInstallPath($package);
     $this->addExtension($path, $package);
 }