processTemplate() public static method

Processes the template and replace the properties with the OS specific values.
public static processTemplate ( string $template, boolean $override = false, integer $mode = 420 ) : void
$template string The path to the template
$override boolean TRUE if the file should be overwritten if exists, else FALSE
$mode integer The mode of the target file
return void
Esempio n. 1
0
 /**
  * This method will be invoked by composer after a successful installation and creates
  * the application server configuration file under etc/appserver/appserver.xml.
  *
  * @param \Composer\Script\Event $event The event that invokes this method
  *
  * @return void
  */
 public static function postInstall(Event $event)
 {
     // initialize the installation directory
     $override = false;
     $installDir = getcwd();
     // check the arguments for an installation directory
     foreach ($event->getArguments() as $arg) {
         // extract arguments
         list($key, ) = explode('=', $arg);
         // query we want to override files
         if ($key === SetupKeys::ARG_OVERRIDE) {
             $override = true;
         }
         // query for a custom installation directory
         if ($key === SetupKeys::ARG_INSTALL_DIR) {
             $installDir = str_replace("{$key}=", '', $arg);
         }
     }
     Setup::prepareContext($installDir, $event);
     // process and move the configuration files their target directory
     Setup::processTemplate('etc/appserver/appserver.xml', $override);
     // write a message to the console
     $event->getIo()->write(sprintf('%s<info>Successfully invoked appserver.io Composer post-install-cmd script ...</info>', Setup::$logo));
 }