Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a way to autoload Phing classes using composer

  • Loading branch information...
commit 39d0a888ad686648e77da676c0d073f5b2d3cf02 1 parent ee007fa
William Durand willdurand authored
Showing with 66 additions and 0 deletions.
  1. +62 −0 generator/bin/phing.php
  2. +4 −0 generator/bin/propel-gen
62 generator/bin/phing.php
View
@@ -0,0 +1,62 @@
+#!/usr/bin/env php
+<?php
+
+/**
+ * This is the Phing command line launcher. It starts up the system evironment
+ * tests for all important paths and properties and kicks of the main command-
+ * line entry point of phing located in phing.Phing
+ * @version $Revision: 552 $
+ */
+
+// Set any INI options for PHP
+// ---------------------------
+
+if (file_exists($file = dirname(__FILE__) . '/../../vendor/.composer/autoload.php')) {
+ set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../../vendor/pear-phing');
+
+ require_once $file;
+}
+
+/* set classpath */
+if (getenv('PHP_CLASSPATH')) {
+ if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH', getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path()); }
+ ini_set('include_path', PHP_CLASSPATH);
+} else {
+ if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH', get_include_path()); }
+}
+
+require_once 'phing/Phing.php';
+
+try {
+
+ /* Setup Phing environment */
+ Phing::startup();
+
+ // Set phing.home property to the value from environment
+ // (this may be NULL, but that's not a big problem.)
+ Phing::setProperty('phing.home', getenv('PHING_HOME'));
+
+ // Grab and clean up the CLI arguments
+ $args = isset($argv) ? $argv : $_SERVER['argv']; // $_SERVER['argv'] seems to not work (sometimes?) when argv is registered
+ array_shift($args); // 1st arg is script name, so drop it
+
+ // Invoke the commandline entry point
+ Phing::fire($args);
+
+ // Invoke any shutdown routines.
+ Phing::shutdown();
+
+} catch (ConfigurationException $x) {
+
+ Phing::printMessage($x);
+ exit(-1); // This was convention previously for configuration errors.
+
+} catch (Exception $x) {
+
+ // Assume the message was already printed as part of the build and
+ // exit with non-0 error code.
+
+ exit(1);
+
+}
+
4 generator/bin/propel-gen
View
@@ -58,6 +58,10 @@ if [ -z "$PROPEL_GEN_HOME" ] ; then
fi
+if [ -d "vendor/pear-phing/phing" ] ; then
+ export PHING_COMMAND="$PROPEL_GEN_HOME/bin/phing.php"
+fi
+
if [ -z "$PHING_COMMAND" ] ; then
# echo "WARNING: PHING_COMMAND environment not set. (Assuming phing on PATH)"
export PHING_COMMAND="phing"
Please sign in to comment.
Something went wrong with that request. Please try again.