public function testSubDirectoriesOfExcludeAreAlsoExcluded() { $excludes = array('folder1'); $exclude = new Exclude($excludes); $this->assertTrue($exclude->exclude('folder1/file1.txt')); $this->assertTrue($exclude->exclude('folder1/file2.txt')); $this->assertTrue($exclude->exclude('folder1/folder2/file3.txt')); }
/** * @param string $source * @param string $destination */ public function unInstall($source, $destination) { $iterator = $this->getIterator($source, RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $item) { $destinationFile = sprintf("%s/%s", $destination, $iterator->getSubPathName()); if ($this->exclude->exclude($iterator->getSubPathName())) { continue; } if (!file_exists($destinationFile)) { $this->gitIgnore->removeEntry($iterator->getSubPathName()); continue; } if ($item->isDir()) { //check if there are not other files in this dir if ($this->fileSystem->isDirEmpty($destinationFile)) { $this->fileSystem->removeDirectory($destinationFile); } continue; } $this->fileSystem->unlink($destinationFile); $this->gitIgnore->removeEntry('/' . $iterator->getSubPathName()); } $this->gitIgnore->removeIgnoreDirectories(); }