diff --git a/Mage/Command/BuiltIn/CompileCommand.php b/Mage/Command/BuiltIn/CompileCommand.php index c6bef80..f00b0ed 100644 --- a/Mage/Command/BuiltIn/CompileCommand.php +++ b/Mage/Command/BuiltIn/CompileCommand.php @@ -28,11 +28,14 @@ class CompileCommand extends AbstractCommand */ public function run () { - Console::output('Compiling Magallanes... ', 1, 0); + if (ini_get('phar.readonly')) { + Console::output('The php.ini variable phar.readonly must be enabled.', 1, 2); + return; + } $compiler = new Compiler; $compiler->compile(); - Console::output('Mage compiled successfully'); + Console::output('mage.phar compiled successfully', 0, 2); } } diff --git a/Mage/Compiler.php b/Mage/Compiler.php index 7a30cc7..729ef48 100644 --- a/Mage/Compiler.php +++ b/Mage/Compiler.php @@ -46,10 +46,14 @@ class Compiler } } + $binary = file(__DIR__.'/../bin/mage'); + unset($binary[0]); + $binary = implode(PHP_EOL, $binary); + $phar->addFromString('mage', str_replace( '$baseDir = dirname(dirname(__FILE__));', '$baseDir = __DIR__;', - file_get_contents(__DIR__.'/../bin/mage') + $binary )); $phar->setStub("#!/usr/bin/env php\n