-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbox.php
More file actions
executable file
·40 lines (32 loc) · 764 Bytes
/
box.php
File metadata and controls
executable file
·40 lines (32 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env php
<?php
error_reporting(E_ALL);
$mode = 0755;
$version = $argv[1] ?? 'latest';
$main = "bin/app.php";
$alias = "yamltools.phar";
$output = "bin/yamltools.phar";
$banner = "/**
*
* YAML Tools Project - version: $version
* Copyright (c) Yann Blacher (Yannoff) - MIT License
* @link https://github.com/yannoff/yamltools
*
*/";
$php = '/\.php$/';
$stub = <<<EOT
#!/usr/bin/env php
<?php
$banner
Phar::mapPhar('$alias');
require "phar://$alias/$main"; __HALT_COMPILER();
EOT;
$phar = new Phar($output);
$phar->startBuffering();
$phar->addFile($main);
$phar->buildFromDirectory('./src', $php);
$phar->buildFromDirectory('vendor', $php);
$phar->compressFiles(Phar::GZ);
$phar->setStub($stub);
$phar->stopBuffering();
chmod($output, $mode);