From 150cdfd3ac66c54cf607255b78c519f753498b1d Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Thu, 22 Aug 2013 15:41:33 -0400 Subject: [PATCH] [CB-4652] Allow default project template to be overridden on create --- bin/create | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/create b/bin/create index 40727fcb..6a49dc9c 100755 --- a/bin/create +++ b/bin/create @@ -40,6 +40,7 @@ PROJECT_PATH="${1:-'./example'}" PACKAGE=${2:-"org.apache.cordova.example"} ACTIVITY=$(echo ${3:-"cordovaExample"} | tr -d '[:blank:][:punct:]') APP_LABEL=${3:-"Cordova Example"}; +PROJECT_TEMPLATE_DIR=${4:-"$BUILD_PATH/bin/templates/project"}; # clobber any existing example if [ -d "$PROJECT_PATH" ] @@ -111,8 +112,8 @@ fi "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY &> /dev/null # copy project template -cp -r "$BUILD_PATH"/bin/templates/project/assets "$PROJECT_PATH" -cp -r "$BUILD_PATH"/bin/templates/project/res "$PROJECT_PATH" +cp -r "$PROJECT_TEMPLATE_DIR"/assets "$PROJECT_PATH" +cp -r "$PROJECT_TEMPLATE_DIR"/res "$PROJECT_PATH" # copy cordova.js, cordova.jar and res/xml if [ -d "$BUILD_PATH"/framework ] @@ -127,14 +128,14 @@ else fi # interpolate the activity name and package -cp "$BUILD_PATH"/bin/templates/project/Activity.java "$ACTIVITY_PATH" +cp "$PROJECT_TEMPLATE_DIR"/Activity.java "$ACTIVITY_PATH" replace "s/__ACTIVITY__/${ACTIVITY}/g" "$ACTIVITY_PATH" replace "s/__ID__/${PACKAGE}/g" "$ACTIVITY_PATH" # interpolate the app name into strings.xml replace "s/>${ACTIVITY}${APP_LABEL}