fix verbose packaging
[pharext/pharext] / src / pharext / Task / PharBuild.php
index d6f27881823ffdbce6e0d99036b71be50039c3f3..03ac42c1019b5d6505eebd0f80b7ef07f9d92206 100644 (file)
@@ -68,11 +68,25 @@ class PharBuild implements Task
                $phar->buildFromIterator((new Task\BundleGenerator)->run());
 
                if ($this->source) {
-                       $phar->buildFromIterator($this->source, $this->source->getBaseDir());
+                       if ($verbose) {
+                               $bdir = $this->source->getBaseDir();
+                               $blen = strlen($bdir);
+                               foreach ($this->source as $index => $file) {
+                                       if (is_resource($file)) {
+                                               printf("Packaging %s ...\n", $index);
+                                               $phar[$index] = $file;
+                                       } else {
+                                               printf("Packaging %s ...\n", $index = trim(substr($file, $blen), "/"));
+                                               $phar->addFile($file, $index);
+                                       }
+                               }
+                       } else {
+                               $phar->buildFromIterator($this->source, $this->source->getBaseDir());
+                       }
                }
 
                $phar->stopBuffering();
-
+               
                if (!chmod($temp, fileperms($temp) | 0111)) {
                        throw new Exception;
                }