Repository: cordova-app-harness Updated Branches: refs/heads/master 2ed499c94 -> e1994aa57
createproject.sh: Use coho & cca to find plugins locally Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/5c820244 Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/5c820244 Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/5c820244 Branch: refs/heads/master Commit: 5c820244d5f2065f372f2a6306806ac4727c3934 Parents: 2ed499c Author: Andrew Grieve <[email protected]> Authored: Mon Jun 16 22:43:39 2014 -0400 Committer: Andrew Grieve <[email protected]> Committed: Mon Jun 16 22:43:39 2014 -0400 ---------------------------------------------------------------------- createproject.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/5c820244/createproject.sh ---------------------------------------------------------------------- diff --git a/createproject.sh b/createproject.sh index af13fec..588880b 100755 --- a/createproject.sh +++ b/createproject.sh @@ -39,15 +39,36 @@ AH_PATH="$(cd $(dirname $0) && pwd)" extra_search_path="$PLUGIN_SEARCH_PATH" PLUGIN_SEARCH_PATH="$(dirname "$AH_PATH")" +function ResolveSymlinks() { + local found_path="$1" + if [[ -n "$found_path" ]]; then + node -e "console.log(require('fs').realpathSync('$found_path'))" + fi +} function AddSearchPathIfExists() { if [[ -d "$1" ]]; then PLUGIN_SEARCH_PATH="$PLUGIN_SEARCH_PATH:$1" fi } -AddSearchPathIfExists "$(dirname "$AH_PATH")/cordova" -AddSearchPathIfExists "$(dirname "$AH_PATH")/cordova/cordova-plugins" -AddSearchPathIfExists "$(dirname "$AH_PATH")/cordova-plugins" -AddSearchPathIfExists "$(dirname "$AH_PATH")/mobile-chrome-apps/chrome-cordova/plugins" + +# Use coho to find Cordova plugins +COHO_PATH=$(ResolveSymlinks $(which coho)) +if [[ -n "$COHO_PATH" ]]; then + CDV_PATH="$(dirname $(dirname "$COHO_PATH"))" + AddSearchPathIfExists "$CDV_PATH" + AddSearchPathIfExists "$CDV_PATH/cordova-plugins" +else + # For when repos are cloned as siblings. + AddSearchPathIfExists "$(dirname "$AH_PATH")" + AddSearchPathIfExists "$(dirname "$AH_PATH")/cordova-plugins" +fi + +# Use cca to find Chrome plugins +CCA_PATH=$(ResolveSymlinks $(which cca)) +if [[ -n "$CCA_PATH" ]]; then + CCA_PATH="$(dirname $(dirname "$CCA_PATH"))" + AddSearchPathIfExists "$CCA_PATH/chrome-cordova/plugins" +fi if [[ -n "$extra_search_path" ]]; then PLUGIN_SEARCH_PATH="${extra_search_path}:$PLUGIN_SEARCH_PATH"
