diff --git a/index.d.ts b/index.d.ts
index 0b8331b..5591aa3 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -1,6 +1,25 @@
///
declare module RemotezipPlugins {
var init: () => {
- remotefile: any;
+ beautylog: any;
+ gulp: any;
+ g: {
+ unzip: any;
+ remoteSrc: any;
+ };
+ path: any;
};
}
+declare var plugins: {
+ beautylog: any;
+ gulp: any;
+ g: {
+ unzip: any;
+ remoteSrc: any;
+ };
+ path: any;
+};
+declare var remotezip: (options: {
+ from: string;
+ toPath: string;
+}) => void;
diff --git a/index.js b/index.js
index e10e14f..30edd66 100644
--- a/index.js
+++ b/index.js
@@ -5,10 +5,35 @@ var RemotezipPlugins;
(function (RemotezipPlugins) {
RemotezipPlugins.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;
};
})(RemotezipPlugins || (RemotezipPlugins = {}));
///
///
+var plugins = RemotezipPlugins.init();
+var remotezip = function (options) {
+ if (!plugins.path.isAbsolute(options.toPath)) {
+ 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;
diff --git a/package.json b/package.json
index a051842..40c68af 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,8 @@
"description": "work with remote zip files",
"main": "index.js",
"scripts": {
- "test": "(npmts)"
+ "test": "(npmts)",
+ "testm": "(npm test) && (node test.js)"
},
"repository": {
"type": "git",
@@ -17,7 +18,11 @@
},
"homepage": "https://github.com/pushrocks/remotezip#readme",
"dependencies": {
- "remotefile": "0.0.13"
+ "beautylog": "^2.0.2",
+ "gulp": "^3.9.0",
+ "gulp-remote-src": "^0.4.0",
+ "gulp-unzip": "^0.1.3",
+ "remotefile": "0.0.14"
},
"devDependencies": {
"npmts": "1.0.9"
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..108b857
--- /dev/null
+++ b/test.js
@@ -0,0 +1,4 @@
+///
+var remotezip = require("./index.js");
+var path = require("path");
+remotezip({ from: "https://github.com/UmbrellaZone/legaldocs/archive/master.zip", toPath: path.resolve("./test/") });
diff --git a/ts/index.ts b/ts/index.ts
index c82c2d5..4dffa0e 100644
--- a/ts/index.ts
+++ b/ts/index.ts
@@ -1,2 +1,26 @@
///
///
+
+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;
\ No newline at end of file
diff --git a/ts/remotezip.plugins.ts b/ts/remotezip.plugins.ts
index 62e5e69..51e7d86 100644
--- a/ts/remotezip.plugins.ts
+++ b/ts/remotezip.plugins.ts
@@ -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;
}
diff --git a/ts/test.ts b/ts/test.ts
new file mode 100644
index 0000000..28864e9
--- /dev/null
+++ b/ts/test.ts
@@ -0,0 +1,4 @@
+///
+var remotezip = require("./index.js");
+var path = require("path");
+remotezip({from:"https://github.com/UmbrellaZone/legaldocs/archive/master.zip",toPath:path.resolve("./test/")});
\ No newline at end of file