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/02/05 21:53:41 UTC

webworks commit: CB-2381: fix for create scripts using sample application name + package all the time

Updated Branches:
  refs/heads/master 0d46453cc -> e391d5f96


CB-2381: fix for create scripts using sample application name + package all the time


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

Branch: refs/heads/master
Commit: e391d5f96d63ac69df057179a7cc06cc39ed2d11
Parents: 0d46453
Author: Fil Maj <ma...@gmail.com>
Authored: Tue Feb 5 12:55:13 2013 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Tue Feb 5 12:55:13 2013 -0800

----------------------------------------------------------------------
 bin/create    |   22 ++++++++++------------
 bin/create.js |   10 +++++-----
 2 files changed, 15 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/e391d5f9/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index 80af481..870bad1 100755
--- a/bin/create
+++ b/bin/create
@@ -35,7 +35,7 @@ VERSION=$(cat "$BUILD_PATH/VERSION")
 
 PROJECT_PATH="${1:-"./example"}"
 PACKAGE=${2:-"org.apache.cordova.example"}
-NAME=${2:-"cordovaExample"}
+NAME=${3:-"cordovaExample"}
 
 # clobber any existing example
 if [ -d "$PROJECT_PATH" ]
@@ -75,19 +75,17 @@ then
         mv ant-contrib-1.0b3.jar "$BUILD_PATH"/bin/templates/project/lib/ant-contrib
     fi
     
-	echo "Building cordova-$VERSION.jar and cordova-$VERSION.js ..."
-	(cd "$BUILD_PATH" && "$ANT" dist &> /dev/null )
-	
-	# copy project template
-	echo "Copying assets and resources ..."
-	cp -r "$BUILD_PATH/dist/sample/." "$PROJECT_PATH"
+	echo "Creating BlackBerry project..."
+	(cd "$BUILD_PATH" && "$ANT" create -Dproject.path="$PROJECT_PATH" &> /dev/null )
+    # interpolate the activity and package into config.xml
+    echo "Updating config.xml ..."
+    sed -i '' -e "s/__NAME__/${NAME}/g" "$MANIFEST_PATH"
+    sed -i '' -e "s/__PACKAGE__/${PACKAGE}/g" "$MANIFEST_PATH"
 else
 	# copy project template if in distribution
 	echo "Copying assets and resources ..."
 	cp -r "$BUILD_PATH/sample/." "$PROJECT_PATH"
+    echo "Updating config.xml ..."
+    sed -i '' -e "s/cordovaExample/${NAME}/g" "$MANIFEST_PATH"
+    sed -i '' -e "s/org.apache.cordova.example/${PACKAGE}/g" "$MANIFEST_PATH"
 fi
-
-# interpolate the activity and package into config.xml
-echo "Updating config.xml ..."
-sed -i '' -e "s/__NAME__/${NAME}/g" "$MANIFEST_PATH"
-sed -i '' -e "s/__PACKAGE__/${PACKAGE}/g" "$MANIFEST_PATH"

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/e391d5f9/bin/create.js
----------------------------------------------------------------------
diff --git a/bin/create.js b/bin/create.js
index c9737ad..ac4b083 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -116,14 +116,14 @@ var VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
 
 if(fso.FolderExists(ROOT+'\\framework')){
     downloadAntContrib();
-    exec('ant.bat -f '+ ROOT +'\\build.xml dist');
-    // copy in the project template
-    exec('cmd /c xcopy '+ ROOT + '\\dist\\sample\\* '+PROJECT_PATH+' /I /S /Y');
+    exec('ant.bat -f '+ ROOT +'\\build.xml create -Dproject.path="' + PROJECT_PATH + '"');
+    replaceInFile(MANIFEST_PATH, /__PACKAGE__/, PACKAGE);
+    replaceInFile(MANIFEST_PATH, /__ACTIVITY__/, NAME);
 }else{
     // copy in the project template
     exec('cmd /c xcopy '+ ROOT + '\\sample\\* '+PROJECT_PATH+' /I /S /Y');    
+    replaceInFile(MANIFEST_PATH, /org.apache.cordova.example/, PACKAGE);
+    replaceInFile(MANIFEST_PATH, /cordovaExample/, NAME);
 }
 
-replaceInFile(MANIFEST_PATH, /__PACKAGE__/, PACKAGE);
-replaceInFile(MANIFEST_PATH, /__ACTIVITY__/, NAME);
 cleanup();