/**
  * Override LibraryInstaller::installCode() to hook in additional post-download steps.
  *
  * @param PackageInterface $package Package instance
  */
 protected function installCode(PackageInterface $package)
 {
     parent::installCode($package);
     if (!$this->supports($package->getType())) {
         return;
     }
     $this->mirrorReleaseItems($package);
     $this->checkGitignore($package);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  *
  * @throws \Exception if the symbolic link fails
  */
 protected function installCode(PackageInterface $package)
 {
     $localPath = $this->getLocalPathForPackage($package);
     if (is_null($localPath)) {
         return parent::installCode($package);
     }
     $this->io->write("  - Symlinking <info>" . $package->getName() . "</info>");
     $this->debug("Symlinking to local path <comment>{$localPath}</comment>");
     $this->initializeVendorSubdir($package);
     if (true !== @symlink($localPath, $this->getInstallPath($package))) {
         throw new \Exception('Symlinking of "' . $localPath . '" failed');
     }
     return true;
 }
Ejemplo n.º 3
0
 protected function installCode(PackageInterface $package)
 {
     parent::installCode($package);
     $isWindows = Platform::isWindows();
     $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
     if (!$isWindows) {
         $php_bin = '/usr/bin/env ' . $php_bin;
     }
     $installPath = $this->getInstallPath($package);
     $vars = array('os' => $isWindows ? 'windows' : 'linux', 'php_bin' => $php_bin, 'pear_php' => $installPath, 'php_dir' => $installPath, 'bin_dir' => $installPath . '/bin', 'data_dir' => $installPath . '/data', 'version' => $package->getPrettyVersion());
     $packageArchive = $this->getInstallPath($package) . '/' . pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
     $pearExtractor = new PearPackageExtractor($packageArchive);
     $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
     $this->io->writeError('    Cleaning up', true, IOInterface::VERBOSE);
     $this->filesystem->unlink($packageArchive);
 }
Ejemplo n.º 4
0
 protected function installCode(PackageInterface $package)
 {
     parent::installCode($package);
     parent::initializeBinDir();
     $isWindows = defined('PHP_WINDOWS_VERSION_BUILD');
     $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
     $installPath = $this->getInstallPath($package);
     $vars = array('os' => $isWindows ? 'windows' : 'linux', 'php_bin' => $php_bin, 'pear_php' => $installPath, 'php_dir' => $installPath, 'bin_dir' => $installPath . '/bin', 'data_dir' => $installPath . '/data', 'version' => $package->getPrettyVersion());
     $packageArchive = $this->getInstallPath($package) . '/' . pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
     $pearExtractor = new PearPackageExtractor($packageArchive);
     $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
     if ($this->io->isVerbose()) {
         $this->io->write('    Cleaning up');
     }
     unlink($packageArchive);
 }
 protected function installCode(PackageInterface $package)
 {
     parent::installCode($package);
     $name = $package->getNames()[0];
     $downloadPath = $this->getInstallPath($package);
     $extra = $this->composer->getPackage()->getExtra();
     if (isset($extra['redistribute']) && isset($extra['redistribute'][$name])) {
         $rules = $extra['redistribute'][$name];
         foreach ($rules as $rule) {
             $basePath = $downloadPath . "/" . $rule['path'];
             if (file_exists($basePath)) {
                 $destinationPath = $downloadPath . "/" . $rule['destination'];
                 rename($basePath, $destinationPath);
             }
         }
     }
 }
 /**
  * {@inheritDoc}
  */
 protected function installCode(PackageInterface $package)
 {
     $installPath = $this->getInstallPath($package);
     $publicPath = $this->getPublicPath();
     $local = $this->getLocalRepositoryPath();
     $installed = false;
     if ($local !== null) {
         $path = $local . DIRECTORY_SEPARATOR . $package->getName();
         if (!$this->filesystem->isAbsolutePath($path)) {
             $path = $this->filesystem->normalizePath(getcwd() . '/' . $path);
         }
         if (file_exists($path)) {
             try {
                 $this->symlink($path, $installPath);
                 $installed = true;
             } catch (\Exception $e) {
                 $installed = false;
             }
         }
     }
     if (!$installed) {
         parent::installCode($package);
     }
     // symlink package public folder to keeko's public folder
     $type = $package->getType();
     if ($type !== 'keeko-core') {
         $packagePublicPath = $this->filesystem->normalizePath($installPath . '/public');
         if (!$this->filesystem->isAbsolutePath($packagePublicPath)) {
             $packagePublicPath = $this->filesystem->normalizePath(getcwd() . '/' . $packagePublicPath);
         }
         if (file_exists($packagePublicPath) && file_exists($publicPath)) {
             $target = $this->filesystem->normalizePath($publicPath . '/' . $this->getPackageDir($type) . '/' . $package->getName());
             $this->filesystem->ensureDirectoryExists(dirname($target));
             $this->symlink($packagePublicPath, $target);
         }
     }
 }
Ejemplo n.º 7
0
 /**
  * {@inheritDoc}
  */
 protected function installCode(PackageInterface $package)
 {
     parent::installCode($package);
     $this->deleteIgnoredFiles($package);
 }
Ejemplo n.º 8
0
 /**
  * {@inheritDoc}
  *
  * @throws \ComposerSymlinker\FilesystemSymlinkerException if the symbolic link fails
  *
  * @link    https://github.com/symfony/Filesystem/blob/master/Filesystem.php#L310
  */
 protected function installCode(PackageInterface $package)
 {
     $local_path = $this->getLocalPackagePath($package);
     if (!is_null($local_path)) {
         $this->io->write("  - Installing <info>" . $package->getName() . "</info> (<comment>as a symbolic link of " . $local_path . "</comment>)");
         $this->initializeVendorSubdir($package);
         if (true !== @symlink($local_path, $this->getInstallPath($package))) {
             throw new FilesystemSymlinkerException(sprintf('Symlink fails: "%s" => "%s"', $local_path, $this->getInstallPath($package)));
         }
         return true;
     }
     return parent::installCode($package);
 }
Ejemplo n.º 9
0
 /**
  * Before installing the Component, be sure its destination is clear first.
  *
  * @param PackageInterface $package
  */
 public function installCode(PackageInterface $package)
 {
     $this->removeComponent($package);
     parent::installCode($package);
 }
Ejemplo n.º 10
0
 /**
  * {@inheritdoc}
  */
 public function installCode(PackageInterface $package)
 {
     $map = $this->mapSources($package);
     parent::installCode($package);
     $this->updateSources($map, $package);
     $this->updateUserfiles($package);
     $this->updateRootFiles($package);
     $root = $this->plugin->getContaoRoot($this->composer->getPackage()) . DIRECTORY_SEPARATOR;
     $installPath = self::unprefixPath($root, $this->getInstallPath($package));
     RunonceManager::addRunonces($package, $installPath);
 }
 protected function installCode(PackageInterface $package)
 {
     if (!is_readable($this->getInstallPath($package))) {
         parent::installCode($package);
     }
 }
Ejemplo n.º 12
0
 /**
  * {@inheritdoc}
  */
 protected function installCode(PackageInterface $package)
 {
     $package = AssetPlugin::addMainFiles($this->composer, $package);
     parent::installCode($package);
     $this->deleteIgnoredFiles($package);
 }
Ejemplo n.º 13
0
 public function installCode(PackageInterface $package)
 {
     list($config_file, $contents) = $this->preCodeUpdate($package);
     parent::installCode($package);
     $this->postCodeUpdate($config_file, $contents);
 }
Ejemplo n.º 14
0
 /**
  * {@inheritDoc}
  */
 protected function installCode(PackageInterface $package)
 {
     parent::installCode($package);
     $this->postInstallActions($package, $this->getInstallPath($package));
 }
 public function installCode(PackageInterface $package)
 {
     $map = $this->mapSources($package);
     parent::installCode($package);
     $this->updateSources($map, $package);
     $this->updateUserfiles($package);
     $this->updateRunonce($package);
 }
 /**
  * {@inheritDoc}
  */
 protected function installCode(PackageInterface $package)
 {
     parent::installCode($package);
     $this->installLoader($package);
 }
 /**
  * {@inheritDoc}
  *
  * @throws \ComposerSymlinker\FilesystemSymlinkerException if the symbolic link fails
  *
  * @link    https://github.com/symfony/Filesystem/blob/master/Filesystem.php#L310
  */
 protected function installCode(PackageInterface $package)
 {
     $localPath = $this->getLocalPackagePath($package);
     if (is_null($localPath)) {
         return parent::installCode($package);
     }
     $this->io->write(sprintf('  - Installing <info>%s</info> (<comment>as a symbolic link of %s</comment>)', $package->getName(), $localPath));
     $this->initializeVendorSubdir($package);
     $installPath = $this->getInstallPath($package);
     $shortestPath = $this->filesystem->findShortestPath($installPath, $localPath, false);
     if (true !== @symlink($shortestPath, $this->getInstallPath($package))) {
         throw new FilesystemSymlinkerException(sprintf('Symlinking failed: %s -> %s', $localPath, $this->getInstallPath($package)));
     }
     return true;
 }