2016-01-18 18:38:55 +00:00
|
|
|
/// <reference path="./typings/tsd.d.ts" />
|
|
|
|
/// <reference path="./remotezip.plugins.ts" />
|
2016-01-18 21:17:24 +00:00
|
|
|
|
|
|
|
var plugins = RemotezipPlugins.init();
|
|
|
|
|
2016-01-20 02:30:03 +00:00
|
|
|
var remotezip = {
|
2016-01-20 03:01:21 +00:00
|
|
|
get: function(options:{from:string,toPath:string, cb?}){
|
2016-01-18 21:17:24 +00:00
|
|
|
|
2016-01-20 02:30:03 +00:00
|
|
|
if (!plugins.path.isAbsolute(options.toPath)) { //check wether supplied path is absolute
|
|
|
|
plugins.beautylog.error("Please supply remotezip with an absolute path");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
;
|
2016-01-18 21:17:24 +00:00
|
|
|
|
2016-01-20 03:01:21 +00:00
|
|
|
plugins.gulp.task("remotezip", function () {
|
2016-01-20 02:30:03 +00:00
|
|
|
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;
|
|
|
|
});
|
2016-01-18 21:17:24 +00:00
|
|
|
|
2016-01-20 03:01:21 +00:00
|
|
|
plugins.gulp.task("default",["remotezip"], function(){
|
|
|
|
plugins.beautylog.success("Download complete and archive extracted");
|
|
|
|
if(typeof options.cb == "function"){
|
|
|
|
options.cb();
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2016-01-20 02:30:03 +00:00
|
|
|
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
|
|
|
}
|
2016-01-18 21:17:24 +00:00
|
|
|
};
|
|
|
|
module.exports = remotezip;
|