From 5274821c5d92a9267ec992ec1d6757c4765ee5e8 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 25 Feb 2014 21:11:46 +0100 Subject: [PATCH 1/1] script to generate phar file --- bin/makephar.php | 31 +++++++++++++++++++++++++++++++ src/phar-stub.php | 23 +++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 bin/makephar.php create mode 100644 src/phar-stub.php diff --git a/bin/makephar.php b/bin/makephar.php new file mode 100755 index 0000000..6089b0c --- /dev/null +++ b/bin/makephar.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +startBuffering(); + +// add all files in the project +$phar->buildFromDirectory( + realpath(__DIR__ . '/../'), + '#' + . '^' . preg_quote(realpath(__DIR__ . '/../'), '#') + . '/(data/bdrem.config.php.dist|src/bdrem/|www/|README\.rst)' + . '#' +); + +//remove shebang from bin/bdrem.php +$bin = file_get_contents(__DIR__ . '/../bin/bdrem.php'); +$phar->addFromString('bin/bdrem.php', substr($bin, strpos($bin, "\n") + 1)); + +$phar->setStub(file_get_contents(__DIR__ . '/../src/phar-stub.php')); +$phar->stopBuffering(); +?> diff --git a/src/phar-stub.php b/src/phar-stub.php new file mode 100644 index 0000000..3c80130 --- /dev/null +++ b/src/phar-stub.php @@ -0,0 +1,23 @@ + -- 2.30.2