From 4f60b89e31d87c81fe2a038d5e510c8dec177f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Monta=C3=B1ez?= Date: Thu, 7 Nov 2013 19:57:44 -0200 Subject: [PATCH] Tweaks on Compiler. --- Mage/Command/BuiltIn/CompileCommand.php | 7 +++++-- Mage/Compiler.php | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) 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