forked from github/cordova-android
CB-8735: Fixing the regex so that it's more compliant with Java package rules
This commit is contained in:
parent
8d5cb00bec
commit
e4c9bebe34
@ -149,7 +149,7 @@ function copyScripts(projectPath) {
|
|||||||
function validatePackageName(package_name) {
|
function validatePackageName(package_name) {
|
||||||
//Make the package conform to Java package types
|
//Make the package conform to Java package types
|
||||||
//Enforce underscore limitation
|
//Enforce underscore limitation
|
||||||
if (!/^[a-zA-Z]+(\.[a-zA-Z0-9][a-zA-Z0-9_]*)+$/.test(package_name)) {
|
if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) {
|
||||||
return Q.reject('Package name must look like: com.company.Name');
|
return Q.reject('Package name must look like: com.company.Name');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ describe("create", function () {
|
|||||||
var valid = [
|
var valid = [
|
||||||
"org.apache.mobilespec"
|
"org.apache.mobilespec"
|
||||||
, "com.example"
|
, "com.example"
|
||||||
, "com.42floors.package"
|
, "com.floors42.package",
|
||||||
|
, "ball8.ball8.ball8ball",
|
||||||
];
|
];
|
||||||
var invalid = [
|
var invalid = [
|
||||||
""
|
""
|
||||||
@ -40,6 +41,10 @@ describe("create", function () {
|
|||||||
, "_underscore.anything"
|
, "_underscore.anything"
|
||||||
, "underscore._something"
|
, "underscore._something"
|
||||||
, "_underscore._all._the._things"
|
, "_underscore._all._the._things"
|
||||||
|
, "8.ball",
|
||||||
|
, "8ball.ball",
|
||||||
|
, "ball8.8ball",
|
||||||
|
, "ball8.com.8ball"
|
||||||
];
|
];
|
||||||
|
|
||||||
valid.forEach(function(package_name) {
|
valid.forEach(function(package_name) {
|
||||||
|
Loading…
Reference in New Issue
Block a user