2019-05-14 15:39:33 +00:00
|
|
|
import * as plugins from './tsdoc.plugins';
|
2019-05-15 19:06:07 +00:00
|
|
|
import * as paths from './tsdoc.paths';
|
2019-05-14 15:39:33 +00:00
|
|
|
|
|
|
|
export class MkDocs {
|
2019-05-15 19:06:07 +00:00
|
|
|
public smartshellInstance = new plugins.smartshell.Smartshell({
|
|
|
|
executor: 'bash',
|
|
|
|
pathDirectories: [paths.binDir]
|
|
|
|
});
|
|
|
|
|
2019-05-14 15:39:33 +00:00
|
|
|
public static async isMkDocsDir(dirPathArg: string): Promise<boolean> {
|
|
|
|
const result = await plugins.smartfile.fs.fileExists(
|
|
|
|
plugins.path.join(dirPathArg, 'mkdocs.yml')
|
|
|
|
);
|
2019-05-15 19:06:07 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Instance
|
|
|
|
public typedocDirectory: string;
|
|
|
|
constructor(dirPathArg) {
|
|
|
|
this.typedocDirectory = dirPathArg;
|
|
|
|
}
|
|
|
|
|
2019-05-15 19:10:19 +00:00
|
|
|
public async update () {
|
|
|
|
await this.smartshellInstance.exec(`docker pull registry.gitlab.com/hosttoday/ht-docker-mkdocs`);
|
|
|
|
}
|
|
|
|
|
2019-05-15 19:06:07 +00:00
|
|
|
public async compile () {
|
2019-05-15 19:10:19 +00:00
|
|
|
await this.update();
|
2019-05-15 19:06:07 +00:00
|
|
|
await this.smartshellInstance.exec(`rm -rf public/`);
|
2019-05-15 19:10:19 +00:00
|
|
|
await this.smartshellInstance.exec(`docker run --rm -it -p 8000:8000 -v ${paths.cwd}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs build`);
|
2019-05-15 19:06:07 +00:00
|
|
|
await this.smartshellInstance.exec(`gitzone commit`);
|
|
|
|
}
|
|
|
|
|
|
|
|
public async serve () {
|
2019-05-15 19:10:19 +00:00
|
|
|
await this.update();
|
2019-05-15 19:06:07 +00:00
|
|
|
await this.smartshellInstance.exec(`docker run --rm -it -p 8000:8000 -v ${paths.cwd}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs`);
|
2019-05-14 15:39:33 +00:00
|
|
|
}
|
|
|
|
}
|