Permalink
Browse files

Issue #388: Fix propel-gen path issues

Fixes an issue with the check for the propel-gen home-path in propel-gen script
Fixes an issue with classes being redeclared because of custom include in phing.php (code is not there in the phing.php version from phing itself)
  • Loading branch information...
1 parent bb34bda commit c107e8e60ca18c6c1ba72f7bc3e97349bb3ef557 @grEvenX grEvenX committed Jul 2, 2012
Showing with 13 additions and 16 deletions.
  1. +0 −10 generator/bin/phing.php
  2. +13 −6 generator/bin/propel-gen
View
@@ -11,16 +11,6 @@
// Set any INI options for PHP
// ---------------------------
-$dirname = dirname(__FILE__);
-foreach (array($dirname . '/../../', $dirname . '/../../../../../') as $dir) {
- if (file_exists($file = realpath($dir) . '/vendor/autoload.php')) {
- set_include_path(get_include_path() . PATH_SEPARATOR . $dir . '/vendor/phing/phing/classes');
- require_once $file;
-
- break;
- }
-}
-
/* set classpath */
if (getenv('PHP_CLASSPATH')) {
if (!defined('PHP_CLASSPATH')) {
View
@@ -18,12 +18,19 @@ if [ -z "$PROPEL_GEN_HOME" ] ; then
PROPEL_GEN_HOME="${HOME}/usr/propel/generator"
fi
- if [ -d "`pwd`/vendor/propel/propel1" ] ; then
- PROPEL_GEN_HOME="`pwd`/vendor/propel/propel1/generator"
- fi
-
- if [ -d "`pwd`/generator" ] ; then
- PROPEL_GEN_HOME="`pwd`/generator"
+ ## resolve links - the script name may be a link to phing's home
+ SOURCE="${BASH_SOURCE[0]}"
+ PRG="$( dirname "$SOURCE" )"
+ while [ -h "$SOURCE" ]
+ do
+ SOURCE="$(readlink "$SOURCE")"
+ [[ $SOURCE != /* ]] && SOURCE="$PRG/$SOURCE"
+ PRG="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ done
+ PRG="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+
+ if [ -d "`dirname $PRG`" ] ; then
+ PROPEL_GEN_HOME="`dirname $PRG`"
fi
export PROPEL_GEN_HOME

0 comments on commit c107e8e

Please sign in to comment.