Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Change default appid #42

Merged
merged 1 commit into from
Aug 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ interface IChildProcess {

interface IProjectHelper {
projectDir: string;
generateDefaultAppId(appName: string): string;
generateDefaultAppId(appName: string, baseAppId: string): string;
}

interface IPropertiesParser {
Expand Down
8 changes: 5 additions & 3 deletions project-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import path = require("path");
import options = require("./options");
import util = require("util");

export class ProjectHelper implements IProjectHelper {
constructor(private $logger: ILogger,
Expand Down Expand Up @@ -37,16 +38,17 @@ export class ProjectHelper implements IProjectHelper {
return this.cachedProjectDir;
}

public generateDefaultAppId(appName: string): string {
public generateDefaultAppId(appName: string, baseAppId: string): string {
var sanitizedName = _.filter(appName.split(""), (c) => /[a-zA-Z0-9]/.test(c)).join("");
if (sanitizedName) {
if (/^\d+$/.test(sanitizedName)) {
sanitizedName = "the" + sanitizedName;
}
return "com.telerik." + sanitizedName;
} else {
return "com.telerik.the";
sanitizedName = "the";
}

return util.format("%s.%s", baseAppId, sanitizedName);
}
}
$injector.register("projectHelper", ProjectHelper);