/** * Iterate over linked packages and allow you to revert them */ public function unlink() { $this->composerSymInit(); $log = $this->core->getComposerSymLog($this->projectDir); printf("\n> Starting to process linked packages.\n"); UnlinkWorker::run($log); $log->writeLog(); }
/** * @param ComposerSymLog $log * @param ComposerSym $composerSym * @param ComposerSymCore $core * @param string $package * * @throws \Garoevans\ComposerSym\Exception\ComposerSymException */ private static function runSymLink(ComposerSymLog $log, ComposerSym $composerSym, ComposerSymCore $core, $package) { $potentialLocation = $core->getPotentialLinkLocation($package, $composerSym->homeDir); if (strlen($potentialLocation) === 0) { $linkTo = $core->getLinkLocation($package); } else { $linkTo = $potentialLocation; } // Move the existing package to a new temporary directory and symlink // to the local copy $tempLocation = build_path($composerSym->projectDir, $composerSym->vendor, $core->getTemporaryPackageName($package)); $packageLocation = self::getPackageLocation($composerSym, $package); rename($packageLocation, $tempLocation); if (!symlink($linkTo, $packageLocation)) { rename($tempLocation, $packageLocation); throw new ComposerSymException("Failed creating sym link, this could be a privileges issue. Try" . "running the console with raised privileges."); } printf("> %s symlinked:\n", $package); printf(">> link: %s\n", $packageLocation); printf(">> target: %s\n", $linkTo); $log->addPackage($package, $packageLocation, $tempLocation); unset($linkTo); echo "\n"; }
public function testGetTemporaryPackageName() { $package = "foo/bar"; $composerSymCore = new ComposerSymCore(); $this->assertEquals("foo/___bar", $composerSymCore->getTemporaryPackageName($package)); }