Skip to content

Commit

Permalink
Add a guard to fail fast in phar:build when phar.readonly is on.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed Apr 6, 2018
1 parent 7bcdefe commit 6f46567
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public function generateTask($className, $wrapperClassName = "")
*/
public function release($opts = ['beta' => false])
{
$this->checkPharReadonly();

$version = \Robo\Robo::VERSION;
$stable = !$opts['beta'];
if ($stable) {
Expand Down Expand Up @@ -332,6 +334,8 @@ public function publish()
*/
public function pharBuild()
{
$this->checkPharReadonly();

// Create a collection builder to hold the temporary
// directory until the pack phar task runs.
$collection = $this->collectionBuilder();
Expand Down Expand Up @@ -405,6 +409,13 @@ public function pharBuild()
->run();
}

protected function checkPharReadonly()
{
if (ini_get('phar.readonly')) {
throw new \Exception('Must set "phar.readonly = Off" in php.ini to build phars.');
}
}

/**
* The phar:build command removes the project requirements from the
* 'require-dev' section that are not in the 'suggest' section.
Expand Down

0 comments on commit 6f46567

Please sign in to comment.