now working
This commit is contained in:
		
							
								
								
									
										21
									
								
								index.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								index.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,25 @@ | |||||||
| /// <reference path="ts/typings/tsd.d.ts" /> | /// <reference path="ts/typings/tsd.d.ts" /> | ||||||
| declare module RemotezipPlugins { | declare module RemotezipPlugins { | ||||||
|     var init: () => { |     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; | ||||||
|   | |||||||
							
								
								
									
										27
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								index.js
									
									
									
									
									
								
							| @@ -5,10 +5,35 @@ var RemotezipPlugins; | |||||||
| (function (RemotezipPlugins) { | (function (RemotezipPlugins) { | ||||||
|     RemotezipPlugins.init = function () { |     RemotezipPlugins.init = function () { | ||||||
|         var plugins = { |         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; |         return plugins; | ||||||
|     }; |     }; | ||||||
| })(RemotezipPlugins || (RemotezipPlugins = {})); | })(RemotezipPlugins || (RemotezipPlugins = {})); | ||||||
| /// <reference path="./typings/tsd.d.ts" /> | /// <reference path="./typings/tsd.d.ts" /> | ||||||
| /// <reference path="./remotezip.plugins.ts" /> | /// <reference path="./remotezip.plugins.ts" /> | ||||||
|  | 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; | ||||||
|   | |||||||
| @@ -4,7 +4,8 @@ | |||||||
|   "description": "work with remote zip files", |   "description": "work with remote zip files", | ||||||
|   "main": "index.js", |   "main": "index.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "test": "(npmts)" |     "test": "(npmts)", | ||||||
|  |     "testm": "(npm test) && (node test.js)" | ||||||
|   }, |   }, | ||||||
|   "repository": { |   "repository": { | ||||||
|     "type": "git", |     "type": "git", | ||||||
| @@ -17,7 +18,11 @@ | |||||||
|   }, |   }, | ||||||
|   "homepage": "https://github.com/pushrocks/remotezip#readme", |   "homepage": "https://github.com/pushrocks/remotezip#readme", | ||||||
|   "dependencies": { |   "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": { |   "devDependencies": { | ||||||
|     "npmts": "1.0.9" |     "npmts": "1.0.9" | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								test.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								test.js
									
									
									
									
									
										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/") }); | ||||||
							
								
								
									
										24
									
								
								ts/index.ts
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								ts/index.ts
									
									
									
									
									
								
							| @@ -1,2 +1,26 @@ | |||||||
| /// <reference path="./typings/tsd.d.ts" /> | /// <reference path="./typings/tsd.d.ts" /> | ||||||
| /// <reference path="./remotezip.plugins.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 { | module RemotezipPlugins { | ||||||
|     export var init = function() { |     export var init = function() { | ||||||
|         var plugins = { |         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; |         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