added ProjectInfo main class

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

View File

@ -1,5 +1,16 @@
import 'typings-global';
export declare class ProjectinfoGit {
isGit: boolean;
constructor();
githost: string;
gituser: string;
gitrepo: string;
cwd: string;
constructor(cwdArg: string);
/**
* get git info from path
*/
getGitInfoFromPath(): void;
/**
* get git info from remote url
*/
getGitInfoFromRemote(remoteUrlArg: string): void;
}

View File

@ -1,8 +1,24 @@
"use strict";
require("typings-global");
const plugins = require("./projectinfo.plugins");
class ProjectinfoGit {
constructor() {
constructor(cwdArg) {
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) {
let gitRepoParsed = new plugins.smartstring.GitRepo(remoteUrlArg);
}
}
exports.ProjectinfoGit = ProjectinfoGit;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5naXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wcm9qZWN0aW5mby5jbGFzc2VzLmdpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBRXZCO0lBRUk7SUFFQSxDQUFDO0NBQ0o7QUFMRCx3Q0FLQyJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5naXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wcm9qZWN0aW5mby5jbGFzc2VzLmdpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsaURBQWdEO0FBRWhEO0lBTUksWUFBWSxNQUFjO1FBQ3RCLElBQUksQ0FBQyxHQUFHLEdBQUcsTUFBTSxDQUFBO1FBQ2pCLElBQUksQ0FBQyxrQkFBa0IsRUFBRSxDQUFBO0lBQzdCLENBQUM7SUFFRDs7T0FFRztJQUNILGtCQUFrQjtRQUNkLElBQUksY0FBYyxHQUFHLElBQUksT0FBTyxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFBO1FBQzlELElBQUksQ0FBQyxPQUFPLEdBQUcsY0FBYyxDQUFDLG1CQUFtQixDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQ3BELElBQUksQ0FBQyxPQUFPLEdBQUcsY0FBYyxDQUFDLG1CQUFtQixDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQ3hELENBQUM7SUFFRDs7T0FFRztJQUNILG9CQUFvQixDQUFDLFlBQW9CO1FBQ3JDLElBQUksYUFBYSxHQUFHLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUE7SUFDckUsQ0FBQztDQUNKO0FBMUJELHdDQTBCQyJ9

View File

@ -1,4 +1,5 @@
import 'typings-global';
import plugins = require('./projectinfo.plugins');
export declare class ProjectinfoNpm {
isNpm: boolean;
packageJson: any;
@ -6,7 +7,7 @@ export declare class ProjectinfoNpm {
version: string;
status: string;
license: string;
git: any;
git: plugins.smartstring.GitRepo;
constructor(cwdArg: string, optionsArg?: {
gitAccessToken?: string;
});

View File

@ -1,4 +1,5 @@
import { ProjectinfoNpm } from './projectinfo.classes.npm';
import { ProjectinfoGit } from './projectinfo.classes.git';
export declare type TProjectType = 'git' | 'npm';
/**
* class projectinfo automatically examines a given directory and exposes relevant info about it
@ -6,8 +7,9 @@ export declare type TProjectType = 'git' | 'npm';
export declare class ProjectInfo {
type: TProjectType;
npm: ProjectinfoNpm;
git: ProjectinfoGit;
/**
* this constructor
* constructor of class ProjectInfo
*/
constructor(cwdArg: string);
}

View File

@ -1,15 +1,17 @@
"use strict";
const projectinfo_classes_npm_1 = require("./projectinfo.classes.npm");
const projectinfo_classes_git_1 = require("./projectinfo.classes.git");
/**
* class projectinfo automatically examines a given directory and exposes relevant info about it
*/
class ProjectInfo {
/**
* this constructor
* constructor of class ProjectInfo
*/
constructor(cwdArg) {
this.npm = new projectinfo_classes_npm_1.ProjectinfoNpm(cwdArg);
this.git = new projectinfo_classes_git_1.ProjectinfoGit(cwdArg);
}
}
exports.ProjectInfo = ProjectInfo;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5wcm9qZWN0aW5mby5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLmNsYXNzZXMucHJvamVjdGluZm8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLHVFQUEwRDtBQUkxRDs7R0FFRztBQUNIO0lBR0k7O09BRUc7SUFDSCxZQUFZLE1BQWM7UUFDdEIsSUFBSSxDQUFDLEdBQUcsR0FBRyxJQUFJLHdDQUFjLENBQUMsTUFBTSxDQUFDLENBQUE7SUFDekMsQ0FBQztDQUlKO0FBWkQsa0NBWUMifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5wcm9qZWN0aW5mby5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLmNsYXNzZXMucHJvamVjdGluZm8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLHVFQUEwRDtBQUMxRCx1RUFBMEQ7QUFHMUQ7O0dBRUc7QUFDSDtJQUlJOztPQUVHO0lBQ0gsWUFBWSxNQUFjO1FBQ3RCLElBQUksQ0FBQyxHQUFHLEdBQUcsSUFBSSx3Q0FBYyxDQUFDLE1BQU0sQ0FBQyxDQUFBO1FBQ3JDLElBQUksQ0FBQyxHQUFHLEdBQUcsSUFBSSx3Q0FBYyxDQUFDLE1BQU0sQ0FBQyxDQUFBO0lBQ3pDLENBQUM7Q0FDSjtBQVhELGtDQVdDIn0=

View File

@ -1,5 +1,6 @@
import 'typings-global';
export declare let path: any;
export declare let Q: any;
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');

View File

@ -1,7 +1,8 @@
"use strict";
require("typings-global");
exports.path = require('path');
exports.Q = require('q');
exports.path = require("path");
exports.q = require("q");
exports.smartfile = require("smartfile");
exports.smartstring = require("smartstring");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUNaLFFBQUEsSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtBQUN0QixRQUFBLENBQUMsR0FBSSxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUE7QUFDNUIseUNBQThDO0FBQzlDLDZDQUFrRCJ9
exports.smartpath = require("smartpath");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUN2QiwrQkFBb0M7QUFDcEMseUJBQThCO0FBQzlCLHlDQUE4QztBQUM5Qyw2Q0FBa0Q7QUFDbEQseUNBQThDIn0=

View File

@ -30,8 +30,10 @@
"typings-test": "^1.0.3"
},
"dependencies": {
"@types/q": "0.0.32",
"q": "^1.4.1",
"smartfile": "4.1.0",
"smartpath": "^3.2.6",
"smartstring": "2.0.22",
"typings-global": "^1.0.14"
}

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')