2018-02-20 12:13:43 +01:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
Copyright 2016-2018 Daniil Gentili
|
|
|
|
(https://daniil.it)
|
|
|
|
This file is part of MadelineProto.
|
|
|
|
MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with MadelineProto.
|
|
|
|
If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
require 'vendor/autoload.php';
|
2018-02-20 12:25:25 +01:00
|
|
|
use Spatie\Php7to5\DirectoryConverter;
|
2018-02-20 12:13:43 +01:00
|
|
|
|
2018-02-20 12:25:25 +01:00
|
|
|
function rimraf($dir)
|
|
|
|
{
|
2018-02-20 12:13:43 +01:00
|
|
|
if (is_dir($dir)) {
|
|
|
|
$objects = scandir($dir);
|
|
|
|
foreach ($objects as $object) {
|
2018-02-20 12:25:25 +01:00
|
|
|
if ($object != '.' && $object != '..') {
|
|
|
|
if (is_dir($dir.'/'.$object)) {
|
|
|
|
rimraf($dir.'/'.$object);
|
2018-02-20 12:13:43 +01:00
|
|
|
} else {
|
2018-02-20 12:25:25 +01:00
|
|
|
unlink($dir.'/'.$object);
|
2018-02-20 12:13:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rmdir($dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@unlink('madeline.phar');
|
|
|
|
rimraf('phar');
|
|
|
|
rimraf('composer');
|
|
|
|
mkdir('phar');
|
|
|
|
mkdir('composer');
|
|
|
|
chdir('composer');
|
|
|
|
file_put_contents('composer.json', '{
|
|
|
|
"name": "danog/madelineprototests",
|
|
|
|
"minimum-stability":"dev",
|
|
|
|
"require": {
|
|
|
|
"danog/madelineproto": "dev-master"
|
|
|
|
},
|
|
|
|
"repositories": [
|
|
|
|
{
|
|
|
|
"type": "git",
|
|
|
|
"url": "https://github.com/danog/phpseclib"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"authors": [
|
|
|
|
{
|
|
|
|
"name": "Daniil Gentili",
|
|
|
|
"email": "daniil@daniil.it"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}');
|
|
|
|
shell_exec('composer update');
|
|
|
|
|
|
|
|
(new DirectoryConverter(__DIR__.'/composer', ['.php']))->alsoCopyNonPhpFiles()->savePhp5FilesTo(__DIR__.'/phar');
|
|
|
|
|
|
|
|
$p = new Phar(__DIR__.'/madeline.phar', 0, 'madeline.phar');
|
|
|
|
$p->buildFromDirectory(__DIR__.'/phar', '/^((?!tests).)*(\.php|\.py|\.tl|\.json)$/i');
|
|
|
|
$p->addFromString('.git/refs/heads/master', file_get_contents(__DIR__.'/.git/refs/heads/master'));
|
|
|
|
|
|
|
|
$p->setStub('<?php Phar::interceptFileFuncs(); Phar::mapPhar("madeline.phar"); require_once "phar://madeline.phar/vendor/autoload.php"; __HALT_COMPILER(); ?>');
|