Skip to content

Commit

Permalink
Merge pull request #91 from esurov/executable
Browse files Browse the repository at this point in the history
Make `scanner` executable
  • Loading branch information
marcocesarato authored May 10, 2023
2 parents dd200a7 + 9e0033d commit 2463481
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,26 @@ if (1 == ini_get('phar.readonly')) {
// create phar
$p = new Phar($output);

// start buffering. Mandatory to modify stub.
$p->startBuffering();

// pointing main file which requires all classes
$defaultStub = $p->createDefaultStub('index.php', '/index.php');

// creating our library using whole directory
$p->buildFromDirectory($input);

// pointing main file which requires all classes
$p->setDefaultStub('index.php', '/index.php');
// Create a custom stub to add the shebang
$stub = "#!/usr/bin/env php\n" . $defaultStub;

// Add the stub
$p->setStub($stub);

$p->stopBuffering();

unset($p);
rename($output, $finalOutput);

chmod($finalOutput, 0755);

echo "$output successfully created";

0 comments on commit 2463481

Please sign in to comment.