added callback support
This commit is contained in:
11
ts/index.ts
11
ts/index.ts
@ -4,7 +4,7 @@
|
||||
var plugins = RemotezipPlugins.init();
|
||||
|
||||
var remotezip = {
|
||||
get: function(options:{from:string,toPath:string}){
|
||||
get: function(options:{from:string,toPath:string, cb?}){
|
||||
|
||||
if (!plugins.path.isAbsolute(options.toPath)) { //check wether supplied path is absolute
|
||||
plugins.beautylog.error("Please supply remotezip with an absolute path");
|
||||
@ -12,7 +12,7 @@ var remotezip = {
|
||||
}
|
||||
;
|
||||
|
||||
plugins.gulp.task('default', function () {
|
||||
plugins.gulp.task("remotezip", function () {
|
||||
plugins.beautylog.log('Now trying to download and extract...');
|
||||
var stream = plugins.g.remoteSrc(["master.zip"], {
|
||||
base: "https://github.com/UmbrellaZone/legaldocs/archive/"
|
||||
@ -22,6 +22,13 @@ var remotezip = {
|
||||
return stream;
|
||||
});
|
||||
|
||||
plugins.gulp.task("default",["remotezip"], function(){
|
||||
plugins.beautylog.success("Download complete and archive extracted");
|
||||
if(typeof options.cb == "function"){
|
||||
options.cb();
|
||||
};
|
||||
});
|
||||
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
||||
}
|
||||
};
|
||||
|
@ -1,7 +1,11 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
var remotezip = require("./index.js");
|
||||
var path = require("path");
|
||||
|
||||
remotezip.get({
|
||||
from:"https://github.com/UmbrellaZone/legaldocs/archive/master.zip",
|
||||
toPath:path.resolve("./test/")
|
||||
toPath:path.resolve("./test/"),
|
||||
cb: function(){
|
||||
console.log("This is a callback")
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user