now working

This commit is contained in:
2016-01-18 22:17:24 +01:00
parent 228a913e36
commit 11464d2eee
7 changed files with 92 additions and 5 deletions

View File

@ -1,2 +1,26 @@
/// <reference path="./typings/tsd.d.ts" />
/// <reference path="./remotezip.plugins.ts" />
var plugins = RemotezipPlugins.init();
var remotezip = function(options:{from:string,toPath:string}){
if(!plugins.path.isAbsolute(options.toPath)){ //check wether supplied path is absolute
plugins.beautylog.error("Please supply remotezip with an absolute path");
return;
};
plugins.gulp.task('default',function () {
plugins.beautylog.log('Now trying to download and extract...');
var stream = plugins.g.remoteSrc(["master.zip"],{
base:"https://github.com/UmbrellaZone/legaldocs/archive/"
})
.pipe(plugins.g.unzip())
.pipe(plugins.gulp.dest(options.toPath));
return stream;
});
plugins.gulp.start.apply(plugins.gulp, ['default']);
};
module.exports = remotezip;

View File

@ -2,7 +2,13 @@
module RemotezipPlugins {
export var init = function() {
var plugins = {
remotefile: require("remotefile")
beautylog: require("beautylog"),
gulp: require("gulp"),
g:{
unzip: require("gulp-unzip"),
remoteSrc: require("gulp-remote-src")
},
path: require("path")
};
return plugins;
}

4
ts/test.ts Normal file
View File

@ -0,0 +1,4 @@
/// <reference path="./typings/tsd.d.ts" />
var remotezip = require("./index.js");
var path = require("path");
remotezip({from:"https://github.com/UmbrellaZone/legaldocs/archive/master.zip",toPath:path.resolve("./test/")});