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 2014/06/13 20:46:47 UTC
git commit: CB-6939 Replace dash chars in package name and validate
it.
Repository: cordova-wp8
Updated Branches:
refs/heads/master ac097f280 -> 829beb988
CB-6939 Replace dash chars in package name and validate it.
Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/829beb98
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/829beb98
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/829beb98
Branch: refs/heads/master
Commit: 829beb9883a385a11e42fc653de18a35fb0464c5
Parents: ac097f2
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Jun 13 11:47:14 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Jun 13 11:47:14 2014 -0700
----------------------------------------------------------------------
wp8/bin/create.js | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/829beb98/wp8/bin/create.js
----------------------------------------------------------------------
diff --git a/wp8/bin/create.js b/wp8/bin/create.js
index d203b2b..4c8ae7b 100644
--- a/wp8/bin/create.js
+++ b/wp8/bin/create.js
@@ -156,9 +156,21 @@ function genGuid() {
// creates new project in path, with the given package and app name
function create(path, namespace, name) {
Log("Creating Cordova-WP8 Project:");
- Log("\tApp Name : " + name);
- Log("\tNamespace : " + namespace);
- Log("\tPath : " + path);
+ Log("\tPathToNewProject : " + path);
+ Log("\tPackageName : " + namespace);
+ Log("\tAppName : " + name);
+
+ // test for valid identifiers, alpha-numeric + _$
+ if(!/^[a-zA-Z0-9._$]+$/g.test(namespace)) {
+ namespace = namespace.replace("-","_");
+ Log("Replaced '-' with '_' in PackageName : " + namespace);
+ }
+ // if replacing the - with a _ does not work, give up
+ if(!/^[a-zA-Z0-9._$]+$/g.test(namespace)) {
+ Log("Error : Invalid identifier! PackageName may only include letters, numbers, _ and $");
+ Usage();
+ WScript.Quit(1);
+ }
// Copy the template source files to the new destination
fso.CopyFolder(platformRoot + templatePath, path);