23 lines
3.2 KiB
JavaScript
23 lines
3.2 KiB
JavaScript
|
"use strict";
|
||
|
/// <reference path="./typings/main.d.ts" />
|
||
|
var plugins = require("./smartgit.plugins");
|
||
|
var SmartgitCheck = require("./smartgit.check");
|
||
|
module.exports = function (options) {
|
||
|
/***** URL Checks ******/
|
||
|
if (options.from == "undefined" || options.to == "undefined") {
|
||
|
plugins.beautylog.error("smartgit.clone".blue + " : Something is strange about the way you invoked the function");
|
||
|
return;
|
||
|
}
|
||
|
/***** Path Checks ******/
|
||
|
if (!/^\/.*/.test(options.to)) {
|
||
|
plugins.beautylog.error("It seems that the given path " + options.to + " is not absolute.");
|
||
|
return;
|
||
|
}
|
||
|
plugins.beautylog.log("Now cloning " + options.from);
|
||
|
var cloneOptions = {};
|
||
|
var cloneRepository = plugins.nodegit.Clone(options.from, options.to, cloneOptions);
|
||
|
SmartgitCheck(cloneRepository);
|
||
|
};
|
||
|
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNsb25lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0Q0FBNEM7QUFDNUMsSUFBTyxPQUFPLFdBQVcsb0JBQW9CLENBQUMsQ0FBQztBQUMvQyxJQUFPLGFBQWEsV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBRW5ELGlCQUFTLFVBQVMsT0FBTztJQUVyQix5QkFBeUI7SUFDekIsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLElBQUksSUFBSSxXQUFXLElBQUksT0FBTyxDQUFDLEVBQUUsSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDO1FBQzNELE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLGdCQUFnQixDQUFDLElBQUksR0FBRyxnRUFBZ0UsQ0FBQyxDQUFDO1FBQ2xILE1BQU0sQ0FBQztJQUNYLENBQUM7SUFFRCwwQkFBMEI7SUFD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