cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [02/26] Added developer support and cli scripts
Date Thu, 28 Mar 2013 08:00:47 GMT
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/buildjs.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/buildjs.js b/tooling/scripts/buildjs.js
new file mode 100644
index 0000000..d34e01d
--- /dev/null
+++ b/tooling/scripts/buildjs.js
@@ -0,0 +1,211 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+    shell = WScript.CreateObject("shell.application"),
+    wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+    //Root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+    ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+    //Sub folder containing templates
+    TEMPLATES_PATH = '\\templates',
+    //Sub folder for standalone project
+    STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+    //Sub folder for full project
+    FULL_PATH = TEMPLATES_PATH + '\\full',
+    CUSTOM_PATH = TEMPLATES_PATH + '\\custom',
+    //Sub folder containing framework
+    FRAMEWORK_PATH = '\\framework',
+    //Subfolder containing example project
+    EXAMPLE_PATH = '\\example',
+    //Git Repositories
+    CORDOVA_JS = "git://github.com/apache/cordova-js.git",
+    // get version
+    VERSION = read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''),
+    BUILD_DESTINATION;
+
+
+// help function
+function Usage()
+{
+    WScript.StdOut.WriteLine("");
+    WScript.StdOut.WriteLine("This Script builds the given virsion of cordova.js and injects it into this or the given cordova-wp8 ")
+    WScript.StdOut.WriteLine("");
+    WScript.StdOut.WriteLine("Usage: buildjs [ Version PathTOCordovaWP8 ]");
+    WScript.StdOut.WriteLine("    Version : The version of cordova.js to build (must already be tagged)");
+    WScript.StdOut.WriteLine("    PathTOCordovaWP8 : The path to the cordova directory where the new cordova.js will go.");
+    WScript.StdOut.WriteLine("examples:");
+    WScript.StdOut.WriteLine("    buildjs 2.5.0rc1  //Puts cordova-2.5.0rc1 as the cordova.js in the current working directory");
+    WScript.StdOut.WriteLine("    buildjs 2.4.0 C:\\Users\\anonymous\\Desktop\\cordova-wp8  //Puts cordova-2.4.0.js in the given directory");
+    WScript.StdOut.WriteLine("    buildjs //Builds the version of cordova.js from the root folder and adds it to the working directory repo");
+    WScript.StdOut.WriteLine("");
+}
+
+// returns the contents of a file
+function read(filename) {
+    //WScript.StdOut.WriteLine('Reading in ' + filename);
+    if(fso.FileExists(filename))
+    {
+        var f=fso.OpenTextFile(filename, 1,2);
+        var s=f.ReadAll();
+        f.Close();
+        return s;
+    }
+    else
+    {
+        WScript.StdOut.WriteLine('Cannot read non-existant file : ' + filename);
+        WScript.Quit(1);
+    }
+    return null;
+}
+
+// executes a commmand in the shell
+function exec(command) {
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        WScript.sleep(100);
+    }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+    //WScript.StdOut.WriteLine("Command: " + command);
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        //Wait a little bit so we're not super looping
+        WScript.sleep(100);
+        //Print any stdout output from the script
+        if(!oShell.StdOut.AtEndOfStream) {
+            var line = oShell.StdOut.ReadLine();
+            WScript.StdOut.WriteLine(line);
+        }
+    }
+    //Check to make sure our scripts did not encounter an error
+    if(!oShell.StdErr.AtEndOfStream)
+    {
+        var line = oShell.StdErr.ReadAll();
+        WScript.StdErr.WriteLine(line);
+        WScript.Quit(1);
+    }
+}
+
+function build_js(path)
+{
+    if(fso.FolderExists(path + '\\temp'))
+    {
+        fso.DeleteFolder(path + '\\temp', true);
+    }
+    fso.CreateFolder(path + '\\temp');
+    wscript_shell.CurrentDirectory = path + '\\temp';
+
+    WScript.StdOut.WriteLine('\tCloning js tagged with ' + VERSION + '...');
+    exec('%comspec% /c git clone ' + CORDOVA_JS + ' && cd cordova-js && git fetch && git checkout ' + VERSION );
+    if(!fso.FolderExists(path + '\\temp\\cordova-js'))
+    {
+        WScript.StdErr.WriteLine("ERROR: Failed to clone cordova-js. Aborting...");
+        WScript.Quit(1);
+    }
+    wscript_shell.CurrentDirectory = path + '\\temp\\cordova-js';
+    WScript.StdOut.WriteLine("Building Cordova.js...");
+
+    exec_verbose('%comspec% /c jake build');
+    if(!fso.FolderExists(path + '\\temp\\cordova-js\\pkg'))
+    {
+        WScript.StdErr.WriteLine("ERROR: Failed to build cordova-js. Aborting...");
+        WScript.Quit(1);
+    }
+
+    //copy the javascript wherever it needs to go.
+    wscript_shell.CurrentDirectory = path + '\\temp\\cordova-js\\pkg';
+    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + STANDALONE_PATH + '\\www\\cordova-' + VERSION + '.js');
+    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + FULL_PATH + '\\www\\cordova-' + VERSION + '.js');
+    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + CUSTOM_PATH + '\\www\\cordova-' + VERSION + '.js');
+    exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + EXAMPLE_PATH + '\\www\\cordova-' + VERSION + '.js');
+
+    //TODO: Delete old cordova.js (done in reversion.js)
+
+    WScript.StdOut.WriteLine("SUCESS");
+}
+
+function set_path(some_arg)
+{
+    if(some_arg.indexOf('-p:')!= -1)
+    {
+        var path = some_arg.split('-p:')[1];
+        if(fso.FolderExists(path) && fso.FolderExists(path + '\\tooling'))
+        {
+            BUILD_DESTINATION = path;
+            return true;
+        }
+        else
+        {
+            WScript.StdOut.WriteLine("ERROR: The given path is not a cordova-wp8 repo, or");
+            WScript.StdOut.WriteLine(" does not exist. If your trying to reversion a");
+            WScript.StdOut.WriteLine(" cordova repo other then this one, please provide");
+            WScript.StdOut.WriteLine(" it's path in the form: -p:C:\\Path\\to\\repo");
+            WScript.Quit(1);
+        }
+        
+    }
+    return false;
+}
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 1)
+{
+    set_path(args(1));
+}
+
+if(args.Count() > 0)
+{
+    //Support help flags
+    if(args(0).indexOf("--help") > -1 ||
+         args(0).indexOf("/?") > -1 )
+    {
+        Usage();
+        WScript.Quit(1);
+    }
+
+    if(args(0).match(/(\d+)[.](\d+)[.](\d+)(rc\d)?/))
+    {
+        VERSION = args(0);
+        if(args.Count()  == 1)
+        {
+            BUILD_DESTINATION = ROOT;
+        }
+    }
+    else if(set_path(arg(0))) {} //do nothing
+    else
+    {
+        WScript.StdOut.WriteLine("The provided version number is invalid, please provide");
+        WScript.StdOut.WriteLine(" a version number in the format Major.Minor.Fix[rc#]")
+        Usage();
+        WScript.Quit(1);
+    }
+}
+else
+{
+    BUILD_DESTINATION = ROOT;
+}
+
+//If we haven't quit by here, build the damn javascript!
+WScript.StdOut.WriteLine("Creating js for " + BUILD_DESTINATION);
+build_js(BUILD_DESTINATION);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/debug.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/debug.bat b/tooling/scripts/debug.bat
index 4efc80c..abf851d 100644
--- a/tooling/scripts/debug.bat
+++ b/tooling/scripts/debug.bat
@@ -1,68 +1,2 @@
-
 @echo off
-goto start
-
-
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
-
-:start
-
-
-if /i "%1"=="help" goto usage
-if /i "%1"=="-help" goto usage
-if /i "%1"=="--help" goto usage
-if /i "%1"=="/help" goto usage
-if /i "%1"=="/?" goto usage
-
-
-if defined VCINSTALLDIR goto start-msbuild
-if not defined VS100COMNTOOLS goto msbuild-missing
-if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-missing
-call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat"
-if not defined VCINSTALLDIR goto msbuild-missing
-goto start-msbuild
-
-
-:builderror
-echo Error level 1
-goto exit
-
-:msbuild-missing
-echo Error! Cannot run msbuild from this command prompt.  Try running a VS Command prompt.
-goto exit
-
-
-:start-msbuild
-cd ..
-msbuild /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo /p:Configuration=Debug
-cd cordova
-if errorlevel 1 goto builderror
-goto deploy
-
-:usage
-echo "Usage: %0"
-echo "solution file is expected to be in the parent folder."
-goto exit
-
-:deploy
-CordovaDeploy ../Bin/Debug -d:1
-
-
-:exit
-
-
+cscript "%~dp0\deploy.js" %1 -debug //nologo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/deploy.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/deploy.js b/tooling/scripts/deploy.js
new file mode 100644
index 0000000..17b884b
--- /dev/null
+++ b/tooling/scripts/deploy.js
@@ -0,0 +1,270 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+    wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+    ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+    // path to CordovaDeploy.exe
+    CORDOVA_DEPLOY_EXE = '\\tooling\\CordovaDeploy\\CordovaDeploy\\bin\\Debug\\CordovaDeploy.exe',
+    // path to CordovaDeploy
+    CORDOVA_DEPLOY = '\\tooling\\CordovaDeploy';
+
+
+// help function
+function Usage()
+{
+    WScript.StdOut.WriteLine("");
+    WScript.StdOut.WriteLine("Usage: [ debug | emulate ] [ PathTOProjectFolder ] ");
+    WScript.StdOut.WriteLine("    PathTOProjectFolder : The path to the project being launched.");
+    WScript.StdOut.WriteLine("examples:");
+    WScript.StdOut.WriteLine("    debug C:\\Users\\anonymous\\Desktop\\MyProject");
+    WScript.StdOut.WriteLine("    emulate C:\\Users\\anonymous\\Desktop\\MyBetterProject");
+    WScript.StdOut.WriteLine("    deploy C:\\Users\\anonymous\\Desktop\\TheProject -emulate");
+    WScript.StdOut.WriteLine("");
+}
+
+
+
+var ForReading = 1, ForWriting = 2, ForAppending = 8;
+var TristateUseDefault = 2, TristateTrue = 1, TristateFalse = 0;
+
+
+// executes a commmand in the shell
+function exec(command) {
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        WScript.sleep(100);
+    }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+    //WScript.StdOut.WriteLine("Command: " + command);
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        //Wait a little bit so we're not super looping
+        WScript.sleep(100);
+        //Print any stdout output from the script
+        if(!oShell.StdOut.AtEndOfStream) {
+            var line = oShell.StdOut.ReadLine();
+            WScript.StdOut.WriteLine(line);
+        }
+    }
+    //Check to make sure our scripts did not encounter an error
+    if(!oShell.StdErr.AtEndOfStream)
+    {
+        var line = oShell.StdErr.ReadAll();
+        WScript.StdErr.WriteLine(line);
+        WScript.Quit(1);
+    }
+}
+
+// returns the contents of a file
+function read(filename) {
+    //WScript.Echo('Reading in ' + filename);
+    if(fso.FileExists(filename))
+    {
+        var f=fso.OpenTextFile(filename, 1,2);
+        var s=f.ReadAll();
+        f.Close();
+        return s;
+    }
+    else
+    {
+        WScript.StdErr.WriteLine('Cannot read non-existant file : ' + filename);
+        WScript.Quit(1);
+    }
+    return null;
+}
+
+// builds the project and .xap
+function build_xap(path)
+{
+    WScript.StdOut.WriteLine("Building Cordova-WP8 Project:");
+    WScript.StdOut.WriteLine("\tDirectory : " + path);
+
+    // delete any previously generated files
+    if(fso.FolderExists(path + "\\obj"))
+    {
+        fso.DeleteFolder(path + "\\obj");
+    }
+    if(fso.FolderExists(path + "\\Bin"))
+    {
+        fso.DeleteFolder(path + "\\Bin");
+    }
+    
+    wscript_shell.CurrentDirectory = path;
+    exec_verbose('msbuild CordovaAppProj.csproj');
+    //From original bat : msbuild /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo /p:Configuration=Debug
+
+    //Get package name
+    //TODO: find a better way to do this (title in WPAppManifest? not always the name of the xap)
+    /*var app = read(path + '\\App.xaml');
+    var temp = app.match(/x\:Class\=\"(.*)\"/)[0].split('.', 1);
+    var app_name = temp.toString().split('"')[1];
+
+    //Check if file xap was created
+    if(!fso.FileExists(path + '\\Bin\\Debug\\' + app_name + '.xap'))
+    {
+        WScript.StdErr.WriteLine('ERROR: MSBuild failed to create .xap when building cordova-wp8.');
+        WScript.Quit(1);
+    }
+    WScript.StdOut.WriteLine("SUCESS");
+
+    WScript.StdOut.WriteLine("BUILD SUCCESS.");*/
+}
+
+// builds the CordovaDeploy.exe if it does not already exist 
+function cordovaDeploy()
+{
+    if(fso.FileExists(ROOT + CORDOVA_DEPLOY_EXE))
+    {
+        return true;
+    }
+
+    WScript.StdOut.WriteLine("CordovaDeploy.exe not found, attempting to build CordovaDeploy.exe...");
+
+    //Build CordovaDeploy.exe
+    if(fso.FolderExists(ROOT + '\\tooling') && fso.FolderExists(ROOT + CORDOVA_DEPLOY) && 
+        fso.FileExists(ROOT + CORDOVA_DEPLOY + '\\CordovaDeploy.sln'))
+    {
+        // delete any previously generated files
+        if(fso.FolderExists(ROOT + CORDOVA_DEPLOY + "\\CordovaDeploy\\obj"))
+        {
+            fso.DeleteFolder(ROOT + CORDOVA_DEPLOY + "\\CordovaDeploy\\obj");
+        }
+        if(fso.FolderExists(ROOT + CORDOVA_DEPLOY + "\\CordovaDeploy\\Bin"))
+        {
+            fso.DeleteFolder(ROOT + CORDOVA_DEPLOY + "\\CordovaDeploy\\Bin");
+        }
+        exec_verbose('msbuild ' + ROOT + CORDOVA_DEPLOY + '\\CordovaDeploy.sln');
+
+        if(fso.FileExists(ROOT + CORDOVA_DEPLOY_EXE))
+        {
+            WScript.StdOut.WriteLine("MSBUILD COMPLETE, SUCCESS.");
+            return true;
+        }
+        else
+        {
+            WScript.StdOut.WriteLine("MSBUILD FAILED TO COMPILE CordovaDeploy.exe");
+            return false;
+        }
+    }
+    else
+    {
+        return false;
+    }
+}
+
+//TODO: Output errors from CordovaDeploy so user can troubleshoot problems
+
+// builds and launches project on device
+function debug(path)
+{
+    if(cordovaDeploy() && fso.FileExists(ROOT + CORDOVA_DEPLOY_EXE))
+    {
+        build_xap(path);
+        WScript.StdOut.WriteLine('Deploying to device ...');
+        exec_verbose('%comspec% /c ' + ROOT + CORDOVA_DEPLOY_EXE + ' ' + path + ' -d:0');
+    }
+    else
+    {
+        WScript.StdOut.WriteLine("Error: Failed to find/build CordovaDeploy.exe");
+        WScript.StdOut.WriteLine("DEPLOY FAILED.");
+        WScript.Quit(1);
+    }
+}
+
+// builds and launches project on emulator
+function emulate(path)
+{
+    if(cordovaDeploy() && fso.FileExists(ROOT + CORDOVA_DEPLOY_EXE))
+    {
+        build_xap(path);
+        WScript.StdOut.WriteLine('Deploying to emulator ...');
+        exec_verbose('%comspec% /c ' + ROOT + CORDOVA_DEPLOY_EXE + ' ' + path + ' -d:1');
+    }
+    else
+    {
+        WScript.StdOut.WriteLine("Error: Failed to find/build CordovaDeploy.exe");
+        WScript.StdOut.WriteLine("DEPLOY FAILED.");
+        WScript.Quit(1);
+    }
+}
+
+
+var project_path;
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 0)
+{
+    // support help flags
+    if(args(0) == "--help" || args(0) == "/?" ||
+            args(0) == "help" || args(0) == "-help" || args(0) == "/help")
+    {
+        Usage();
+        WScript.Quit(1);
+    }
+    else if(args.Count() > 2)
+    {
+        WScript.StdOut.WriteLine("Error: Too many arguments.");
+        Usage();
+        WScript.Quit(1);
+    }
+    else if(fso.FolderExists(args(0)))
+    {
+        if(args.Count() > 1)
+        {
+            if(args(1) == "-emulate" || args(1) == "-e")
+            {
+                emulate(args(0));
+            }
+            else if(args(1) == "-debug" || args(1) == "-d")
+            {
+                debug(args(0));
+            }
+            else
+            {
+                WScript.StdOut.WriteLine("Error: \"" + arg(1) + "\" is not recognized as a deploy option");
+                Usage();
+                WScript.Quit(1);
+            }
+        }
+        else
+        {
+            WScript.StdOut.WriteLine("WARNING: Debug/Emulate not specified, defaulting to emulate...");
+            emulate(args(0));
+        }
+    }
+    else
+    {
+        WScript.StdOut.WriteLine("Error: Project directory not found,");
+        WScript.StdOut.WriteLine("please ensure you give the path to your project.");
+        Usage();
+        WScript.Quit(1);
+    }
+}
+else
+{
+    Usage();
+    WScript.Quit(1);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/dist.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/dist.bat b/tooling/scripts/dist.bat
new file mode 100644
index 0000000..a1c0e1d
--- /dev/null
+++ b/tooling/scripts/dist.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript "%~dp0\dist.js" %* //nologo

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/dist.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/dist.js b/tooling/scripts/dist.js
new file mode 100644
index 0000000..c65d2d2
--- /dev/null
+++ b/tooling/scripts/dist.js
@@ -0,0 +1,190 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+
+/*************************************************/
+/****************  REQUIREMENTS  *****************/
+/*************************************************/
+/*
+Paths:
+  - path to git.exe  -> C:\msysgit\bin
+  - path to msbuild -> C:\Windows\Microsoft.NET\Framework\v4.0.30319
+Famework
+  - .NET 4.0
+  - Windows phone SDKs
+
+
+/************ Globals ********/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+    wscript_shell = WScript.CreateObject("WScript.Shell");
+
+//Replace root directory or create new directory?
+var REPLACE = false;
+
+//Set up directory structure of current release
+    //arguments passed in
+var args = WScript.Arguments,
+    //Root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+    ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+    // tooling scripts
+    SCRIPTS = '\\tooling\\scripts';
+    //Get version number
+    VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
+
+//Destination to build to
+var BUILD_DESTINATION;
+//current script that is running
+var current_script = "dist";
+
+
+/*************************************************/
+/****************  FUNCTIONS  ********************/
+/*************************************************/
+
+
+// help function
+function Usage()
+{
+  WScript.StdOut.WriteLine("");
+  WScript.StdOut.WriteLine("This is a command line tool for building new releases.")
+  WScript.StdOut.WriteLine("Usage: dist <NEW_PATH_FOR_BUILD>");
+  WScript.StdOut.WriteLine("Creates and packages a new cordova/wp8 project, reversioning");
+  WScript.StdOut.WriteLine("it to match the VERSION file in the root directory.");
+  WScript.StdOut.WriteLine("");
+}
+
+
+// returns the contents of a file
+function read(filename) {
+    //WScript.Echo('Reading in ' + filename);
+    if(fso.FileExists(filename))
+    {
+        var f=fso.OpenTextFile(filename, 1,2);
+        var s=f.ReadAll();
+        f.Close();
+        return s;
+    }
+    else
+    {
+        WScript.StdOut.WriteLine('Cannot read non-existant file : ' + filename);
+        WScript.Quit(1);
+    }
+    return null;
+}
+
+// executes a commmand in the shell
+function exec(command) {
+    //WScript.StdOut.WriteLine("Command: " + command);
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        //Wait a little bit so we're not super looping
+        WScript.sleep(100);
+        //Print any stdout output from the script
+        if(!oShell.StdOut.AtEndOfStream) {
+            var line = oShell.StdOut.ReadLine();
+            WScript.StdOut.WriteLine(line);
+        }
+    }
+    //Check to make sure our scripts did not encounter an error
+    if(!oShell.StdErr.AtEndOfStream)
+    {
+        var line = oShell.StdErr.ReadAll();
+        WScript.StdErr.WriteLine(line);
+        WScript.StdErr.WriteLine("ERROR: Could not complete distribution, failed while running: " + current_script);
+        WScript.Quit(1);
+    }
+}
+
+function space()
+{
+    WScript.StdOut.WriteLine("");
+    WScript.StdOut.WriteLine("*****************************************************");
+    WScript.StdOut.WriteLine("");
+}
+
+
+/*************************************************/
+/**************  MAIN SCRIPT  ********************/
+/*************************************************/
+
+if(REPLACE)
+{
+    BUILD_DESTINATION = ROOT;
+}
+else if(args.Count() > 0)
+{
+    BUILD_DESTINATION = args(0);
+    //Support help flags
+    if(BUILD_DESTINATION.indexOf("--help") > -1 ||
+         BUILD_DESTINATION.indexOf("/?") > -1 )
+    {
+        Usage();
+        WScript.Quit(1);
+    }
+}
+else
+{
+    Usage();
+    WScript.Quit(1);
+}
+
+
+/*************************************************/
+/******************  Step 1  *********************/
+/*************************************************/
+/** - Copy source code to new directory         **/
+/*************************************************/
+current_script = "new.js";
+exec('cscript ' + ROOT + SCRIPTS + '\\new.js ' + BUILD_DESTINATION + ' //nologo');
+space();
+
+/*************************************************/
+/******************  Step 2  *********************/
+/*************************************************/
+/** - Retag everything with new version numbers **/
+/** - Delete any generated files and cordova.js **/
+/** - Rebuild dll                               **/
+/*************************************************/
+current_script = "reversion.js";
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\reversion.js ' + VERSION + ' //nologo');
+space();
+
+/*************************************************/
+/******************  Step 3  *********************/
+/*************************************************/
+/** - Download tagged version of cordova.js     **/
+/** - build cordova.js                          **/
+/** - windows.cordova.js -> templates + example **/
+/*************************************************/
+current_script = "buildjs.js";
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo');
+space();
+
+/*************************************************/
+/******************  Step 5  *********************/
+/*************************************************/
+/** - Build templates                           **/
+/** - Zip templates                             **/
+/** - inject into Visual Studio                 **/
+/*************************************************/
+current_script = "package.js";
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\package.js //nologo');
+space();
+WScript.StdOut.WriteLine("Distribution Complete.");
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/emulate.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/emulate.bat b/tooling/scripts/emulate.bat
index b3375fe..f6e76cf 100644
--- a/tooling/scripts/emulate.bat
+++ b/tooling/scripts/emulate.bat
@@ -1,24 +1,2 @@
-
 @echo off
-goto start
-
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
-
-
-:start
-CordovaDeploy ../Bin/Debug -d:1
\ No newline at end of file
+cscript "%~dp0\deploy.js" %1 -emulate //nologo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/new.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/new.bat b/tooling/scripts/new.bat
new file mode 100644
index 0000000..cb08e2e
--- /dev/null
+++ b/tooling/scripts/new.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript "%~dp0\new.js" %* //nologo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/new.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/new.js b/tooling/scripts/new.js
new file mode 100644
index 0000000..fa4b63c
--- /dev/null
+++ b/tooling/scripts/new.js
@@ -0,0 +1,153 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+    shell = WScript.CreateObject("shell.application"),
+    wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+    //Root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+    ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+    //Sub folder containing templates
+    TEMPLATES_PATH = '\\templates',
+    //Sub folder containing framework
+    FRAMEWORK_PATH = '\\framework',
+    //Subfolder containing example project
+    EXAMPLE_PATH = '\\example';
+// git repo for cordova-wp8
+var CORDOVA_WP8 = 'git://github.com/apache/cordova-wp8.git';
+//Destination to build to
+var BUILD_DESTINATION;
+// pull the project down from github?
+var GET_NEW = false;
+//Add templates to visual studio?
+var ADD_TO_VS = false;
+
+// help function
+function Usage()
+{
+    WScript.StdOut.WriteLine("");
+    WScript.StdOut.WriteLine("Usage: new [ PathToDestinationFolder ]");
+    WScript.StdOut.WriteLine("    PathToDestinationFolder : Folder you wish to be created for a new cordova-wp8 repo");
+    WScript.StdOut.WriteLine("examples:");
+    WScript.StdOut.WriteLine("    new C:\\Users\\anonymous\\Desktop\\cordova-wp8");
+    WScript.StdOut.WriteLine("");
+}
+
+// returns the contents of a file
+function read(filename) {
+    //WScript.StdOut.WriteLine('Reading in ' + filename);
+    if(fso.FileExists(filename))
+    {
+        var f=fso.OpenTextFile(filename, 1,2);
+        var s=f.ReadAll();
+        f.Close();
+        return s;
+    }
+    else
+    {
+        WScript.StdOut.WriteLine('Cannot read non-existant file : ' + filename);
+        WScript.Quit(1);
+    }
+    return null;
+}
+
+// executes a commmand in the shell
+function exec(command) {
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        WScript.sleep(100);
+    }
+}
+
+function copy_to(path)
+{
+    //Copy everything over to BUILD_DESTINATION
+    var dest = shell.NameSpace(path);
+    WScript.StdOut.WriteLine("Copying files to build directory...");
+
+    /** copy by file instead? (just what we need)**/
+    dest.CopyHere(ROOT + "\\bin", 4|20);
+    dest.CopyHere(ROOT + EXAMPLE_PATH, 4|20);      //Should mostly be copied from standalone
+    dest.CopyHere(ROOT + FRAMEWORK_PATH, 4|20);
+    dest.CopyHere(ROOT + TEMPLATES_PATH, 4|20);
+    dest.CopyHere(ROOT + "\\tests", 4|20);
+    dest.CopyHere(ROOT + "\\tooling", 4|20);
+    dest.CopyHere(ROOT + "\\.gitignore", 4|20);
+    dest.CopyHere(ROOT + "\\LICENSE", 4|20);
+    dest.CopyHere(ROOT + "\\NOTICE", 4|20);
+    dest.CopyHere(ROOT + "\\README.md", 4|20);
+    dest.CopyHere(ROOT + "\\VERSION", 4|20);
+}
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 0)
+{
+    if(fso.FolderExists(args(0)))
+    {
+        WScript.StdOut.WriteLine("The given directory already exists!");
+        Usage();
+        WScript.Quit(1);
+    }
+    else
+    {
+        BUILD_DESTINATION = args(0);
+
+    }
+
+    if(!GET_NEW) {
+
+        if(fso.FolderExists(BUILD_DESTINATION))
+        {
+            WScript.StdOut.WriteLine("The given directory already exists!");
+            Usage();
+            WScript.Quit(1);
+        }
+        else
+        {
+            BUILD_DESTINATION = args(0);
+        }
+
+        // set up file structure
+        fso.CreateFolder(BUILD_DESTINATION);
+        // copy nessisary files
+        copy_to(BUILD_DESTINATION);
+    }
+    else
+    {
+        wscript_shell.CurrentDirectory = arg(0) + '\\..';
+        BUILD_DESTINATION = wscript_shell.CurrentDirectory + '\\cordova-wp8';
+
+        WScript.StdOut.WriteLine('Cloning cordova-wp8 from git, build destination now ' + BUILD_DESTINATION);
+        if(fso.FolderExists(BUILD_DESTINATION))
+        {
+            WScript.StdOut.WriteLine("Could not clone cordova-wp8 from git because it's directory already exists!");
+            WScript.Quit(1);
+        }
+
+        exec('git clone ' + CORDOVA_WP8); //git fetch --tags && git checkout?
+
+    }
+}
+else
+{
+    Usage();
+    WScript.Quit(1);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/package.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/package.bat b/tooling/scripts/package.bat
new file mode 100644
index 0000000..c00551e
--- /dev/null
+++ b/tooling/scripts/package.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript "%~dp0\package.js" %* //nologo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/package.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/package.js b/tooling/scripts/package.js
new file mode 100644
index 0000000..00f3221
--- /dev/null
+++ b/tooling/scripts/package.js
@@ -0,0 +1,262 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+    shell = WScript.CreateObject("shell.application"),
+    wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+    // root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+    ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+    // sub folder containing templates
+    TEMPLATES_PATH = '\\templates',
+    // sub folder for standalone project
+    STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+    // sub folder for full project
+    FULL_PATH = TEMPLATES_PATH + '\\full',
+    CUSTOM_PATH = TEMPLATES_PATH + '\\custom',
+    // sub folder containing framework
+    FRAMEWORK_PATH = '\\framework',
+    // subfolder containing example project
+    EXAMPLE_PATH = '\\example',
+    // get version number
+    VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''),
+    BASE_VERSION = VERSION.split('rc', 1) + ".0";
+
+// destination directory to package
+var BUILD_DESTINATION;
+// add templates to visual studio?
+var ADD_TO_VS = true;
+
+// help function
+function Usage()
+{
+    WScript.StdOut.WriteLine("");
+    WScript.StdOut.WriteLine("Usage: package [ PathToCordovaWP8 ]");
+    WScript.StdOut.WriteLine("    PathToCordovaWP8 : Cordova-wp8 repo you wish to package for release");
+    WScript.StdOut.WriteLine("examples:");
+    WScript.StdOut.WriteLine("    package C:\\Users\\anonymous\\Desktop\\cordova-wp8");
+    WScript.StdOut.WriteLine("    package     // packages current cordova directory");
+    WScript.StdOut.WriteLine("");
+}
+
+// returns the contents of a file
+function read(filename) {
+    //WScript.StdOut.WriteLine('Reading in ' + filename);
+    if(fso.FileExists(filename))
+    {
+        var f=fso.OpenTextFile(filename, 1,2);
+        var s=f.ReadAll();
+        f.Close();
+        return s;
+    }
+    else
+    {
+        WScript.StdOut.WriteLine('ERROR: Cannot read non-existant file : ' + filename);
+        WScript.Quit(1);
+    }
+    return null;
+}
+
+// executes a commmand in the shell
+function exec(command) {
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        WScript.sleep(100);
+    }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+    //WScript.StdOut.WriteLine("Command: " + command);
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        //Wait a little bit so we're not super looping
+        WScript.sleep(100);
+        //Print any stdout output from the script
+        if(!oShell.StdOut.AtEndOfStream) {
+            var line = oShell.StdOut.ReadLine();
+            WScript.StdOut.WriteLine(line);
+        }
+    }
+    //Check to make sure our scripts did not encounter an error
+    if(!oShell.StdErr.AtEndOfStream)
+    {
+        var line = oShell.StdErr.ReadAll();
+        WScript.StdErr.WriteLine(line);
+        WScript.Quit(1);
+    }
+}
+
+// packages templates into .zip
+function package_templates()
+{
+    WScript.StdOut.WriteLine("Creating template .zip files ...");
+
+    var standalone_zip = BUILD_DESTINATION + '\\CordovaWP8_' + VERSION.replace(/\./g, '_') + '_StandAlone.zip';
+    var full_zip = BUILD_DESTINATION + '\\CordovaWP8_' + VERSION.replace(/\./g, '_') + '_Full.zip';
+    var custom_zip = BUILD_DESTINATION + '\\CordovaWP8_' + VERSION.replace(/\./g, '_') + '_Custom.zip';
+    if(fso.FileExists(standalone_zip))
+    {
+      fso.DeleteFile(standalone_zip);
+    }
+    if(fso.FileExists(full_zip))
+    {
+      fso.DeleteFile(full_zip);
+    }
+
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateFull.vstemplate ' + BUILD_DESTINATION + FULL_PATH + '\\MyTemplate.vstemplate');
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templateIcon.png ' + BUILD_DESTINATION + FULL_PATH + '\\__TemplateIcon.png');
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templatePreview.jpg ' + BUILD_DESTINATION + FULL_PATH + '\\__PreviewImage.jpg');
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION + FULL_PATH);
+    if(fso.FileExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin\\Release\\WPCordovaClassLib.dll'))
+    {
+        exec('%comspec% /c /Y copy Bin\\Release\\WPCordovaClassLib.dll ' + BUILD_DESTINATION + FULL_PATH + '\\CordovaLib');
+    }
+    else
+    {
+        WScript.StdOut.WriteLine("WARNING: WPCordovaClassLib.dll No found! Trying to build dll.");
+        build_dll();
+    }
+
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate ' + BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate');
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templateIcon.png ' + BUILD_DESTINATION + STANDALONE_PATH + '\\__TemplateIcon.png');
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templatePreview.jpg ' + BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg');
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION + STANDALONE_PATH);
+
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateCustom.vstemplate ' + BUILD_DESTINATION + CUSTOM_PATH + '\\MyTemplate.vstemplate');
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templateIcon.png ' + BUILD_DESTINATION + CUSTOM_PATH + '\\__TemplateIcon.png');
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templatePreview.jpg ' + BUILD_DESTINATION + CUSTOM_PATH + '\\__PreviewImage.jpg');
+    exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION + CUSTOM_PATH);
+
+    exec('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + full_zip + ' ' + BUILD_DESTINATION + FULL_PATH + '\\');
+    exec('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + standalone_zip + ' ' + BUILD_DESTINATION + STANDALONE_PATH + '\\');
+    exec('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + custom_zip + ' ' + BUILD_DESTINATION + CUSTOM_PATH + '\\');
+
+
+    if(ADD_TO_VS)
+    {
+        var template_dir = wscript_shell.ExpandEnvironmentStrings("%USERPROFILE%") + '\\Documents\\Visual Studio 2012\\Templates\\ProjectTemplates';
+        if(fso.FolderExists(template_dir ))
+        {
+            dest = shell.NameSpace(template_dir);
+            dest.CopyHere(standalone_zip, 4|20);
+            dest.CopyHere(full_zip, 4|20);
+            dest.CopyHere(custom_zip, 4|20);
+        }
+        else
+        {
+            WScript.StdOut.WriteLine("WARNING: Could not find template directory in Visual Studio,\n you can manually copy over the template .zip files.")
+        }
+  }
+}
+
+// builds the new cordova dll and copys it to the full template (only done because of the version referance in Device.cs)
+function build_dll()
+{
+    WScript.StdOut.WriteLine("Packaging .dll ...");
+    // move to framework directory
+    wscript_shell.CurrentDirectory = BUILD_DESTINATION + FRAMEWORK_PATH;
+    // build .dll in Release
+    exec_verbose('msbuild /p:Configuration=Release;VersionNumber=' + VERSION + ';BaseVersionNumber=' + BASE_VERSION);
+    //Check if file dll was created
+    if(!fso.FileExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin\\Release\\WPCordovaClassLib.dll'))
+    {
+        WScript.StdErr.WriteLine('ERROR: MSBuild failed to create .dll.');
+        WScript.Quit(1);
+    }
+
+    if(!fso.FolderExists(BUILD_DESTINATION + FULL_PATH + '\\CordovaLib'))
+    {
+        fso.CreateFolder(BUILD_DESTINATION + FULL_PATH + '\\CordovaLib');
+    }
+    exec('%comspec% /c copy Bin\\Release\\WPCordovaClassLib.dll ' + BUILD_DESTINATION + FULL_PATH + '\\CordovaLib');
+
+    WScript.StdOut.WriteLine("SUCESS");
+}
+
+// delete any unnessisary files when finished
+function cleanUp() {
+
+  if(fso.FileExists(BUILD_DESTINATION + FULL_PATH + '\\MyTemplate.vstemplate')) {
+      fso.DeleteFile(BUILD_DESTINATION + FULL_PATH + '\\MyTemplate.vstemplate');
+  }
+  if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate')) {
+      fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate');
+  }
+  if(fso.FileExists(BUILD_DESTINATION + CUSTOM_PATH + '\\MyTemplate.vstemplate')) {
+      fso.DeleteFile(BUILD_DESTINATION + CUSTOM_PATH + '\\MyTemplate.vstemplate');
+  }
+  if(fso.FileExists(BUILD_DESTINATION + FULL_PATH + '\\__PreviewImage.jpg')) {
+      fso.DeleteFile(BUILD_DESTINATION + FULL_PATH + '\\__PreviewImage.jpg');
+  }
+  if(fso.FileExists(BUILD_DESTINATION + FULL_PATH + '\\__TemplateIcon.png')) {
+      fso.DeleteFile(BUILD_DESTINATION + FULL_PATH + '\\__TemplateIcon.png');
+  }
+  if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg')) {
+      fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg');
+  }
+  if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\__TemplateIcon.png')) {
+      fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\__TemplateIcon.png');
+  }
+  if(fso.FileExists(BUILD_DESTINATION + CUSTOM_PATH + '\\__PreviewImage.jpg')) {
+      fso.DeleteFile(BUILD_DESTINATION + CUSTOM_PATH + '\\__PreviewImage.jpg');
+  }
+  if(fso.FileExists(BUILD_DESTINATION + CUSTOM_PATH + '\\__TemplateIcon.png')) {
+      fso.DeleteFile(BUILD_DESTINATION + CUSTOM_PATH + '\\__TemplateIcon.png');
+  }
+  //Add any other cleanup here
+}
+
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 0)
+{
+    //Support help flags
+    if(args(0).indexOf("--help") > -1 ||
+         args(0).indexOf("/?") > -1 )
+    {
+        Usage();
+        WScript.Quit(1);
+    }
+
+    if(fso.FolderExists(args(0)) && fso.FolderExists(args(0) + '\\tooling'))
+    {
+        BUILD_DESTINATION = args(0);
+    }
+    else
+    {
+        WScript.StdOut.WriteLine("ERROR: The given directory is not a cordova-wp8 repo.");
+        Usage();
+        WScript.Quit(1);
+
+    }
+}
+else
+{
+    BUILD_DESTINATION = ROOT;
+}
+
+// build dll for full template
+//build_dll();
+// build/package the templates
+package_templates(BUILD_DESTINATION);
+
+cleanUp();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/reversion.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/reversion.bat b/tooling/scripts/reversion.bat
new file mode 100644
index 0000000..b35ab08
--- /dev/null
+++ b/tooling/scripts/reversion.bat
@@ -0,0 +1,2 @@
+@echo off
+cscript "%~dp0\reversion.js" %* //nologo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/reversion.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/reversion.js b/tooling/scripts/reversion.js
new file mode 100644
index 0000000..03981d0
--- /dev/null
+++ b/tooling/scripts/reversion.js
@@ -0,0 +1,348 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+
+/************ Globals ********/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+    shell = WScript.CreateObject("shell.application"),
+    wscript_shell = WScript.CreateObject("WScript.Shell");
+
+//Get new version from git or build off this version?
+var GET_NEW = false;
+
+//Set up directory structure of current release
+    //arguments passed in
+var args = WScript.Arguments,
+    //Root folder of cordova-wp8 (i.e C:\Cordova\cordova-wp8)
+    ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+    //Sub folder containing templates
+    TEMPLATES_PATH = '\\templates',
+    //Sub folder for standalone project
+    STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+    //Sub folder for full project
+    FULL_PATH = TEMPLATES_PATH + '\\full',
+    //Sub folder for custom project
+    CUSTOM_PATH = TEMPLATES_PATH + '\\custom',
+    //Sub folder containing framework
+    FRAMEWORK_PATH = '\\framework',
+    //Subfolder containing example project
+    EXAMPLE_PATH = '\\example',
+    //Path to cordovalib folder, containing source for .dll
+    CORDOVA_LIB = STANDALONE_PATH + '\\cordovalib',
+    //Get version number
+    VERSION='',
+    BASE_VERSION = '';
+
+//Destination to build to
+var BUILD_DESTINATION;
+
+// help function
+function Usage()
+{
+    WScript.StdOut.WriteLine("");
+    WScript.StdOut.WriteLine("Usage: reversion [ Version PathTOCordovaWP8 ]");
+    WScript.StdOut.WriteLine("    Version : The new version for codova-wp8");
+    WScript.StdOut.WriteLine("    PathTOCordovaWP8 : The path to the cordova directory being reversioned.");
+    WScript.StdOut.WriteLine("examples:");
+    WScript.StdOut.WriteLine("    reversion 2.5.0rc1  //Reversions the current working directory");
+    WScript.StdOut.WriteLine("    reversion 2.5.0 C :\\Users\\anonymous\\Desktop\\cordova-wp8");
+    WScript.StdOut.WriteLine("");
+}
+
+var ForReading = 1, ForWriting = 2, ForAppending = 8;
+var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
+
+// returns the contents of a file
+function read(filename) {
+    //WScript.Echo('Reading in ' + filename);
+    if(fso.FileExists(filename))
+    {
+        var f=fso.OpenTextFile(filename, 1,2);
+        var s=f.ReadAll();
+        f.Close();
+        return s;
+    }
+    else
+    {
+        WScript.StdErr.WriteLine('Cannot read non-existant file : ' + filename);
+        WScript.Quit(1);
+    }
+    return null;
+}
+
+// writes the contents to the specified file
+function write(filename, contents) {
+    var f=fso.OpenTextFile(filename, ForWriting, TristateTrue);
+    f.Write(contents);
+    f.Close();
+}
+
+// replaces the matches of regexp with replacement
+function replaceInFile(filename, regexp, replacement) {
+    //WScript.Echo("Replaceing with "+replacement+ " in:");
+    var text = read(filename).replace(regexp,replacement);
+    //WScript.Echo(text);
+    write(filename,text);
+}
+
+// executes a commmand in the shell
+function exec(command) {
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        WScript.sleep(100);
+    }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+    //WScript.StdOut.WriteLine("Command: " + command);
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        //Wait a little bit so we're not super looping
+        WScript.sleep(100);
+        //Print any stdout output from the script
+        if(!oShell.StdOut.AtEndOfStream) {
+            var line = oShell.StdOut.ReadLine();
+            WScript.StdOut.WriteLine(line);
+        }
+    }
+    //Check to make sure our scripts did not encounter an error
+    if(!oShell.StdErr.AtEndOfStream)
+    {
+        var line = oShell.StdErr.ReadAll();
+        WScript.StdErr.WriteLine(line);
+        WScript.Quit(1);
+    }
+}
+
+function updateVersionNumbers() {
+    WScript.StdOut.WriteLine("Updating version numbers....");
+    var version_regex = /(\d+)[.](\d+)[.](\d+)(rc\d)?/
+    replaceInFile(BUILD_DESTINATION + '\\VERSION', version_regex,  VERSION);
+    // replace assembaly versions in framework
+    var framework_regex = /Description\(\"(\d+)[.](\d+)[.](\d+)(rc\d)?\"\)\]/; //Will match ("x.x.x[rcx]")]
+    replaceInFile(BUILD_DESTINATION + FRAMEWORK_PATH + "\\Properties\\AssemblyInfo.cs", framework_regex, "Description(\"" + VERSION + "\")]");
+    framework_regex = /Version\(\"(\d+)[.](\d+)[.](\d+)[.](\d+)\"\)\]/g;
+    replaceInFile(BUILD_DESTINATION + FRAMEWORK_PATH + "\\Properties\\AssemblyInfo.cs", framework_regex, "Version(\"" + BASE_VERSION + "\")]");
+
+    // update standalone project
+    exec('%comspec% /c copy /Y /V ' + BUILD_DESTINATION + "\\VERSION " + BUILD_DESTINATION + STANDALONE_PATH + "\\VERSION");
+    var cordova_regex = /cordova-(\d+)[.](\d+)[.](\d+)(rc\d)?/g; //Matches *first* cordova-x.x.x[rcx] (just ad g at end to make global)
+    replaceInFile(BUILD_DESTINATION + STANDALONE_PATH + '\\CordovaAppProj.csproj', cordova_regex,  "cordova-" + VERSION);
+    replaceInFile(BUILD_DESTINATION + STANDALONE_PATH + '\\www\\index.html', cordova_regex,  "cordova-" + VERSION);
+    version_regex = /return\s*\"(\d+)[.](\d+)[.](\d+)(rc\d)?/; //Matches return "x.x.x[rcx]
+    replaceInFile(BUILD_DESTINATION + CORDOVA_LIB + '\\Commands\\Device.cs', version_regex,  "return \"" + VERSION);
+
+    // update full project
+    exec('%comspec% /c copy /Y /V ' + BUILD_DESTINATION + "\\VERSION " + BUILD_DESTINATION + FULL_PATH + "\\VERSION");
+    replaceInFile(BUILD_DESTINATION + FULL_PATH + '\\CordovaAppProj.csproj', cordova_regex,  "cordova-" + VERSION);
+    replaceInFile(BUILD_DESTINATION + FULL_PATH + '\\www\\index.html', cordova_regex,  "cordova-" + VERSION);
+    version_regex = /\"WPCordovaClassLib\,\s*Version\=(\d+)[.](\d+)[.](\d+)[.](\d+)/; //Matches "WPCordovaClassLib, Version=x.x.x.x
+    replaceInFile(BUILD_DESTINATION + FULL_PATH + '\\CordovaAppProj.csproj', version_regex,  "\"WPCordovaClassLib, Version=" + BASE_VERSION);
+
+    // update custom project
+    exec('%comspec% /c copy /Y /V ' + BUILD_DESTINATION + "\\VERSION " + BUILD_DESTINATION + CUSTOM_PATH + "\\VERSION");
+    replaceInFile(BUILD_DESTINATION + CUSTOM_PATH + '\\CordovaAppProj.csproj', cordova_regex,  "cordova-" + VERSION);
+    replaceInFile(BUILD_DESTINATION + CUSTOM_PATH + '\\www\\index.html', cordova_regex,  "cordova-" + VERSION);
+
+    // update example proj
+    replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\CordovaExample.csproj', cordova_regex,  "cordova-" + VERSION);
+    version_regex = /VERSION\s*\=\s*\'(\d+)[.](\d+)[.](\d+)(rc\d)?/;  //Matches VERSION = x.x.x[rcx]
+    replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\www\\cordova-current.js', version_regex,  "VERSION = \'" + VERSION);
+
+    // update template discription
+    version_regex = /Cordova\s*(\d+)[.](\d+)[.](\d+)(rc\d)?\s*Windows/g; //Matches version: x.x.x[rcx]
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\description.txt', version_regex,  "Cordova " + VERSION + " Windows");
+
+    // update .vstemplate files for the template zips.
+    var name_regex = /CordovaWP8[_](\d+)[_](\d+)[_](\d+)(rc\d)?/g
+    var discript_regex = /Cordova\s*(\d+)[.](\d+)[.](\d+)(rc\d)?/
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateFull.vstemplate', name_regex,  'CordovaWP8_' + VERSION.replace(/\./g, '_'));
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateFull.vstemplate', discript_regex,  "Cordova " + VERSION);
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateFull.vstemplate', cordova_regex,  "cordova-" + VERSION);
+
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate', name_regex,  'CordovaWP8_' + VERSION.replace(/\./g, '_'));
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate', discript_regex,  "Cordova " + VERSION);
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate', cordova_regex,  "cordova-" + VERSION);
+
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateCustom.vstemplate', name_regex,  'CordovaWP8_' + VERSION.replace(/\./g, '_'));
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateCustom.vstemplate', discript_regex,  "Cordova " + VERSION);
+    replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateCustom.vstemplate', cordova_regex,  "cordova-" + VERSION);
+}
+
+// delete all cordova.js and generated files (templates) from old version numbers
+function cleanup()
+{
+    WScript.StdOut.WriteLine("Cleanup");
+    // remove old template .zip files
+    if(fso.FileExists(BUILD_DESTINATION + '\\*.zip'))
+    {
+        fso.DeleteFile(BUILD_DESTINATION + '\\*.zip');
+    }
+    // remove old .dll from full template and framework
+    if(fso.FileExists(BUILD_DESTINATION + FULL_PATH+ '\\CordovaLib\\WPCordovaClassLib.dll'))
+    {
+        fso.DeleteFile(BUILD_DESTINATION + FULL_PATH+ '\\CordovaLib\\WPCordovaClassLib.dll');
+    }
+    // remove any generated framework files
+    if(fso.FolderExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin'))
+    {
+        fso.DeleteFolder(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin');
+    }
+    if(fso.FolderExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\obj'))
+    {
+        fso.DeleteFolder(BUILD_DESTINATION + FRAMEWORK_PATH + '\\obj');
+    }
+    // remove any generated CordovaDeploy
+    if(fso.FolderExists(BUILD_DESTINATION + '\\tooling\\CordovaDeploy\\CordovaDeploy\\bin'))
+    {
+        fso.DeleteFolder(BUILD_DESTINATION + '\\tooling\\CordovaDeploy\\CordovaDeploy\\bin');
+    }
+    if(fso.FolderExists(BUILD_DESTINATION + '\\tooling\\CordovaDeploy\\CordovaDeploy\\obj'))
+    {
+        fso.DeleteFolder(BUILD_DESTINATION + '\\tooling\\CordovaDeploy\\CordovaDeploy\\obj');
+    }
+    //remove old template .zip files
+    WScript.Echo(BUILD_DESTINATION);
+    var root_folder = shell.NameSpace(BUILD_DESTINATION + '\\').Items();
+    for(var i = 0; i < root_folder.Count; i++)
+    {
+        if(root_folder.Item(i).Name.match(/CordovaWP8[_](\d+)[_](\d+)[_](\d+)(rc\d)?[_]/))
+        {
+            fso.DeleteFile(BUILD_DESTINATION + '\\' + root_folder.Item(i).Name);
+        }
+    }
+    // remove old cordova.js
+    var example_www = shell.NameSpace(BUILD_DESTINATION + EXAMPLE_PATH + '\\www').Items();
+    for(var i = 0; i < example_www.Count; i++)
+    {
+        if(example_www.Item(i).Name.match(/cordova[-](\d+)[.](\d+)[.](\d+)(rc\d)?[.]js/))
+        {
+            fso.DeleteFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\www\\' + example_www.Item(i).Name);
+        }
+    }
+    var full_www = shell.NameSpace(BUILD_DESTINATION + FULL_PATH + '\\www').Items();
+    for(var i = 0; i < full_www.Count; i++)
+    {
+        if(full_www.Item(i).Name.match(/cordova[-](\d+)[.](\d+)[.](\d+)(rc\d)?[.]js/))
+        {
+            fso.DeleteFile(BUILD_DESTINATION + FULL_PATH + '\\www\\' + full_www.Item(i).Name);
+        }
+    }
+    var standalone_www = shell.NameSpace(BUILD_DESTINATION + FULL_PATH + '\\www').Items();
+    for(var i = 0; i < standalone_www.Count; i++)
+    {
+        if(standalone_www.Item(i).Name.match(/cordova[-](\d+)[.](\d+)[.](\d+)(rc\d)?[.]js/))
+        {
+            fso.DeleteFile(BUILD_DESTINATION + FULL_PATH + '\\www\\' + standalone_www.Item(i).Name);
+        }
+    }
+        var custom_www = shell.NameSpace(BUILD_DESTINATION + CUSTOM_PATH + '\\www').Items();
+    for(var i = 0; i < standalone_www.Count; i++)
+    {
+        if(custom_www.Item(i).Name.match(/cordova[-](\d+)[.](\d+)[.](\d+)(rc\d)?[.]js/))
+        {
+            fso.DeleteFile(BUILD_DESTINATION + CUSTOM_PATH + '\\www\\' + custom_www.Item(i).Name);
+        }
+    }
+}
+
+// builds the new cordova dll and copys it to the full template (only done because of the version referance in Device.cs)
+function build_dll()
+{
+    WScript.StdOut.WriteLine("Packaging .dll ...");
+    // move to framework directory
+    wscript_shell.CurrentDirectory = BUILD_DESTINATION + FRAMEWORK_PATH;
+    // build .dll in Release
+    exec_verbose('msbuild /p:Configuration=Release;VersionNumber=' + VERSION + ';BaseVersionNumber=' + BASE_VERSION);
+    //Check if file dll was created
+    if(!fso.FileExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin\\Release\\WPCordovaClassLib.dll'))
+    {
+        WScript.StdErr.WriteLine('ERROR: MSBuild failed to create .dll when reversioning cordova-wp7.');
+        WScript.Quit(1);
+    }
+
+    if(!fso.FolderExists(BUILD_DESTINATION + FULL_PATH + '\\CordovaLib'))
+    {
+        fso.CreateFolder(BUILD_DESTINATION + FULL_PATH + '\\CordovaLib');
+    }
+    exec('%comspec% /c copy Bin\\Release\\WPCordovaClassLib.dll ' + BUILD_DESTINATION + FULL_PATH + '\\CordovaLib');
+
+    WScript.StdOut.WriteLine("SUCESS");
+}
+
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 1)
+{
+    if(fso.FolderExists(args(1)) && fso.FolderExists(args(1) + '\\tooling'))
+    {
+        BUILD_DESTINATION = args(1);
+    }
+    else
+    {
+        WScript.StdErr.WriteLine("The given path is not a cordova-wp8 repo, if");
+        WScript.StdErr.WriteLine(" your trying to reversion a cordova-wp8 repo");
+        WScript.StdErr.WriteLine(" other then this one, please provide its path.");
+        Usage();
+        WScript.Quit(1);
+    }
+}
+
+if(args.Count() > 0)
+{
+    //Support help flags
+    if(args(0).indexOf("--help") > -1 ||
+         args(0).indexOf("/?") > -1 )
+    {
+        Usage();
+        WScript.Quit(1);
+    }
+
+    if(args(0).match(/(\d+)[.](\d+)[.](\d+)(rc\d)?/))
+    {
+        VERSION = args(0);
+        BASE_VERSION = VERSION.split('rc', 1) + ".0";
+        if(args.Count() < 2)
+        {
+          BUILD_DESTINATION = ROOT;
+        }
+        // remove old cordova.js files and any generated files
+        cleanup();
+        // update version numbers
+        updateVersionNumbers();
+        // build dll for full
+        build_dll();
+
+    }
+    else
+    {
+        WScript.StdOut.WriteLine("The  version number is invalid, please provide");
+        WScript.StdOut.WriteLine(" a version number in the format Major.Minor.Fix[rc#]")
+        Usage();
+        WScript.Quit(1);
+    }
+}
+else
+{
+    Usage();
+    WScript.Quit(1);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/a0ca12da/tooling/scripts/win-zip.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/win-zip.js b/tooling/scripts/win-zip.js
new file mode 100644
index 0000000..8455a54
--- /dev/null
+++ b/tooling/scripts/win-zip.js
@@ -0,0 +1,33 @@
+/*
+ * Script for zipping the contents of a directory.
+ */
+
+// get commman line arguments
+var objArgs = WScript.Arguments;
+var zipPath = objArgs(0);
+var sourcePath = objArgs(1);
+
+
+// create empty ZIP file and open for adding
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+var file = fso.CreateTextFile(zipPath, true);
+
+// create twenty-two byte "fingerprint" for .zip
+file.write("PK");
+file.write(String.fromCharCode(5));
+file.write(String.fromCharCode(6));
+file.write('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0');
+file.Close();
+
+// open .zip foder and copy contents of sourcePath
+var objShell = new ActiveXObject("shell.application");
+var zipFolder = objShell.NameSpace(zipPath);
+var sourceItems = objShell.NameSpace(sourcePath).items();
+if (zipFolder != null)
+{
+    zipFolder.CopyHere(sourceItems, 4|20);
+    WScript.Sleep(1000);
+}
+else {
+	WScript.Echo("Failed to create .zip file.");
+}
\ No newline at end of file


Mime
View raw message