Skip to content

Commit

Permalink
Compress files on add instead of using Phar::compressFiles (fixes box…
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Sauvat committed Apr 7, 2016
1 parent 0395261 commit 3a4a3bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/lib/KevinGH/Box/Command/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -694,6 +689,9 @@ private function add(
}

$box->addFile($file, $relative);
if (null !== $algorithm) {
$phar[$relative]->compress($algorithm);
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/tests/KevinGH/Box/Tests/Command/BuildTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ public function testBuildCompressed()
+ {$dir}test.php
? Adding main file: {$dir}test.php
? Generating new stub...
? Compressing...
* Done.
OUTPUT;
Expand Down

0 comments on commit 3a4a3bd

Please sign in to comment.