Skip to content

Respect --baseConfig on prepare #1641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2016
Merged
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
18 changes: 13 additions & 5 deletions lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,7 @@ export class PlatformService implements IPlatformService {
platformData.platformProjectService.interpolateData().wait();
platformData.platformProjectService.afterCreateProject(platformData.projectRoot).wait();

if(this.$options.baseConfig) {
let newConfigFile = path.resolve(this.$options.baseConfig);
this.$logger.trace(`Replacing '${platformData.configurationFilePath}' with '${newConfigFile}'.`);
this.$fs.copyFile(newConfigFile, platformData.configurationFilePath).wait();
}
this.applyBaseConfigOption(platformData).wait();

let frameworkPackageNameData: any = {version: installedVersion};
if(customTemplateOptions) {
Expand Down Expand Up @@ -306,6 +302,8 @@ export class PlatformService implements IPlatformService {
// Replace placeholders in configuration files
platformData.platformProjectService.interpolateConfigurationFile().wait();

this.applyBaseConfigOption(platformData).wait();

this.$logger.out("Project successfully prepared");
return true;
}).future<boolean>()();
Expand Down Expand Up @@ -684,5 +682,15 @@ export class PlatformService implements IPlatformService {
private mapFrameworkFiles(npmCacheDirectoryPath: string, files: string[]): string[] {
return _.map(files, file => file.substr(npmCacheDirectoryPath.length + constants.PROJECT_FRAMEWORK_FOLDER_NAME.length + 1));
}

private applyBaseConfigOption(platformData: IPlatformData): IFuture<void> {
return (() => {
if(this.$options.baseConfig) {
let newConfigFile = path.resolve(this.$options.baseConfig);
this.$logger.trace(`Replacing '${platformData.configurationFilePath}' with '${newConfigFile}'.`);
this.$fs.copyFile(newConfigFile, platformData.configurationFilePath).wait();
}
}).future<void>()();
}
}
$injector.register("platformService", PlatformService);