2018-11-06 22:03:52 +03:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
2019-09-16 08:18:39 +03:00
|
|
|
import { Initializer, DeepPartial } from '@azure-tools/codegen';
|
2019-09-03 21:02:12 +03:00
|
|
|
import { pall } from '@azure-tools/codegen';
|
2018-11-06 22:03:52 +03:00
|
|
|
import { Namespace } from './namespace';
|
|
|
|
|
|
|
|
export class Project extends Initializer {
|
|
|
|
|
|
|
|
|
|
|
|
private namespaces = new Array<Namespace>();
|
2019-09-16 08:18:39 +03:00
|
|
|
constructor(objectInitializer?: DeepPartial<Project>) {
|
2018-11-06 22:03:52 +03:00
|
|
|
super();
|
|
|
|
this.apply(objectInitializer);
|
|
|
|
}
|
|
|
|
|
|
|
|
public addNamespace(n: Namespace): Namespace {
|
|
|
|
this.namespaces.push(n);
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async init(): Promise<this> {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async writeFiles(writer: (filename: string, content: string) => Promise<void>) {
|
|
|
|
await pall(this.namespaces, async ns => ns.writeFiles(writer));
|
|
|
|
}
|
|
|
|
}
|