This commit is contained in:
Philipp Kunz 2017-03-12 22:16:48 +01:00
parent 13c82ce689
commit a602c68d8b
20 changed files with 1137 additions and 2251 deletions

9
.gitignore vendored
View File

@ -1,7 +1,4 @@
.idea/
ts/*.js
ts/*.js.map
node_modules
docs/
coverage/
node_modules/
public/
pages/

View File

@ -1,5 +0,0 @@
.idea/
ts/*.js
ts/*.js.map
node_modules
test/

View File

@ -1,11 +0,0 @@
language: node_js
node_js:
- 4.2.4
deploy:
provider: npm
email: npm@lossless.digital
api_key:
secure: JNfCkELIH8XfYpK6KMwT3p8lT6LWWzpFwTdD1CY6KYKYBL5F3JtaNrVA/5qtXR3QtxQ71pMDuMMTpAUWkcK4/faZn/ZIavsi5b1bXGSwqSez6p70d5Ob4prxvFnjAGUZ0zbfIxhmpMCfFiYLoAYyNAcnlqqKaNI+ARrTFApVuihrpaJj6DyChVY5VbzqIoErDiMYO+BxqPvqzfqabtanCJo2LVgCdZ2RuNMSEUqkn/J9fJoy6+MpgMrNIm/S6e+sCt9VVqVqfxy89SYBc2rmTVaaMlhy6AMbRPVhLqLBn/u4303/5MZlPsAWcyL03GNv3UC1WPaNbA/FNcK3Hxp++p+2hTu/BPes7WWD6/GLilbjt12dRaRlSojlU8BpNd/IzSEnnwFvl68XFoOjaF97lHqoh4W9eeF5Yjd1IcKk2A5ZMS8G/MTblPHDU5AoEKAjTZgf9ntC9iWfEEZYbVuwHcHUONkGfYuTe/nCxRaiCbnUyyEG3I5Gf2+bUyEQSl69pnlhCEDPmD0c+KOz9UPlW833iJ3dQboTcF3TF05nW/YFtLFF5IVgXss+QsBAtuDVj4OJ56b4WJyrFCjr5GgGPI4GjCpDVt8MU1yWRpRycJssKtxAdH5o4WdVPLqIIhf1NJP9xemTaXIQ6EzymxzXKyh9ynp58k+ojUUYb722i7Q=
on:
tags: true
repo: pushrocks/remotezip

32
dist/index.js vendored Normal file
View File

@ -0,0 +1,32 @@
/// <reference path="./typings/tsd.d.ts" />
/// <reference path="./remotezip.plugins.ts" />
var plugins = RemotezipPlugins.init();
var remotezip = {
get: function (options) {
if (!plugins.path.isAbsolute(options.toPath)) {
plugins.beautylog.error("Please supply remotezip with an absolute path");
return;
}
;
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/"
})
.pipe(plugins.g.unzip())
.pipe(plugins.gulp.dest(options.toPath));
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']);
}
};
module.exports = remotezip;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDJDQUEyQztBQUMzQywrQ0FBK0M7QUFFL0MsSUFBSSxPQUFPLEdBQUcsZ0JBQWdCLENBQUMsSUFBSSxFQUFFLENBQUM7QUFFdEMsSUFBSSxTQUFTLEdBQUc7SUFDWixHQUFHLEVBQUUsVUFBUyxPQUF3QztRQUVsRCxFQUFFLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDM0MsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsK0NBQStDLENBQUMsQ0FBQztZQUN6RSxNQUFNLENBQUM7UUFDWCxDQUFDO1FBQ0QsQ0FBQztRQUVELE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFdBQVcsRUFBRTtZQUMzQixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyx1Q0FBdUMsQ0FBQyxDQUFDO1lBQy9ELElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxDQUFD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GVmYXVsdFwiLFtcInJlbW90ZXppcFwiXSwgZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLnN1Y2Nlc3MoXCJEb3dubG9hZCBjb21wbGV0ZSBhbmQgYXJjaGl2ZSBleHRyYWN0ZWRcIik7XG4gICAgICAgICAgICBpZih0eXBlb2Ygb3B0aW9ucy5jYiA9PSBcImZ1bmN0aW9uXCIpe1xuICAgICAgICAgICAgICAgIG9wdGlvbnMuY2IoKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0pO1xuXG4gICAgICAgIHBsdWdpbnMuZ3VscC5zdGFydC5hcHBseShwbHVnaW5zLmd1bHAsIFsnZGVmYXVsdCddKTtcbiAgICB9XG59O1xubW9kdWxlLmV4cG9ydHMgPSByZW1vdGV6aXA7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9

18
dist/remotezip.plugins.js vendored Normal file
View File

@ -0,0 +1,18 @@
/// <reference path="./index.ts" />
var RemotezipPlugins;
(function (RemotezipPlugins) {
RemotezipPlugins.init = function () {
var plugins = {
beautylog: require("beautylog"),
gulp: require("gulp"),
g: {
unzip: require("gulp-unzip"),
remoteSrc: require("gulp-remote-src")
},
path: require("path")
};
return plugins;
};
})(RemotezipPlugins || (RemotezipPlugins = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJlbW90ZXppcC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG1DQUFtQztBQUNuQyxJQUFPLGdCQUFnQixDQWF0QjtBQWJELFdBQU8sZ0JBQWdCLEVBQUMsQ0FBQztJQUNWLHFCQUFJLEdBQUc7UUFDZCxJQUFJLE9BQU8sR0FBRztZQUNWLFNBQVMsRUFBRSxPQUFPLENBQUMsV0FBVyxDQUFDO1lBQy9CLElBQUksRUFBRSxPQUFPLENBQUMsTUFBTSxDQUFDO1lBQ3JCLENBQUMsRUFBQztnQkFDRSxLQUFLLEVBQUUsT0FBTyxDQUFDLFlBQVksQ0FBQztnQkFDNUIsU0FBUyxFQUFFLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQzthQUN4QztZQUNELElBQUksRUFBRSxPQUFPLENBQUMsTUFBTSxDQUFDO1NBQ3hCLENBQUM7UUFDRixNQUFNLENBQUMsT0FBTyxDQUFDO0lBQ25CLENBQUMsQ0FBQTtBQUNMLENBQUMsRUFiTSxnQkFBZ0IsS0FBaEIsZ0JBQWdCLFFBYXRCIiwiZmlsZSI6InJlbW90ZXppcC5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vaW5kZXgudHNcIiAvPlxubW9kdWxlIFJlbW90ZXppcFBsdWdpbnMge1xuICAgIGV4cG9ydCB2YXIgaW5pdCA9IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgcGx1Z2lucyA9IHtcbiAgICAgICAgICAgIGJlYXV0eWxvZzogcmVxdWlyZShcImJlYXV0eWxvZ1wiKSxcbiAgICAgICAgICAgIGd1bHA6IHJlcXVpcmUoXCJndWxwXCIpLFxuICAgICAgICAgICAgZzp7XG4gICAgICAgICAgICAgICAgdW56aXA6IHJlcXVpcmUoXCJndWxwLXVuemlwXCIpLFxuICAgICAgICAgICAgICAgIHJlbW90ZVNyYzogcmVxdWlyZShcImd1bHAtcmVtb3RlLXNyY1wiKVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHBhdGg6IHJlcXVpcmUoXCJwYXRoXCIpXG4gICAgICAgIH07XG4gICAgICAgIHJldHVybiBwbHVnaW5zO1xuICAgIH1cbn0iXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=

28
index.d.ts vendored
View File

@ -1,28 +0,0 @@
/// <reference path="ts/typings/tsd.d.ts" />
declare module RemotezipPlugins {
var init: () => {
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: {
get: (options: {
from: string;
toPath: string;
cb?: any;
}) => void;
};

View File

@ -1,48 +0,0 @@
#!/usr/bin/env node
/// <reference path="./index.ts" />
var RemotezipPlugins;
(function (RemotezipPlugins) {
RemotezipPlugins.init = function () {
var plugins = {
beautylog: require("beautylog"),
gulp: require("gulp"),
g: {
unzip: require("gulp-unzip"),
remoteSrc: require("gulp-remote-src")
},
path: require("path")
};
return plugins;
};
})(RemotezipPlugins || (RemotezipPlugins = {}));
/// <reference path="./typings/tsd.d.ts" />
/// <reference path="./remotezip.plugins.ts" />
var plugins = RemotezipPlugins.init();
var remotezip = {
get: function (options) {
if (!plugins.path.isAbsolute(options.toPath)) {
plugins.beautylog.error("Please supply remotezip with an absolute path");
return;
}
;
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/"
})
.pipe(plugins.g.unzip())
.pipe(plugins.gulp.dest(options.toPath));
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']);
}
};
module.exports = remotezip;

View File

@ -1,5 +1,5 @@
{
"name": "remotezip",
"name": "smartarchive",
"version": "1.0.3",
"description": "work with remote zip files",
"main": "index.js",
@ -9,22 +9,20 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/pushrocks/remotezip.git"
"url": "git+https://github.com/pushrocks/smartarchive.git"
},
"author": "Lossless Digital UG (haftungsbeschraenkt)",
"author": "Lossless GmbH",
"license": "MIT",
"bugs": {
"url": "https://github.com/pushrocks/remotezip/issues"
"url": "https://github.com/pushrocks/smartarchive/issues"
},
"homepage": "https://github.com/pushrocks/remotezip#readme",
"homepage": "https://github.com/pushrocks/smartarchive#readme",
"dependencies": {
"beautylog": "^3.1.2",
"gulp": "^3.9.1",
"gulp-remote-src": "^0.4.1",
"gulp-unzip": "^0.1.3",
"remotefile": "0.0.14"
"beautylog": "^6.1.5",
"gulp-unzip": "^0.2.0",
"smartfile": "^4.1.8",
"smartpath": "^3.2.8"
},
"devDependencies": {
"npmts": "3.5.0"
}
}

11
test/test.js Normal file
View File

@ -0,0 +1,11 @@
/// <reference path="../ts/typings/main.d.ts" />
var smartarchive = require("./index.js");
var path = require("path");
smartarchive.get({
from: "https://github.com/UmbrellaZone/legaldocs/archive/master.zip",
toPath: path.resolve("./test/"),
cb: function () {
console.log("This is a callback");
}
});
//# sourceMappingURL=test.js.map

1
test/test.js.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACzC,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE3B,YAAY,CAAC,GAAG,CAAC;IACb,IAAI,EAAC,8DAA8D;IACnE,MAAM,EAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IAC9B,EAAE,EAAE;QACA,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;IACrC,CAAC;CACJ,CAAC,CAAC"}

View File

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

View File

@ -1,35 +1,8 @@
/// <reference path="./typings/tsd.d.ts" />
/// <reference path="./remotezip.plugins.ts" />
/// <reference path="./typings/main.d.ts" />
var plugins = RemotezipPlugins.init();
import plugins = require("./smartarchive.plugins");
var remotezip = {
get: function(options:{from:string,toPath:string, cb?}){
var smartarchive = {
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("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/"
})
.pipe(plugins.g.unzip())
.pipe(plugins.gulp.dest(options.toPath));
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']);
}
};
module.exports = remotezip;
export = smartarchive;

View File

@ -1,15 +0,0 @@
/// <reference path="./index.ts" />
module RemotezipPlugins {
export var init = function() {
var plugins = {
beautylog: require("beautylog"),
gulp: require("gulp"),
g:{
unzip: require("gulp-unzip"),
remoteSrc: require("gulp-remote-src")
},
path: require("path")
};
return plugins;
}
}

View File

View File

@ -0,0 +1,26 @@
import plugins = require("./smartarchive.plugins");
export let toFS = 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");
return;
};
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/"
})
.pipe(plugins.g.unzip())
.pipe(plugins.gulp.dest(options.toPath));
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']);
};

View File

@ -0,0 +1,8 @@
import 'typings-global'
export let beautylog = require("beautylog");
export let g = {
unzip: require("gulp-unzip"),
};
export let path = require("path");
export let smartfile = require("smartfile");
export let smartpath = require("smartpath");

View File

@ -1,12 +0,0 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"node/node.d.ts": {
"commit": "efa0c1196d7280640e624ac1e7fa604502e7bd63"
}
}
}

File diff suppressed because it is too large Load Diff

1
ts/typings/tsd.d.ts vendored
View File

@ -1 +0,0 @@
/// <reference path="node/node.d.ts" />

1021
yarn.lock Normal file

File diff suppressed because it is too large Load Diff