cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] git commit: command line to create a new project
Date Tue, 05 Feb 2013 01:18:49 GMT
command line to create a new project


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

Branch: refs/heads/master
Commit: 36822defda7f13ab158999508f5f6b4c9f7b5d6f
Parents: b183792
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Mon Feb 4 16:35:22 2013 -0800
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Mon Feb 4 16:35:22 2013 -0800

----------------------------------------------------------------------
 bin/create.js |   52 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/36822def/bin/create.js
----------------------------------------------------------------------
diff --git a/bin/create.js b/bin/create.js
index b17d408..41a5e17 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -18,16 +18,40 @@
 */
 
 /*
- * create a cordova/wp7 project
+ * create a cordova/wp8 project
  *
  * USAGE
  *  ./create [path package activity]
+
+    ./bin/create.bat ~/MyTestProj "test.proj" "TestProject"
  */
 
 function Usage()
 {
   WScript.Echo("Usage: create PATH [PACKAGE] [NAME]");
-  WScript.Echo("Creates a new cordova/wp7 project.");
+  WScript.Echo("Creates a new cordova/wp8 project.");
+}
+
+var LinkageType = "DLL"; // ||  Yeah, that's it ...
+
+var fso=WScript.CreateObject("Scripting.FileSystemObject");
+// working dir
+var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
+
+if(LinkageType == "DLL") // the only type for now.
+{
+    // TODO: check that the dll exists and the cordova-lib has been built
+    var dllPath = ROOT + "\\framework\\Bin\\Release\\WPCordovaClassLib.dll";
+    if(fso.FileExists(dllPath))
+    {
+        WScript.Echo("File Exists");
+    }
+    else 
+    {
+        WScript.Echo("Error: Missing Library! Could not find the file: " + dllPath);
+        WScript.Echo("Open and build the project ./framework/WPCordovaClassLib.csproj and
build it in release mode first.");
+        WScript.Quit(1);
+    }
 }
 
 var ForReading = 1, ForWriting = 2, ForAppending = 8;
@@ -35,7 +59,7 @@ var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
 
 function read(filename) {
     //WScript.Echo('Reading in ' + filename);
-    var fso=WScript.CreateObject("Scripting.FileSystemObject");
+    
     var f=fso.OpenTextFile(filename, 1,2);
     var s=f.ReadAll();
     f.Close();
@@ -43,7 +67,7 @@ function read(filename) {
 }
 
 function write(filename, contents) {
-    var fso=WScript.CreateObject("Scripting.FileSystemObject");
+    //var fso=WScript.CreateObject("Scripting.FileSystemObject");
     var f=fso.OpenTextFile(filename, ForWriting, TristateTrue);
     f.Write(contents);
     f.Close();
@@ -51,10 +75,15 @@ function write(filename, contents) {
 function replaceInFile(filename, regexp, replacement) {
     write(filename,read(filename).replace(regexp,replacement));
 }
+
+
 function exec(s, output) {
     WScript.Echo('Executing::' + s);
+    
     var o=shell.Exec(s);
-    while (o.Status == 0) {
+    var timeOut = 2000;
+    while (o.Status == 0 && timeOut > 0) {
+        timeOut -= 100;
         WScript.Sleep(100);
     }
     WScript.Echo(o.StdErr.ReadAll());
@@ -86,8 +115,6 @@ var args = WScript.Arguments,
     NAME="Example",
     shell=WScript.CreateObject("WScript.Shell");
     
-// working dir
-var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
 
 if (args.Count() > 0) 
 {
@@ -128,9 +155,13 @@ WScript.Echo("Package as path: " + PACKAGE_AS_PATH);
 var newProjGuid = genGuid();
 WScript.Echo('newProjGuid ' + newProjGuid);
 
-
 // Copy the template source files to the new destination
-exec('cmd /c xcopy templates\\full ' + PROJECT_PATH + ' /S /Y');
+
+//var fso=WScript.CreateObject("Scripting.FileSystemObject");
+//WScript.Echo("src = " + ROOT + "\\templates\\standalone");
+fso.CopyFolder(ROOT + "\\templates\\standalone", PROJECT_PATH); 
+
+
 // replace the guid in the AppManifest
 replaceInFile(PROJECT_PATH + "\\Properties\\WMAppManifest.xml","$guid1$",newProjGuid);
 // replace safe-project-name in AppManifest
@@ -145,9 +176,10 @@ replaceInFile(PROJECT_PATH + "\\MainPage.xaml",/\$safeprojectname\$/g,PACKAGE);
 replaceInFile(PROJECT_PATH + "\\MainPage.xaml.cs",/\$safeprojectname\$/g,PACKAGE);
 replaceInFile(PROJECT_PATH + "\\CordovaAppProj.csproj",/\$safeprojectname\$/g,PACKAGE);
 
-WScript.Echo("Generated project : " + PROJECT_PATH + NAME);
+WScript.Echo("Generated project : " + PROJECT_PATH);
 
 // TODO: Name the project according to the arguments
 // update the solution to include the new project by name
 // version BS
 // index.html title set to project name ?
+


Mime
View raw message