/** * @inheritdoc */ public function execute(Context $context) { // check if we have current release so we can run the tasks if ($this->currentReleaseExists($context)) { $this->executeTasks($context); } // finally remove the whole release folder $this->transporter->remove($this->transporter->getPath()); }
/** * Symlinks the shared locations * * @param Context $context */ protected function symlinkSharedFilesAndFolders(Context $context) { $basepath = $this->transporter->getPath(); $sharedPath = $basepath . '/shared'; $uploadPath = $basepath . '/' . $this->getUploadPath($context->getVersion()); $shared = (array) $this->options['shared']; // add some white space to the output if (count($shared) > 0) { $this->io->write(''); } foreach ($shared as $fileOrFolder) { $sharedFilepath = $sharedPath . '/' . $fileOrFolder; $uploadFilepath = $uploadPath . '/' . $fileOrFolder; // make sure the symlink destination doesn't exist if (true === $this->transporter->exists($uploadFilepath)) { // Ok, it exists, but it's a symlink... let's assume that it was created // in an earlier deploy with conveyor if (true === $this->transporter->isSymlink($uploadFilepath)) { continue; } $answer = $this->io->askConfirmation(sprintf('<error>Warning</error> Shared file/folder <info>%s</info> already exists, do you want to overwrite it? (n/Y): ', $uploadFilepath), false); if ($answer) { $this->transporter->remove($uploadFilepath, true); } else { continue; } } $this->transporter->symlink($sharedFilepath, $uploadFilepath); } }
public function testRemoveDispatchesEvent() { $this->getDispatcherMock()->expects($this->once())->method('dispatch')->with(TransporterEvents::TRANSPORTER_REMOVE, $this->anything()); $this->transporter->remove($this->transporter->getPath() . '/a/path'); }