Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bin scripts

  • Loading branch information...
commit da1e6ce1097cccd683890c301e0f39c5a9c988a0 1 parent b41b746
@willdurand willdurand authored
Showing with 40 additions and 74 deletions.
  1. +15 −14 generator/bin/phing.php
  2. +25 −60 generator/bin/propel-gen
View
29 generator/bin/phing.php
@@ -11,24 +11,31 @@
// Set any INI options for PHP
// ---------------------------
-if (file_exists($file = dirname(__FILE__) . '/../../vendor/autoload.php')) {
- set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../../vendor/phing/phing/classes');
-
- require_once $file;
+$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')) { define('PHP_CLASSPATH', getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path()); }
- ini_set('include_path', 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()); }
+ if (!defined('PHP_CLASSPATH')) {
+ define('PHP_CLASSPATH', get_include_path());
+ }
}
require_once 'phing/Phing.php';
try {
-
/* Setup Phing environment */
Phing::startup();
@@ -45,18 +52,12 @@
// 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);
-
}
View
85 generator/bin/propel-gen
@@ -1,79 +1,44 @@
-#!/bin/sh
-# Shell wrapper for Propel generator
-# $Id$
-#
-# This script will do the following:
-# - check for PHING_COMMAND env, if found, use it.
-# - if not found assume php is on the path
-# - check for PROPEL_GEN_HOME env, if found use it
-# - if not look for it
+#!/usr/bin/env bash
if [ -z "$PROPEL_GEN_HOME" ] ; then
+ # try to find Propel
+ if [ -d /opt/propel/generator ] ; then
+ PROPEL_GEN_HOME=/opt/propel/generator
+ fi
- # try to find Propel
- if [ -d /opt/propel/generator ] ; then
- PROPEL_GEN_HOME=/opt/propel/generator
- fi
-
- if [ -d "${HOME}/opt/propel/generator" ] ; then
- PROPEL_GEN_HOME="${HOME}/opt/propel/generator"
- fi
-
- if [ -d "/usr/local/propel/generator" ] ; then
- PROPEL_GEN_HOME="/usr/local/propel/generator"
- fi
-
- if [ -d "${HOME}/usr/propel/generator" ] ; then
- PROPEL_GEN_HOME="${HOME}/usr/propel/generator"
- fi
-
- ## resolve links - the script name may be a link to phing's home
- PRG="$0"
- progname=`basename "$0"`
- saveddir=`pwd`
-
- # need this for relative symlinks
- dirname_prg=`dirname "$PRG"`
- cd "$dirname_prg"
-
- while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
+ if [ -d "${HOME}/opt/propel/generator" ] ; then
+ PROPEL_GEN_HOME="${HOME}/opt/propel/generator"
fi
- done
- cd "$saveddir"
+ if [ -d "/usr/local/propel/generator" ] ; then
+ PROPEL_GEN_HOME="/usr/local/propel/generator"
+ fi
- PROPEL_GEN_HOME=`dirname "$PRG"`/..
+ if [ -d "${HOME}/usr/propel/generator" ] ; then
+ PROPEL_GEN_HOME="${HOME}/usr/propel/generator"
+ fi
- # make it fully qualified
- PROPEL_GEN_HOME=`cd "$PROPEL_GEN_HOME" && pwd`
+ if [ -d "`pwd`/vendor/propel/propel1" ] ; then
+ PROPEL_GEN_HOME="`pwd`/vendor/propel/propel1/generator"
+ fi
- # make it available in PHP via getenv("PROPEL_GEN_HOME")
- export PROPEL_GEN_HOME
+ if [ -d "`pwd`/generator" ] ; then
+ PROPEL_GEN_HOME="`pwd`/generator"
+ fi
+ export PROPEL_GEN_HOME
fi
-# Composer install?
-if [ -d "vendor/phing/phing" ] ; then
- if [ -f "$PROPEL_GEN_HOME/bin/phing.php" ] ; then
- export PHING_COMMAND="$PROPEL_GEN_HOME/bin/phing.php"
- else
- export PHING_COMMAND="$PROPEL_GEN_HOME/vendor/propel/propel1/generator/bin/phing.php"
- fi
+if [ -f "$PROPEL_GEN_HOME/bin/phing.php" ] ; 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"
+ export PHING_COMMAND="phing"
fi
if [ $# = 1 ] ; then
- $PHING_COMMAND -f "$PROPEL_GEN_HOME/build.xml" -Dusing.propel-gen=true -Dproject.dir=$saveddir $*
+ $PHING_COMMAND -f "$PROPEL_GEN_HOME/build.xml" -Dusing.propel-gen=true -Dproject.dir=$saveddir $*
else
- $PHING_COMMAND -f "$PROPEL_GEN_HOME/build.xml" -Dusing.propel-gen=true -Dproject.dir=$*
+ $PHING_COMMAND -f "$PROPEL_GEN_HOME/build.xml" -Dusing.propel-gen=true -Dproject.dir=$*
fi
Please sign in to comment.
Something went wrong with that request. Please try again.