diff --git a/src/lib/KevinGH/Box/Command/Build.php b/src/lib/KevinGH/Box/Command/Build.php index f4be0fee..f2e75ca9 100644 --- a/src/lib/KevinGH/Box/Command/Build.php +++ b/src/lib/KevinGH/Box/Command/Build.php @@ -586,13 +586,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->box->getPhar()->setMetadata($metadata); } - // compress, if algorithm set - if (null !== ($algorithm = $this->config->getCompressionAlgorithm())) { - $this->putln('?', 'Compressing...'); - - $this->box->getPhar()->compressFiles($algorithm); - } - $this->box->getPhar()->stopBuffering(); // sign using private key, if applicable @@ -661,6 +654,8 @@ private function add( } $box = $binary ? $this->box->getPhar() : $this->box; + $phar = $this->box->getPhar(); + $algorithm = $this->config->getCompressionAlgorithm(); $baseRegex = $this->config->getBasePathRegex(); $mapper = $this->config->getMapper(); @@ -694,6 +689,9 @@ private function add( } $box->addFile($file, $relative); + if (null !== $algorithm) { + $phar[$relative]->compress($algorithm); + } } } } diff --git a/src/tests/KevinGH/Box/Tests/Command/BuildTest.php b/src/tests/KevinGH/Box/Tests/Command/BuildTest.php index 4bbe9834..aba7444d 100644 --- a/src/tests/KevinGH/Box/Tests/Command/BuildTest.php +++ b/src/tests/KevinGH/Box/Tests/Command/BuildTest.php @@ -392,7 +392,6 @@ public function testBuildCompressed() + {$dir}test.php ? Adding main file: {$dir}test.php ? Generating new stub... -? Compressing... * Done. OUTPUT;