script cleanup
Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/df40aaf2 Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/df40aaf2 Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/df40aaf2 Branch: refs/heads/2.9.x Commit: df40aaf21f7ab0e62fea4f8a547522d9695e66e2 Parents: 57b876f Author: Jesse MacFadyen <[email protected]> Authored: Tue Jun 18 12:20:38 2013 -0700 Committer: Jesse MacFadyen <[email protected]> Committed: Tue Jun 18 12:20:38 2013 -0700 ---------------------------------------------------------------------- wp7/tooling/scripts/dist.js | 40 ++++++++++++++++++++--------------- wp7/tooling/scripts/reversion.js | 11 +--------- 2 files changed, 24 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/df40aaf2/wp7/tooling/scripts/dist.js ---------------------------------------------------------------------- diff --git a/wp7/tooling/scripts/dist.js b/wp7/tooling/scripts/dist.js index b1fd9cb..fe2407c 100644 --- a/wp7/tooling/scripts/dist.js +++ b/wp7/tooling/scripts/dist.js @@ -40,16 +40,20 @@ var replace = false; //Set up directory structure of current release //arguments passed in -var args = WScript.Arguments, - //Root folder of cordova-wp7 (i.e C:\Cordova\cordova-wp7) - ROOT = WScript.ScriptFullName.split('\\tooling\\', 1), - // tooling scripts - SCRIPTS = '\\tooling\\scripts'; - //Get version number - VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''); +var args = WScript.Arguments; +Log("args = " + args); + //Root folder of cordova-wp7 (i.e C:\Cordova\cordova-wp\cordova-wp7) +var rootPath = WScript.ScriptFullName.split('\\tooling\\', 1); +Log("rootPath = " + rootPath); +// tooling scripts +var scriptPath = '\\tooling\\scripts'; +Log("scriptPath = " + scriptPath); +//Get version number +var VERSION=read(rootPath+'\\..\\VERSION').replace(/\r\n/,'').replace(/\n/,''); +Log("VERSION = " + VERSION); //Destination to build to -var BUILD_DESTINATION; +var buildDestination; //current script that is running var current_script = "dist"; @@ -84,7 +88,7 @@ function Log(msg, error) { // returns the contents of a file function read(filename) { - //Log('Reading in ' + filename); + Log('Reading in ' + filename); if(fso.FileExists(filename)) { var f=fso.OpenTextFile(filename, 1,2); @@ -144,20 +148,20 @@ if (args.Count() > 0) { WScript.Quit(1); } else if (args(0) == '-f') { - BUILD_DESTINATION = ROOT; + buildDestination = rootPath; replace = true; } else { - BUILD_DESTINATION = args(0); + buildDestination = args(0); } } else if (args.Count() == 2) { if (args(0) == '-f') { replace = true; - BUILD_DESTINATION = args(1); + buildDestination = args(1); } else { - BUILD_DESTINATION = args(0); + buildDestination = args(0); if (args(1) == '-f') { replace = true; } @@ -183,8 +187,9 @@ else { /** - Copy source code to new directory **/ /*************************************************/ if (!replace) { + Log("Step 1"); current_script = "new.js"; - exec('cscript ' + ROOT + SCRIPTS + '\\new.js ' + BUILD_DESTINATION + ' //nologo'); + exec('cscript ' + rootPath + scriptPath + '\\new.js ' + buildDestination + ' //nologo'); space(); } @@ -196,7 +201,8 @@ if (!replace) { /** - Rebuild dll **/ /*************************************************/ current_script = "reversion.js"; -exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\reversion.js ' + VERSION + ' //nologo'); +Log("Step 2"); +exec('cscript ' + buildDestination + scriptPath + '\\reversion.js ' + VERSION + ' //nologo'); space(); /*************************************************/ @@ -208,7 +214,7 @@ space(); /*************************************************/ // New Workflow may not require building the new js, it should already be in place. current_script = "buildjs.js"; -exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo'); +exec('cscript ' + buildDestination + scriptPath + '\\buildjs.js //nologo'); space(); /*************************************************/ @@ -219,6 +225,6 @@ space(); /** - inject into Visual Studio **/ /*************************************************/ current_script = "package.js"; -exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\package.js //nologo'); +exec('cscript ' + buildDestination + scriptPath + '\\package.js //nologo'); space(); Log("Distribution Complete."); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/df40aaf2/wp7/tooling/scripts/reversion.js ---------------------------------------------------------------------- diff --git a/wp7/tooling/scripts/reversion.js b/wp7/tooling/scripts/reversion.js index 8bf5ed1..7754514 100644 --- a/wp7/tooling/scripts/reversion.js +++ b/wp7/tooling/scripts/reversion.js @@ -132,7 +132,7 @@ 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 + // replace assembly 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; @@ -193,15 +193,6 @@ function cleanup() 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(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 standalone_www = shell.NameSpace(BUILD_DESTINATION + STANDALONE_PATH + '\\www').Items(); for(i = 0; i < standalone_www.Count; i++)
