| 
									
										
										
										
											2016-06-03 02:56:20 +02:00
										 |  |  | import "typings-global"; | 
					
						
							|  |  |  | import * as plugins from "./npmci.plugins"; | 
					
						
							| 
									
										
										
										
											2016-06-05 23:24:11 +02:00
										 |  |  | import * as paths from "./npmci.paths"; | 
					
						
							| 
									
										
										
										
											2016-06-03 02:56:20 +02:00
										 |  |  | import {GitRepo} from "smartstring"; | 
					
						
							| 
									
										
										
										
											2016-06-05 02:17:55 +02:00
										 |  |  | import {Dockerfile} from "./npmci.build.docker" | 
					
						
							| 
									
										
										
										
											2016-06-03 02:56:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-05 21:11:30 +02:00
										 |  |  | export let repo:GitRepo = new GitRepo(process.env.CI_BUILD_REPO); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export let buildStage:string = process.env.CI_BUILD_STAGE; | 
					
						
							| 
									
										
										
										
											2016-06-03 03:44:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-05 23:24:11 +02:00
										 |  |  | // handling config between commands
 | 
					
						
							| 
									
										
										
										
											2016-06-05 01:31:21 +02:00
										 |  |  | export let dockerRegistry; // will be set by npmci.prepare
 | 
					
						
							| 
									
										
										
										
											2016-06-05 05:16:14 +02:00
										 |  |  | export let dockerFilesBuilt:Dockerfile[] = []; | 
					
						
							|  |  |  | export let dockerFiles:Dockerfile[] = []; | 
					
						
							| 
									
										
										
										
											2016-06-05 02:17:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-05 23:53:01 +02:00
										 |  |  | export let configStore = () => { | 
					
						
							| 
									
										
										
										
											2016-06-07 12:36:00 +02:00
										 |  |  |     let config = { | 
					
						
							|  |  |  |         dockerRegistry: dockerRegistry, | 
					
						
							|  |  |  |         dockerFilesBuilt: dockerFilesBuilt, | 
					
						
							|  |  |  |         dockerFiles: dockerFiles | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-06-05 23:53:01 +02:00
										 |  |  |     plugins.smartfile.memory.toFsSync( | 
					
						
							|  |  |  |         JSON.stringify(config), | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             fileName:"config.json", | 
					
						
							|  |  |  |             filePath:paths.NpmciPackageRoot | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-05 23:24:11 +02:00
										 |  |  | export let configLoad = () => { | 
					
						
							| 
									
										
										
										
											2016-06-07 12:36:00 +02:00
										 |  |  |     let config; | 
					
						
							| 
									
										
										
										
											2016-06-05 23:53:01 +02:00
										 |  |  |     try { | 
					
						
							|  |  |  |         config = plugins.smartfile.local.toObjectSync(paths.NpmciPackageConfig,"json"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     catch(err){ | 
					
						
							|  |  |  |         config = {}; | 
					
						
							|  |  |  |         configStore(); | 
					
						
							| 
									
										
										
										
											2016-06-07 12:36:00 +02:00
										 |  |  |         plugins.beautylog.log("config initialized!"); | 
					
						
							| 
									
										
										
										
											2016-06-05 23:53:01 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							| 
									
										
										
										
											2016-06-05 23:24:11 +02:00
										 |  |  |     config.dockerRegistry ? dockerRegistry = config.dockerRegistry : void(0); | 
					
						
							|  |  |  |     config.dockerFilesBuilt ? dockerFilesBuilt = config.dockerFilesBuilt : void(0); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-06-05 23:53:01 +02:00
										 |  |  | configLoad(); |