verbose packaging
authorMichael Wallner <mike@php.net>
Sat, 28 Mar 2015 10:58:36 +0000 (11:58 +0100)
committerMichael Wallner <mike@php.net>
Sat, 28 Mar 2015 10:58:36 +0000 (11:58 +0100)
src/pharext/Task/PharBuild.php

index d6f27881823ffdbce6e0d99036b71be50039c3f3..5468755832d34ed61f97b7e9710ed9931616e054 100644 (file)
@@ -68,10 +68,27 @@ 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);
+                                       } else {
+                                               printf("Packaging %s ...\n", $index = trim(substr($file, $blen), "/"));
+                                       }
+                                       $phar[$index] = $file;
+                               }
+                       } else {
+                               $phar->buildFromIterator($this->source, $this->source->getBaseDir());
+                       }
                }
 
                $phar->stopBuffering();
+               
+               foreach (new \RecursiveIteratorIterator($phar) as $file) {
+                       printf("Packaged %s ...\n", $file);
+               }
 
                if (!chmod($temp, fileperms($temp) | 0111)) {
                        throw new Exception;