smartgit/ts/smartgit.classes.smartgit.ts

36 lines
975 B
TypeScript
Raw Normal View History

import * as plugins from './smartgit.plugins';
import { GitRepo } from './smartgit.classes.gitrepo';
export class Smartgit {
public smartenvInstance = new plugins.smartenv.Smartenv();
public envDeps: {
fs: any;
http: any;
} = {
fs: null,
http: null
}
constructor() {};
public async init() {
if (this.smartenvInstance.isNode) {
this.envDeps.fs = this.smartenvInstance.getSafeNodeModule('fs');
this.envDeps.http = this.smartenvInstance.getSafeNodeModule('isomorphic-git/http/node');
}
};
public async createRepoByClone(fromUrlArg: string, toDirArg: string) {
const repo = await GitRepo.fromCloningIntoDir(this, fromUrlArg, toDirArg)
};
public async createRepoByInit(dirArg: string) {
const repo = await GitRepo.fromCreatingRepoInDir(this, dirArg);
return repo;
};
public async createRepoByOpen(dirArg: string) {
const repo = await GitRepo.fromOpeningRepoDir(this, dirArg);
return repo;
}
}