Compare commits
	
		
			4 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| deae50007e | |||
| 9ddf28f90a | |||
| 4321ae3dab | |||
| 1c7542c970 | 
							
								
								
									
										3
									
								
								dist/npmci.build.docker.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								dist/npmci.build.docker.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -1,9 +1,10 @@ | |||||||
| export declare let build: () => any; | export declare let build: () => any; | ||||||
| export declare class Dockerfile { | export declare class Dockerfile { | ||||||
|     filePath: string; |     filePath: string; | ||||||
|     buildTag: string; |  | ||||||
|     repo: string; |     repo: string; | ||||||
|     version: string; |     version: string; | ||||||
|  |     cleanTag: string; | ||||||
|  |     buildTag: string; | ||||||
|     content: string; |     content: string; | ||||||
|     baseImage: string; |     baseImage: string; | ||||||
|     constructor(options: { |     constructor(options: { | ||||||
|   | |||||||
							
								
								
									
										54
									
								
								dist/npmci.build.docker.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										54
									
								
								dist/npmci.build.docker.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										5
									
								
								dist/npmci.build.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								dist/npmci.build.js
									
									
									
									
										vendored
									
									
								
							| @@ -1,11 +1,14 @@ | |||||||
| "use strict"; | "use strict"; | ||||||
| require("typings-global"); | require("typings-global"); | ||||||
|  | var plugins = require("./npmci.plugins"); | ||||||
| var buildDocker = require("./npmci.build.docker"); | var buildDocker = require("./npmci.build.docker"); | ||||||
| exports.build = function (commandArg) { | exports.build = function (commandArg) { | ||||||
|     switch (commandArg) { |     switch (commandArg) { | ||||||
|         case "docker": |         case "docker": | ||||||
|             return buildDocker.build(); |             return buildDocker.build(); | ||||||
|  |         default: | ||||||
|  |             plugins.beautylog.log("build target " + commandArg + " not recognised!"); | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
|  |  | ||||||
| //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmJ1aWxkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFJeEIsSUFBWSxXQUFXLFdBQU0sc0JBRTdCLENBQUMsQ0FGa0Q7QUFFeEMsYUFBSyxHQUFHLFVBQVMsVUFBVTtJQUNsQyxNQUFNLENBQUEsQ0FBQyxVQUFVLENBQUMsQ0FBQSxDQUFDO1FBQ2YsS0FBSyxRQUFRO1lBQ1QsTUFBTSxDQUFDLFdBQVcsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUNuQyxDQUFDO0FBQ0wsQ0FBQyxDQUFBIiwiZmlsZSI6Im5wbWNpLmJ1aWxkLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcbmltcG9ydCAqIGFzIHBsdWdpbnMgZnJvbSBcIi4vbnBtY2kucGx1Z2luc1wiO1xuaW1wb3J0IHtiYXNofSBmcm9tIFwiLi9ucG1jaS5iYXNoXCI7XG5pbXBvcnQgKiBhcyBlbnYgZnJvbSBcIi4vbnBtY2kuZW52XCI7XG5pbXBvcnQgKiBhcyBidWlsZERvY2tlciBmcm9tIFwiLi9ucG1jaS5idWlsZC5kb2NrZXJcIlxuXG5leHBvcnQgbGV0IGJ1aWxkID0gZnVuY3Rpb24oY29tbWFuZEFyZyl7XG4gICAgc3dpdGNoKGNvbW1hbmRBcmcpe1xuICAgICAgICBjYXNlIFwiZG9ja2VyXCI6XG4gICAgICAgICAgICByZXR1cm4gYnVpbGREb2NrZXIuYnVpbGQoKTsgICBcbiAgICB9XG59XG5cblxuXG4iXX0= | //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmJ1aWxkLn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cubG9nKFwiYnVpbGQgdGFyZ2V0IFwiICsgY29tbWFuZEFyZyArIFwiIG5vdCByZWNvZ25pc2VkIVwiKTtcbiAgICB9XG59XG5cblxuXG4iXX0= | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "npmci", |   "name": "npmci", | ||||||
|   "version": "2.1.9", |   "version": "2.1.11", | ||||||
|   "description": "", |   "description": "", | ||||||
|   "main": "dist/index.js", |   "main": "dist/index.js", | ||||||
|   "bin": { |   "bin": { | ||||||
|   | |||||||
| @@ -3,10 +3,14 @@ import * as NpmciEnv from "./npmci.env"; | |||||||
|  |  | ||||||
|  |  | ||||||
| export let build = function(){ | export let build = function(){ | ||||||
|     let done = plugins.q.defer();; |     let done = plugins.q.defer(); | ||||||
|     plugins.gulp.dest("./Dockerfile*") |     plugins.gulp.dest("./Dockerfile*") | ||||||
|         .pipe(readDockerfiles) |         .pipe(readDockerfiles) | ||||||
|         .pipe(plugins.gulpFunction(done.resolve,"atEnd")); |         .pipe(plugins.gulpFunction(function(){ | ||||||
|  |             sortDockerfiles() | ||||||
|  |                 .then(buildDockerfiles) | ||||||
|  |                 .then(done.resolve); | ||||||
|  |         },"atEnd")); | ||||||
|     return done.promise; |     return done.promise; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -19,29 +23,62 @@ let readDockerfiles = function(){ | |||||||
|         NpmciEnv.dockerFiles.push( |         NpmciEnv.dockerFiles.push( | ||||||
|             myDockerfile |             myDockerfile | ||||||
|         ); |         ); | ||||||
|         file["Dockerfile"] = myDockerfile; |  | ||||||
|         cb(null,file); |         cb(null,file); | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
| let buildDockerfiles = function(){ | let sortDockerfiles = function(){ | ||||||
|     return function(file,enc,cb){ |     let done = plugins.q.defer(); | ||||||
|         file.myDockerfile.build(); |     let redoSort:boolean; | ||||||
|         cb(); |     let sortFunction = function(){ | ||||||
|  |         redoSort = false; | ||||||
|  |         let notYetBuiltImages:string[] = []; | ||||||
|  |         NpmciEnv.dockerFiles.forEach((dockerFileArg)=>{ | ||||||
|  |             notYetBuiltImages.push(dockerFileArg.cleanTag); | ||||||
|  |         }); | ||||||
|  |         NpmciEnv.dockerFiles.sort(function(a,b){ | ||||||
|  |             plugins.beautylog.log("sort build order for Dockerimages"); | ||||||
|  |             let aIndex = notYetBuiltImages.indexOf(a.cleanTag); | ||||||
|  |             if(aIndex != -1){notYetBuiltImages.splice(aIndex,1)} | ||||||
|  |             if(notYetBuiltImages.indexOf(b.cleanTag) != -1){ | ||||||
|  |                 redoSort = true; | ||||||
|  |                 return -1; | ||||||
|  |             } else { | ||||||
|  |                 return 0 | ||||||
|             } |             } | ||||||
|  |         }); | ||||||
|  |         if(redoSort){ | ||||||
|  |             sortFunction(); | ||||||
|  |         } else { | ||||||
|  |             done.resolve(); | ||||||
|  |         } | ||||||
|  |     }; | ||||||
|  |     sortFunction(); | ||||||
|  |     return done.promise; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | let buildDockerfiles = function(){ | ||||||
|  |     let done = plugins.q.defer(); | ||||||
|  |     NpmciEnv.dockerFiles.forEach(function(dockerfileArg){ | ||||||
|  |         dockerfileArg.build(); | ||||||
|  |     }) | ||||||
|  |     done.resolve(); | ||||||
|  |     return done.promise; | ||||||
| } | } | ||||||
|  |  | ||||||
| export class Dockerfile { | export class Dockerfile { | ||||||
|     filePath:string; |     filePath:string; | ||||||
|     buildTag:string; |  | ||||||
|     repo:string; |     repo:string; | ||||||
|     version:string; |     version:string; | ||||||
|  |     cleanTag:string; | ||||||
|  |     buildTag:string; | ||||||
|     content:string; |     content:string; | ||||||
|     baseImage:string; |     baseImage:string; | ||||||
|     constructor(options:{filePath?:string,fileContents?:string|Buffer,read?:boolean}){ |     constructor(options:{filePath?:string,fileContents?:string|Buffer,read?:boolean}){ | ||||||
|         this.filePath = options.filePath; |         this.filePath = options.filePath; | ||||||
|         this.repo = NpmciEnv.repo.user + "/" + NpmciEnv.repo.repo; |         this.repo = NpmciEnv.repo.user + "/" + NpmciEnv.repo.repo; | ||||||
|         this.version = dockerFileVersion(plugins.path.parse(options.filePath).base); |         this.version = dockerFileVersion(plugins.path.parse(options.filePath).base); | ||||||
|  |         this.cleanTag = this.repo + ":" + this.version; | ||||||
|         if(options.filePath && options.read){ |         if(options.filePath && options.read){ | ||||||
|             this.content = plugins.smartfile.local.toStringSync(plugins.path.resolve(options.filePath)); |             this.content = plugins.smartfile.local.toStringSync(plugins.path.resolve(options.filePath)); | ||||||
|         }; |         }; | ||||||
|   | |||||||
| @@ -8,6 +8,8 @@ export let build = function(commandArg){ | |||||||
|     switch(commandArg){ |     switch(commandArg){ | ||||||
|         case "docker": |         case "docker": | ||||||
|             return buildDocker.build();    |             return buildDocker.build();    | ||||||
|  |         default: | ||||||
|  |             plugins.beautylog.log("build target " + commandArg + " not recognised!"); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user