/**
  * Operating system dependend installation of CasperJS
  */
 public static function install(Event $event)
 {
     //Install PhantomJs before CasperJs
     \PhantomInstaller\Installer::installPhantomJS($event);
     $composer = $event->getComposer();
     $version = self::getVersion($composer);
     $url = self::getURL($version);
     $binDir = $composer->getConfig()->get('bin-dir');
     // the installation folder depends on the vendor-dir (default prefix is './vendor')
     $targetDir = $composer->getConfig()->get('vendor-dir') . self::CASPERJS_TARGETDIR;
     // Create Composer In-Memory Package
     $versionParser = new VersionParser();
     $normVersion = $versionParser->normalize($version);
     $package = new Package(self::CASPERJS_NAME, $normVersion, $version);
     $package->setTargetDir($targetDir);
     $package->setInstallationSource('dist');
     $package->setDistType('zip');
     $package->setDistUrl($url);
     // Download the Archive
     $downloadManager = $composer->getDownloadManager();
     $downloadManager->download($package, $targetDir, false);
     // Create CasperJS launcher in the "bin" folder
     self::createCasperJsBinaryToBinFolder($targetDir, $binDir);
 }
Exemplo n.º 2
0
 /**
  * Post install/update script
  *
  * @param \Composer\Script\Event $event
  */
 public static function install(Event $event)
 {
     InstallerPhantomJS::installPhantomJS($event);
     self::installCasperJs($event);
 }