From c17db19b9f64075487cede115f20eed768ce7404 Mon Sep 17 00:00:00 2001 From: PhilKunz Date: Sat, 26 Nov 2016 23:18:33 +0100 Subject: [PATCH] added ProjectInfo main class --- dist/projectinfo.classes.git.d.ts | 15 ++++++++++-- dist/projectinfo.classes.git.js | 22 ++++++++++++++--- dist/projectinfo.classes.npm.d.ts | 3 ++- dist/projectinfo.classes.projectinfo.d.ts | 4 +++- dist/projectinfo.classes.projectinfo.js | 6 +++-- dist/projectinfo.plugins.d.ts | 5 ++-- dist/projectinfo.plugins.js | 7 +++--- package.json | 2 ++ ts/projectinfo.classes.git.ts | 29 +++++++++++++++++++---- ts/projectinfo.classes.npm.ts | 2 +- ts/projectinfo.classes.projectinfo.ts | 9 ++++--- ts/projectinfo.plugins.ts | 5 ++-- 12 files changed, 83 insertions(+), 26 deletions(-) diff --git a/dist/projectinfo.classes.git.d.ts b/dist/projectinfo.classes.git.d.ts index 2f0950c..e69bdf5 100644 --- a/dist/projectinfo.classes.git.d.ts +++ b/dist/projectinfo.classes.git.d.ts @@ -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; } diff --git a/dist/projectinfo.classes.git.js b/dist/projectinfo.classes.git.js index 1d1b10f..cb02b26 100644 --- a/dist/projectinfo.classes.git.js +++ b/dist/projectinfo.classes.git.js @@ -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 \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5naXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wcm9qZWN0aW5mby5jbGFzc2VzLmdpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsaURBQWdEO0FBRWhEO0lBTUksWUFBWSxNQUFjO1FBQ3RCLElBQUksQ0FBQyxHQUFHLEdBQUcsTUFBTSxDQUFBO1FBQ2pCLElBQUksQ0FBQyxrQkFBa0IsRUFBRSxDQUFBO0lBQzdCLENBQUM7SUFFRDs7T0FFRztJQUNILGtCQUFrQjtRQUNkLElBQUksY0FBYyxHQUFHLElBQUksT0FBTyxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFBO1FBQzlELElBQUksQ0FBQyxPQUFPLEdBQUcsY0FBYyxDQUFDLG1CQUFtQixDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQ3BELElBQUksQ0FBQyxPQUFPLEdBQUcsY0FBYyxDQUFDLG1CQUFtQixDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQ3hELENBQUM7SUFFRDs7T0FFRztJQUNILG9CQUFvQixDQUFDLFlBQW9CO1FBQ3JDLElBQUksYUFBYSxHQUFHLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUE7SUFDckUsQ0FBQztDQUNKO0FBMUJELHdDQTBCQyJ9 \ No newline at end of file diff --git a/dist/projectinfo.classes.npm.d.ts b/dist/projectinfo.classes.npm.d.ts index 8f284c8..d2d72a4 100644 --- a/dist/projectinfo.classes.npm.d.ts +++ b/dist/projectinfo.classes.npm.d.ts @@ -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; }); diff --git a/dist/projectinfo.classes.projectinfo.d.ts b/dist/projectinfo.classes.projectinfo.d.ts index a7e6739..9104dec 100644 --- a/dist/projectinfo.classes.projectinfo.d.ts +++ b/dist/projectinfo.classes.projectinfo.d.ts @@ -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); } diff --git a/dist/projectinfo.classes.projectinfo.js b/dist/projectinfo.classes.projectinfo.js index 48e5b38..512f0bb 100644 --- a/dist/projectinfo.classes.projectinfo.js +++ b/dist/projectinfo.classes.projectinfo.js @@ -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== \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5wcm9qZWN0aW5mby5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLmNsYXNzZXMucHJvamVjdGluZm8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLHVFQUEwRDtBQUMxRCx1RUFBMEQ7QUFHMUQ7O0dBRUc7QUFDSDtJQUlJOztPQUVHO0lBQ0gsWUFBWSxNQUFjO1FBQ3RCLElBQUksQ0FBQyxHQUFHLEdBQUcsSUFBSSx3Q0FBYyxDQUFDLE1BQU0sQ0FBQyxDQUFBO1FBQ3JDLElBQUksQ0FBQyxHQUFHLEdBQUcsSUFBSSx3Q0FBYyxDQUFDLE1BQU0sQ0FBQyxDQUFBO0lBQ3pDLENBQUM7Q0FDSjtBQVhELGtDQVdDIn0= \ No newline at end of file diff --git a/dist/projectinfo.plugins.d.ts b/dist/projectinfo.plugins.d.ts index 40f7d03..adb72a5 100644 --- a/dist/projectinfo.plugins.d.ts +++ b/dist/projectinfo.plugins.d.ts @@ -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'); diff --git a/dist/projectinfo.plugins.js b/dist/projectinfo.plugins.js index 7937ef3..af143c9 100644 --- a/dist/projectinfo.plugins.js +++ b/dist/projectinfo.plugins.js @@ -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 \ No newline at end of file +exports.smartpath = require("smartpath"); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUN2QiwrQkFBb0M7QUFDcEMseUJBQThCO0FBQzlCLHlDQUE4QztBQUM5Qyw2Q0FBa0Q7QUFDbEQseUNBQThDIn0= \ No newline at end of file diff --git a/package.json b/package.json index 365b7f1..7d1db0b 100644 --- a/package.json +++ b/package.json @@ -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" } diff --git a/ts/projectinfo.classes.git.ts b/ts/projectinfo.classes.git.ts index dc86d34..4865b48 100644 --- a/ts/projectinfo.classes.git.ts +++ b/ts/projectinfo.classes.git.ts @@ -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() } -} \ No newline at end of file + + /** + * 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) + } +} diff --git a/ts/projectinfo.classes.npm.ts b/ts/projectinfo.classes.npm.ts index c12ce9d..c566761 100644 --- a/ts/projectinfo.classes.npm.ts +++ b/ts/projectinfo.classes.npm.ts @@ -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) diff --git a/ts/projectinfo.classes.projectinfo.ts b/ts/projectinfo.classes.projectinfo.ts index e944a5f..bb5adca 100644 --- a/ts/projectinfo.classes.projectinfo.ts +++ b/ts/projectinfo.classes.projectinfo.ts @@ -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) } - - - } \ No newline at end of file diff --git a/ts/projectinfo.plugins.ts b/ts/projectinfo.plugins.ts index fb76da7..a04de34 100644 --- a/ts/projectinfo.plugins.ts +++ b/ts/projectinfo.plugins.ts @@ -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')