From: Michael Wallner Date: Mon, 30 Mar 2015 19:45:57 +0000 (+0200) Subject: filter {.git,.hg.svn} X-Git-Tag: v3.0.0~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=1865a2712e004efb244cdbb241a8b7694bcdbfd7;p=pharext%2Fpharext filter {.git,.hg.svn} --- diff --git a/bin/pharext b/bin/pharext index 9e1cff6..c8de425 100755 Binary files a/bin/pharext and b/bin/pharext differ diff --git a/src/pharext/SourceDir/Basic.php b/src/pharext/SourceDir/Basic.php index 7decdc6..414c201 100644 --- a/src/pharext/SourceDir/Basic.php +++ b/src/pharext/SourceDir/Basic.php @@ -7,6 +7,7 @@ use pharext\SourceDir; use FilesystemIterator; use IteratorAggregate; +use RecursiveCallbackFilterIterator; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; @@ -33,14 +34,22 @@ class Basic implements IteratorAggregate, SourceDir public function setArgs(Args $args) { } + + public function filter($current, $key, $iterator) { + $sub = $current->getSubPath(); + if ($sub === ".git" || $sub === ".hg" || $sub === ".svn") { + return false; + } + return true; + } public function getIterator() { $rdi = new RecursiveDirectoryIterator($this->path, FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5 FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::SKIP_DOTS); - $rii = new RecursiveIteratorIterator($rdi, - RecursiveIteratorIterator::CHILD_FIRST); + $rci = new RecursiveCallbackFilterIterator($rdi, [$this, "filter"]); + $rii = new RecursiveIteratorIterator($rci); foreach ($rii as $path => $child) { if (!$child->isDir()) { yield $path; diff --git a/src/pharext/Task/PharBuild.php b/src/pharext/Task/PharBuild.php index 5468755..bc79f79 100644 --- a/src/pharext/Task/PharBuild.php +++ b/src/pharext/Task/PharBuild.php @@ -86,10 +86,6 @@ class PharBuild implements Task $phar->stopBuffering(); - foreach (new \RecursiveIteratorIterator($phar) as $file) { - printf("Packaged %s ...\n", $file); - } - if (!chmod($temp, fileperms($temp) | 0111)) { throw new Exception; }