Tweaks on Compiler.

This commit is contained in:
Andrés Montañez 2013-11-07 19:57:44 -02:00
parent ee0bc27bc7
commit 4f60b89e31
2 changed files with 10 additions and 3 deletions

View file

@ -28,11 +28,14 @@ class CompileCommand extends AbstractCommand
*/
public function run ()
{
Console::output('Compiling <dark_gray>Magallanes</dark_gray>... ', 1, 0);
if (ini_get('phar.readonly')) {
Console::output('The <purple>php.ini</purple> variable <light_red>phar.readonly</light_red> must be enabled.', 1, 2);
return;
}
$compiler = new Compiler;
$compiler->compile();
Console::output('Mage compiled successfully');
Console::output('<light_purple>mage.phar</light_purple> compiled <light_green>successfully</light_green>', 0, 2);
}
}

View file

@ -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<?php Phar::mapPhar('mage.phar'); require 'phar://mage.phar/mage'; __HALT_COMPILER();");