now working
This commit is contained in:
24
ts/index.ts
24
ts/index.ts
@ -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;
|
@ -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
4
ts/test.ts
Normal 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/")});
|
Reference in New Issue
Block a user