cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject [2/2] android commit: [CB-4652] Allow default project template to be overridden on create
Date Fri, 23 Aug 2013 17:05:03 GMT
[CB-4652] Allow default project template to be overridden on create


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/150cdfd3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/150cdfd3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/150cdfd3

Branch: refs/heads/master
Commit: 150cdfd3ac66c54cf607255b78c519f753498b1d
Parents: f42b34d
Author: Ian Clelland <iclelland@chromium.org>
Authored: Thu Aug 22 15:41:33 2013 -0400
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Fri Aug 23 13:04:19 2013 -0400

----------------------------------------------------------------------
 bin/create | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/150cdfd3/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index 40727fc..6a49dc9 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}</g" "$STRINGS_PATH"
 
-cp "$BUILD_PATH"/bin/templates/project/AndroidManifest.xml "$MANIFEST_PATH"
+cp "$PROJECT_TEMPLATE_DIR"/AndroidManifest.xml "$MANIFEST_PATH"
 replace "s/__ACTIVITY__/${ACTIVITY}/g" "$MANIFEST_PATH"
 replace "s/__PACKAGE__/${PACKAGE}/g" "$MANIFEST_PATH"
 replace "s/__APILEVEL__/${API_LEVEL}/g" "$MANIFEST_PATH"


Mime
View raw message