You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/01/23 01:19:52 UTC

[2/21] git commit: updates for CLI project creation

updates for CLI project creation


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

Branch: refs/heads/master
Commit: 51480ff636e3f2ffab1b2656cca11bc7df0c006c
Parents: 5089d5a
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Jan 11 18:25:56 2013 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Jan 11 18:25:56 2013 -0800

----------------------------------------------------------------------
 bin/create.bat                              |   17 ----------
 bin/create.js                               |   37 ++++++++++++++++------
 templates/full/CordovaAppProj.csproj        |    2 +-
 templates/full/CordovaSolution.sln          |    2 +-
 templates/full/Properties/WMAppManifest.xml |    6 ++--
 5 files changed, 32 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/51480ff6/bin/create.bat
----------------------------------------------------------------------
diff --git a/bin/create.bat b/bin/create.bat
index 0865db1..70b6203 100644
--- a/bin/create.bat
+++ b/bin/create.bat
@@ -1,18 +1 @@
-:: 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.
-
 cscript bin\\create.js $*
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/51480ff6/bin/create.js
----------------------------------------------------------------------
diff --git a/bin/create.js b/bin/create.js
index c5e0bcc..b17d408 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -26,7 +26,7 @@
 
 function Usage()
 {
-  WScript.Echo("Usage: create [PATH]"); // [PACKAGE] [ACTIVITY]");
+  WScript.Echo("Usage: create PATH [PACKAGE] [NAME]");
   WScript.Echo("Creates a new cordova/wp7 project.");
 }
 
@@ -82,8 +82,8 @@ function genGuid()
 
 var args = WScript.Arguments,
     PROJECT_PATH="..\\example\\", 
-    PACKAGE="org.apache.cordova.example", 
-    ACTIVITY="cordovaExample",
+    PACKAGE="myorg.example", 
+    NAME="Example",
     shell=WScript.CreateObject("WScript.Shell");
     
 // working dir
@@ -93,6 +93,7 @@ if (args.Count() > 0)
 {
     PROJECT_PATH = args(0);
     if(PROJECT_PATH.indexOf("--help") > -1 ||
+      PROJECT_PATH.indexOf("-h") > -1 ||
        PROJECT_PATH.indexOf("/?") > -1 ) 
     {
        Usage();
@@ -106,29 +107,45 @@ if (args.Count() > 0)
 
     if(args.Count() > 2)
     {
-      ACTIVITY=args(2);
+      NAME=args(2);
     }
 
 }
+else
+{
+    Usage();
+    WScript.Quit(1);
+}
 
-// WScript.Echo("ROOT = " + ROOT);
-// WScript.Echo('PROJECT_PATH ' + PROJECT_PATH);
-// WScript.Echo('PACKAGE ' + PACKAGE);
-// WScript.Echo('ACTIVITY ' + ACTIVITY);
+WScript.Echo("ROOT = " + ROOT);
+WScript.Echo('PROJECT_PATH ' + PROJECT_PATH);
+WScript.Echo('PACKAGE ' + PACKAGE);
+WScript.Echo('NAME ' + NAME);
 
 var PACKAGE_AS_PATH=PACKAGE.replace(/\./g, '\\');
 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');
 // replace the guid in the AppManifest
 replaceInFile(PROJECT_PATH + "\\Properties\\WMAppManifest.xml","$guid1$",newProjGuid);
 // replace safe-project-name in AppManifest
-replaceInFile(PROJECT_PATH + "\\Properties\\WMAppManifest.xml",/\$safeprojectname\$/g,ACTIVITY);
+replaceInFile(PROJECT_PATH + "\\Properties\\WMAppManifest.xml",/\$safeprojectname\$/g,NAME);
+replaceInFile(PROJECT_PATH + "\\Properties\\WMAppManifest.xml",/\$projectname\$/g,NAME);
+
+
+replaceInFile(PROJECT_PATH + "\\App.xaml",/\$safeprojectname\$/g,PACKAGE);
+replaceInFile(PROJECT_PATH + "\\App.xaml.cs",/\$safeprojectname\$/g,PACKAGE);
+
+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 + ACTIVITY);
+WScript.Echo("Generated project : " + PROJECT_PATH + NAME);
 
 // TODO: Name the project according to the arguments
 // update the solution to include the new project by name

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/51480ff6/templates/full/CordovaAppProj.csproj
----------------------------------------------------------------------
diff --git a/templates/full/CordovaAppProj.csproj b/templates/full/CordovaAppProj.csproj
index 9ff5cf0..dac04af 100644
--- a/templates/full/CordovaAppProj.csproj
+++ b/templates/full/CordovaAppProj.csproj
@@ -42,7 +42,7 @@
     <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
     <XapFilename>CordovaAppProj_$(Configuration)_$(Platform).xap</XapFilename>
     <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
-    <SilverlightAppEntry>GapExample.App</SilverlightAppEntry>
+    <SilverlightAppEntry>$safeprojectname$.App</SilverlightAppEntry>
     <ValidateXaml>true</ValidateXaml>
     <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
     <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/51480ff6/templates/full/CordovaSolution.sln
----------------------------------------------------------------------
diff --git a/templates/full/CordovaSolution.sln b/templates/full/CordovaSolution.sln
index ed73b21..8175c24 100644
--- a/templates/full/CordovaSolution.sln
+++ b/templates/full/CordovaSolution.sln
@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio Express 2012 for Windows Phone
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CordovaAppProj", "CordovaAppProj.csproj", "{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "$projectname$", "$projectname$.csproj", "{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/51480ff6/templates/full/Properties/WMAppManifest.xml
----------------------------------------------------------------------
diff --git a/templates/full/Properties/WMAppManifest.xml b/templates/full/Properties/WMAppManifest.xml
index 0a71684..0f291da 100644
--- a/templates/full/Properties/WMAppManifest.xml
+++ b/templates/full/Properties/WMAppManifest.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0">
   <DefaultLanguage xmlns="" code="en-US" />
-  <App xmlns="" ProductID="{7ef9ba5e-4a8e-435f-a00f-5c1f5b6ef147}" Title="GapExample" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="GapExample author" BitsPerPixel="32" Description="PhoneGap for Windows Phone" Publisher="GapExample" PublisherID="{b93a0d8e-5aa9-4d9b-b232-17e2d852e779}">
+  <App xmlns="" ProductID="{$guid1$}" Title="$projectname$" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="$projectname$ author" BitsPerPixel="32" Description="Apache Cordova for Windows Phone" Publisher="CordovaExample" PublisherID="{b93a0d8e-5aa9-4d9b-b232-17e2d852e779}">
     <IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
     <Capabilities>
       <Capability Name="ID_CAP_IDENTITY_DEVICE" />
@@ -24,12 +24,12 @@
       <DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
     </Tasks>
     <Tokens>
-      <PrimaryToken TokenID="GapExampleToken" TaskName="_default">
+      <PrimaryToken TokenID="$safeprojectname$Token" TaskName="_default">
         <TemplateFlip>
           <SmallImageURI IsResource="false" IsRelative="true">Background.png</SmallImageURI>
           <Count>0</Count>
           <BackgroundImageURI IsResource="false" IsRelative="true">Background.png</BackgroundImageURI>
-          <Title>GapExample</Title>
+          <Title>$projectname$</Title>
           <BackContent></BackContent>
           <BackBackgroundImageURI></BackBackgroundImageURI>
           <BackTitle></BackTitle>