You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by no...@apache.org on 2020/01/07 14:10:15 UTC
[cordova-android] branch master updated: [Major] Removed
unnecessary project name restriction (#859)
This is an automated email from the ASF dual-hosted git repository.
normanbreau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new 91d2716 [Major] Removed unnecessary project name restriction (#859)
91d2716 is described below
commit 91d27161226291413835655016a4b0cc31e9449a
Author: Norman Breau <no...@normanbreau.com>
AuthorDate: Tue Jan 7 10:10:04 2020 -0400
[Major] Removed unnecessary project name restriction (#859)
* removed unnecessary restriction that prevented project names from starting with a number. Project names starting with a number is perfectly valid.
* Reworded validateProjectName jsdoc
Co-Authored-By: Raphael von der Grün <ra...@gmail.com>
Co-authored-by: Raphael von der Grün <ra...@gmail.com>
---
bin/lib/create.js | 12 +-----------
spec/unit/create.spec.js | 21 ++++-----------------
2 files changed, 5 insertions(+), 28 deletions(-)
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 71ce5f5..d737b32 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -208,7 +208,7 @@ function validatePackageName (package_name) {
}
/**
- * Test whether a project name is acceptable for use as an android class.
+ * Test whether given string is acceptable for use as a project name
* Returns a promise, fulfilled if the project name is acceptable; rejected
* otherwise.
*/
@@ -219,16 +219,6 @@ function validateProjectName (project_name) {
return Promise.reject(new CordovaError(msg + 'Project name cannot be empty'));
}
- // Enforce stupid name error
- if (project_name === 'CordovaActivity') {
- return Promise.reject(new CordovaError(msg + 'Project name cannot be CordovaActivity'));
- }
-
- // Classes in Java don't begin with numbers
- if (/^[0-9]/.test(project_name)) {
- return Promise.reject(new CordovaError(msg + 'Project name must not begin with a number'));
- }
-
return Promise.resolve();
}
diff --git a/spec/unit/create.spec.js b/spec/unit/create.spec.js
index 5897882..7eb98fc 100644
--- a/spec/unit/create.spec.js
+++ b/spec/unit/create.spec.js
@@ -79,7 +79,10 @@ describe('create', function () {
'mobilespec',
'package_name',
'PackageName',
- 'CordovaLib'
+ 'CordovaLib',
+ '1337',
+ '3 Little Pigs',
+ 'CordovaActivity'
];
valid.forEach(function (project_name) {
it('Test#003 : should accept ' + project_name, () => {
@@ -96,22 +99,6 @@ describe('create', function () {
expect(err.message).toContain('Project name cannot be empty');
});
});
- it('should reject "CordovaActivity" as a project name', () => {
- return create.validateProjectName('CordovaActivity').then(() => {
- fail('Expected promise to be rejected');
- }, err => {
- expect(err).toEqual(jasmine.any(Error));
- expect(err.message).toContain('Project name cannot be CordovaActivity');
- });
- });
- it('should reject project names that begin with a number', () => {
- return create.validateProjectName('1337').then(() => {
- fail('Expected promise to be rejected');
- }, err => {
- expect(err).toEqual(jasmine.any(Error));
- expect(err.message).toContain('Project name must not begin with a number');
- });
- });
});
});
describe('main method', function () {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org