You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/07/25 06:21:56 UTC
android commit: [CB-4198] bin/create should handle spaces in activity
better.
Updated Branches:
refs/heads/master 463c7b502 -> 980c4699b
[CB-4198] bin/create should handle spaces in activity better.
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/980c4699
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/980c4699
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/980c4699
Branch: refs/heads/master
Commit: 980c4699b0993b1718c2f0a1761f7d3cc49a0c9b
Parents: 463c7b5
Author: Fil Maj <ma...@gmail.com>
Authored: Wed Jul 24 21:21:41 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Jul 24 21:21:41 2013 -0700
----------------------------------------------------------------------
bin/create | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/980c4699/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index 21f7478..c12c9cf 100755
--- a/bin/create
+++ b/bin/create
@@ -38,7 +38,8 @@ VERSION=$(cat "$BUILD_PATH"/VERSION)
PROJECT_PATH="${1:-'./example'}"
PACKAGE=${2:-"org.apache.cordova.example"}
-ACTIVITY=${3:-"cordovaExample"}
+ACTIVITY=$(echo ${3:-"cordovaExample"} | tr -d ' ')
+APP_LABEL=${3:-"Cordova Example"};
# clobber any existing example
if [ -d "$PROJECT_PATH" ]
@@ -67,7 +68,7 @@ function replace {
# Mac OS X requires -i argument
if [[ "$OSTYPE" =~ "darwin" ]]
then
- /usr/bin/sed -i '' -e $pattern "$filename"
+ /usr/bin/sed -i '' -e "$pattern" "$filename"
elif [[ "$OSTYPE" =~ "linux" ]]
then
/bin/sed -i -e $pattern "$filename"
@@ -82,6 +83,7 @@ ANDROID_BIN="${ANDROID_BIN:=$( which android )}"
PACKAGE_AS_PATH=$(echo $PACKAGE | sed 's/\./\//g')
ACTIVITY_PATH="$PROJECT_PATH"/src/$PACKAGE_AS_PATH/$ACTIVITY.java
MANIFEST_PATH="$PROJECT_PATH"/AndroidManifest.xml
+STRINGS_PATH="$PROJECT_PATH"/res/values/strings.xml
TARGET=$("$ANDROID_BIN" list targets -c | grep '^android-' | tail -1 )
API_LEVEL=${TARGET##android-}
@@ -129,6 +131,9 @@ cp "$BUILD_PATH"/bin/templates/project/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"
replace "s/__ACTIVITY__/${ACTIVITY}/g" "$MANIFEST_PATH"
replace "s/__PACKAGE__/${PACKAGE}/g" "$MANIFEST_PATH"