From 114ce70d3a86978eb39ac940162c442a2c9bdd08 Mon Sep 17 00:00:00 2001 From: Parziphal Date: Sun, 27 Oct 2013 01:25:59 -0500 Subject: [PATCH] more regarding CompileAssets --- .../ApplicationInstaller/CompileAssets.php | 26 ++++++++++++++++--- install/ApplicationInstaller/Console.php | 20 ++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) create mode 100755 install/ApplicationInstaller/Console.php diff --git a/install/ApplicationInstaller/CompileAssets.php b/install/ApplicationInstaller/CompileAssets.php index 3c5b228..9b0d524 100755 --- a/install/ApplicationInstaller/CompileAssets.php +++ b/install/ApplicationInstaller/CompileAssets.php @@ -1,13 +1,16 @@ compileAll(); + + # Reset configuration to production, because Rails will load + # development by default when ran from CGI, and Assets won't + # set environment to production itself. Fix this later. + Rails::resetConfig('production'); + + # Load console + $console = new Console($event->getIO()); + + # Warn about compiling + $console->write("[Compiling assets]"); + + # Set console to assets + Rails::assets()->setConsole($console); + + # Compile files + Rails::assets()->compileAll(); # Delete temporary config file. unlink($target); diff --git a/install/ApplicationInstaller/Console.php b/install/ApplicationInstaller/Console.php new file mode 100755 index 0000000..983e9a5 --- /dev/null +++ b/install/ApplicationInstaller/Console.php @@ -0,0 +1,20 @@ +io = $io; + } + + public function write($message, $n = 1) + { + $this->io->write($message . str_repeat("\n", $n)); + } +}