cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject [1/3] android commit: CB-5971: Fix package / project validation
Date Tue, 24 Jun 2014 18:06:19 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master 297f862cc -> 435245612


CB-5971: Fix package / project validation


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

Branch: refs/heads/master
Commit: 4352456129bfa8a8a6bbf4d38fb40d9876b67ec4
Parents: bb141a7
Author: Ian Clelland <iclelland@chromium.org>
Authored: Tue Jun 24 14:05:03 2014 -0400
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Tue Jun 24 14:05:56 2014 -0400

----------------------------------------------------------------------
 bin/lib/create.js | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/43524561/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index a31604a..b2490f2 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -113,18 +113,13 @@ function copyScripts(projectPath) {
  */
 function validatePackageName(package_name) {
     //Make the package conform to Java package types
-    if (!/[a-zA-Z0-9_]+\.[a-zA-Z0-9_](.[a-zA-Z0-9_])*/.test(package_name)) {
-        return Q.reject('Package name must look like: com.company.Name');
-    }
-
     //Enforce underscore limitation
-    if (/[_]+[a-zA-Z0-9_]*/.test(package_name)) {
-        return Q.reject("Package name can't begin with an underscore");
+    if (!/^[a-zA-Z]+(\.[a-zA-Z0-9][a-zA-Z0-9_]*)+$/.test(package_name)) {
+        return Q.reject('Package name must look like: com.company.Name');
     }
 
     //Class is a reserved word
-    if(/[C|c]+lass+[\s|\.]/.test(package_name) && !/[a-zA-Z0-9_]+[C|c]+lass/.test(package_name))
-    {
+    if(/\b[Cc]lass\b/.test(package_name)) {
         return Q.reject('class is a reserved word');
     }
 
@@ -137,6 +132,11 @@ function validatePackageName(package_name) {
  * otherwise.
  */
 function validateProjectName(project_name) {
+    //Make sure there's something there
+    if (project_name === '') {
+        return Q.reject('Project name cannot be empty');
+    }
+
     //Enforce stupid name error
     if (project_name === 'CordovaActivity') {
         return Q.reject('Project name cannot be CordovaActivity');


Mime
View raw message