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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async compile () {
|
|
|
|
await this.smartshellInstance.exec(`rm -rf public/`);
|
|
|
|
await this.smartshellInstance.exec(`docker run --rm -it -p 8000:8000 -v ${paths.cwd}:/docs mkdocs build`);
|
|
|
|
await this.smartshellInstance.exec(`gitzone commit`);
|
|
|
|
}
|
|
|
|
|
|
|
|
public async serve () {
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|