added ProjectInfo main class

This commit is contained in:
2016-11-26 23:18:33 +01:00
parent 481ab58d02
commit c17db19b9f
12 changed files with 83 additions and 26 deletions

View File

@ -1,8 +1,29 @@
import 'typings-global'
import * as plugins from './projectinfo.plugins'
export class ProjectinfoGit {
isGit: boolean
constructor() {
githost: string
gituser: string
gitrepo: string
cwd: string
constructor(cwdArg: string) {
this.cwd = cwdArg
this.getGitInfoFromPath()
}
}
/**
* get git info from path
*/
getGitInfoFromPath() {
let localSmartpath = new plugins.smartpath.Smartpath(this.cwd)
this.gitrepo = localSmartpath.pathLevelsBackwards[0]
this.gituser = localSmartpath.pathLevelsBackwards[1]
}
/**
* get git info from remote url
*/
getGitInfoFromRemote(remoteUrlArg: string) {
let gitRepoParsed = new plugins.smartstring.GitRepo(remoteUrlArg)
}
}

View File

@ -7,7 +7,7 @@ export class ProjectinfoNpm {
version: string
status: string
license: string
git
git: plugins.smartstring.GitRepo
constructor(cwdArg: string, optionsArg: { gitAccessToken?: string } = {}) {
let resolvedCwd = plugins.path.resolve(cwdArg)

View File

@ -1,6 +1,6 @@
import * as plugins from './projectinfo.plugins'
import { ProjectinfoNpm } from './projectinfo.classes.npm'
import { ProjectinfoGit } from './projectinfo.classes.git'
export type TProjectType = 'git' | 'npm'
/**
@ -9,13 +9,12 @@ export type TProjectType = 'git' | 'npm'
export class ProjectInfo {
type: TProjectType
npm: ProjectinfoNpm
git: ProjectinfoGit
/**
* this constructor
* constructor of class ProjectInfo
*/
constructor(cwdArg: string) {
this.npm = new ProjectinfoNpm(cwdArg)
this.git = new ProjectinfoGit(cwdArg)
}
}

View File

@ -1,5 +1,6 @@
import 'typings-global'
export let path = require('path')
export let Q = require('q')
export import path = require('path')
export import q = require('q')
export import smartfile = require('smartfile')
export import smartstring = require('smartstring')
export import smartpath = require('smartpath')