cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [3/6] android commit: CB-5971: This would have been a good first bug, too bad
Date Mon, 23 Jun 2014 18:50:36 GMT
CB-5971: This would have been a good first bug, too bad


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

Branch: refs/heads/4.0.x
Commit: 141bbfb05134bdd11e262d879bbd253bf4479519
Parents: 663a919
Author: Joe Bowser <bowserj@apache.org>
Authored: Thu Jun 12 17:51:22 2014 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Thu Jun 12 17:51:22 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/141bbfb0/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index dbdb84f..f99d1da 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -145,14 +145,32 @@ exports.createProject = function(project_path, package_name, project_name,
proje
         return Q.reject('Project already exists! Delete and recreate');
     }
 
+    //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");
+    }
+
+    //Enforce stupid name error
     if (project_name === 'CordovaActivity') {
         return Q.reject('Project name cannot be CordovaActivity');
     }
 
+    //Classes in Java don't begin with numbers
+    if (/[0-9]+[a-zA-Z0-9]/.test(project_name)) {
+        return Q.reject('Project name must not begin with a number');
+    }
+
+    //Class is a reserved word
+    if(/[C|c]+lass+[\s|\.]/.test(package_name) && !/[a-zA-Z0-9_]+[C|c]+lass/.test(package_name))
+    {
+        return Q.reject('class is a reserved word');
+    }
+
     // Check that requirements are met and proper targets are installed
     return check_reqs.run()
     .then(function() {


Mime
View raw message