incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/2] android commit: CB-1148 fix for directories with spaces
Date Sat, 28 Jul 2012 01:31:14 GMT
CB-1148 fix for directories with spaces


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

Branch: refs/heads/master
Commit: 7865c06863702105020c7e6d44b7b3ab59364de2
Parents: 401584d
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Fri Jul 27 18:30:39 2012 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Fri Jul 27 18:30:39 2012 -0700

----------------------------------------------------------------------
 bin/create |   89 +++++++++++++++++++++++++++----------------------------
 1 files changed, 44 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/7865c068/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index a12a715..885454f 100755
--- a/bin/create
+++ b/bin/create
@@ -31,14 +31,14 @@ then
 fi
 
 BUILD_PATH=$( cd "$( dirname "$0" )/.." && pwd )
-VERSION=$(cat $BUILD_PATH/VERSION)
+VERSION=$(cat "$BUILD_PATH"/VERSION)
 
-PROJECT_PATH=${1:-"./example"}
+PROJECT_PATH=${1:-'./example'}
 PACKAGE=${2:-"org.apache.cordova.example"}
 ACTIVITY=${3:-"cordovaExample"}
 
 # clobber any existing example
-if [ -d $PROJECT_PATH ]
+if [ -d "$PROJECT_PATH" ]
 then
     echo "Project already exists! Delete and recreate"
     exit 1
@@ -46,21 +46,21 @@ fi
 
 # cleanup after exit and/or on error
 function on_exit {
-    # [ -f $BUILD_PATH/framework/libs/commons-codec-1.6.jar ] && rm $BUILD_PATH/framework/libs/commons-codec-1.6.jar
-    # [ -d $BUILD_PATH/framework/libs ] && rmdir $BUILD_PATH/framework/libs
-    if [ -f $BUILD_PATH/framework/assets/www/cordova-$VERSION.js ]
+    # [ -f "$BUILD_PATH"/framework/libs/commons-codec-1.6.jar ] && rm "$BUILD_PATH"/framework/libs/commons-codec-1.6.jar
+    # [ -d "$BUILD_PATH"/framework/libs ] && rmdir "$BUILD_PATH"/framework/libs
+    if [ -f "$BUILD_PATH"/framework/assets/www/cordova-$VERSION.js ]
     then
-        rm $BUILD_PATH/framework/assets/www/cordova-$VERSION.js
+        rm "$BUILD_PATH"/framework/assets/www/cordova-$VERSION.js
     fi
-    if [ -f $BUILD_PATH/framework/cordova-$VERSION.jar ]
+    if [ -f "$BUILD_PATH"/framework/cordova-$VERSION.jar ]
     then
-        rm $BUILD_PATH/framework/cordova-$VERSION.jar
+        rm "$BUILD_PATH"/framework/cordova-$VERSION.jar
     fi
 }
 
 function on_error {
     echo "An error occured. Deleting project..."
-    [ -d $PROJECT_PATH ] && rm -rf $PROJECT_PATH
+    [ -d "$PROJECT_PATH" ] && rm -rf "$PROJECT_PATH"
 }
 
 function replace {
@@ -69,10 +69,10 @@ function replace {
     # Mac OS X requires -i argument
     if [ $OSTYPE = 'darwin11' ]
     then
-        sed -i '' -e $pattern $filename
+        sed -i '' -e $pattern "$filename"
     elif [ $OSTYPE = 'linux-gnu' ]
     then
-        sed -i -e $pattern $filename
+        sed -i -e $pattern "$filename"
     fi
 }
 
@@ -82,66 +82,65 @@ trap on_exit EXIT
 
 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
+ACTIVITY_PATH="$PROJECT_PATH"/src/$PACKAGE_AS_PATH/$ACTIVITY.java
+MANIFEST_PATH="$PROJECT_PATH"/AndroidManifest.xml
 
 TARGET=$($ANDROID_BIN list targets | grep id: | tail -1 | cut -f 2 -d ' ' )
 
 # if this a distribution release no need to build a jar
-if [ ! -e $BUILD_PATH/cordova-$VERSION.jar ] && [ -d $BUILD_PATH/framework ]
+if [ ! -e "$BUILD_PATH"/cordova-$VERSION.jar ] && [ -d "$BUILD_PATH"/framework ]
 then
 # update the cordova-android framework for the desired target
-    $ANDROID_BIN update project --target $TARGET --path $BUILD_PATH/framework &> /dev/null
+    $ANDROID_BIN update project --target $TARGET --path "$BUILD_PATH"/framework &>
/dev/null
 
-    if [ ! -e $BUILD_PATH/framework/libs/commons-codec-1.6.jar ]; then
+    if [ ! -e "$BUILD_PATH"/framework/libs/commons-codec-1.6.jar ]; then
         # Use curl to get the jar (TODO: Support Apache Mirrors)
         curl -OL http://mirror.symnds.com/software/Apache//commons/codec/binaries/commons-codec-1.6-bin.zip
&> /dev/null
         unzip commons-codec-1.6-bin.zip &> /dev/null
-        mkdir -p $BUILD_PATH/framework/libs
-        cp commons-codec-1.6/commons-codec-1.6.jar $BUILD_PATH/framework/libs
+        mkdir -p "$BUILD_PATH"/framework/libs
+        cp commons-codec-1.6/commons-codec-1.6.jar "$BUILD_PATH"/framework/libs
         # cleanup yo
         rm commons-codec-1.6-bin.zip && rm -rf commons-codec-1.6
     fi
 
 # compile cordova.js and cordova.jar
-    (cd $BUILD_PATH/framework && ant jar &> /dev/null )
+    (cd "$BUILD_PATH"/framework && ant jar &> /dev/null )
 fi
 
-
 # create new android project
-$ANDROID_BIN create project --target $TARGET --path $PROJECT_PATH --package $PACKAGE --activity
$ACTIVITY &> /dev/null
+$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 "$BUILD_PATH"/bin/templates/project/assets "$PROJECT_PATH"
+cp -r "$BUILD_PATH"/bin/templates/project/res "$PROJECT_PATH"
 
 # copy cordova.js, cordova.jar and res/xml
-if [ -d $BUILD_PATH/framework ]
+if [ -d "$BUILD_PATH"/framework ]
 then
-    cp -r $BUILD_PATH/framework/res/xml $PROJECT_PATH/res
-    cp $BUILD_PATH/framework/assets/www/cordova-$VERSION.js $PROJECT_PATH/assets/www/cordova-$VERSION.js
-    cp $BUILD_PATH/framework/cordova-$VERSION.jar $PROJECT_PATH/libs/cordova-$VERSION.jar
+    cp -r "$BUILD_PATH"/framework/res/xml "$PROJECT_PATH"/res
+    cp "$BUILD_PATH"/framework/assets/www/cordova-$VERSION.js "$PROJECT_PATH"/assets/www/cordova-$VERSION.js
+    cp "$BUILD_PATH"/framework/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar
 else
-    cp -r $BUILD_PATH/xml $PROJECT_PATH/res/xml
-    cp $BUILD_PATH/cordova-$VERSION.js $PROJECT_PATH/assets/www/cordova-$VERSION.js
-    cp $BUILD_PATH/cordova-$VERSION.jar $PROJECT_PATH/libs/cordova-$VERSION.jar
+    cp -r "$BUILD_PATH"/xml "$PROJECT_PATH"/res/xml
+    cp "$BUILD_PATH"/cordova-$VERSION.js "$PROJECT_PATH"/assets/www/cordova-$VERSION.js
+    cp "$BUILD_PATH"/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar
 fi
 
 # interpolate the activity name and package
-cp $BUILD_PATH/bin/templates/project/Activity.java $ACTIVITY_PATH
-replace "s/__ACTIVITY__/${ACTIVITY}/g" $ACTIVITY_PATH
-replace "s/__ID__/${PACKAGE}/g" $ACTIVITY_PATH
+cp "$BUILD_PATH"/bin/templates/project/Activity.java "$ACTIVITY_PATH"
+replace "s/__ACTIVITY__/${ACTIVITY}/g" "$ACTIVITY_PATH"
+replace "s/__ID__/${PACKAGE}/g" "$ACTIVITY_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
+cp "$BUILD_PATH"/bin/templates/project/AndroidManifest.xml "$MANIFEST_PATH"
+replace "s/__ACTIVITY__/${ACTIVITY}/g" "$MANIFEST_PATH"
+replace "s/__PACKAGE__/${PACKAGE}/g" "$MANIFEST_PATH"
 
 # creating cordova folder and copying emulate/debug/log/launch scripts
-mkdir $PROJECT_PATH/cordova
-cp $BUILD_PATH/bin/templates/cordova/appinfo.jar $PROJECT_PATH/cordova/appinfo.jar
-cp $BUILD_PATH/bin/templates/cordova/cordova $PROJECT_PATH/cordova/cordova
-cp $BUILD_PATH/bin/templates/cordova/debug $PROJECT_PATH/cordova/debug
-cp $BUILD_PATH/bin/templates/cordova/clean $PROJECT_PATH/cordova/clean
-cp $BUILD_PATH/bin/templates/cordova/log $PROJECT_PATH/cordova/log
-cp $BUILD_PATH/bin/templates/cordova/emulate $PROJECT_PATH/cordova/emulate
-cp $BUILD_PATH/bin/templates/cordova/BOOM $PROJECT_PATH/cordova/BOOM
+mkdir "$PROJECT_PATH"/cordova
+cp "$BUILD_PATH"/bin/templates/cordova/appinfo.jar "$PROJECT_PATH"/cordova/appinfo.jar
+cp "$BUILD_PATH"/bin/templates/cordova/cordova "$PROJECT_PATH"/cordova/cordova
+cp "$BUILD_PATH"/bin/templates/cordova/debug "$PROJECT_PATH"/cordova/debug
+cp "$BUILD_PATH"/bin/templates/cordova/clean "$PROJECT_PATH"/cordova/clean
+cp "$BUILD_PATH"/bin/templates/cordova/log "$PROJECT_PATH"/cordova/log
+cp "$BUILD_PATH"/bin/templates/cordova/emulate "$PROJECT_PATH"/cordova/emulate
+cp "$BUILD_PATH"/bin/templates/cordova/BOOM "$PROJECT_PATH"/cordova/BOOM


Mime
View raw message