| 
									
										
										
										
											2016-08-13 03:06:35 +03:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | **********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var fs = require('fs') | 
					
						
							|  |  |  | var glob = require('glob') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var bootstrap = {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 18:03:26 +03:00
										 |  |  | // XXX add support for json...
 | 
					
						
							| 
									
										
										
										
											2016-08-15 18:26:04 +03:00
										 |  |  | glob('bootstrap/**/*.@(tpl|md|css|html)') | 
					
						
							| 
									
										
										
										
											2016-08-13 03:06:35 +03:00
										 |  |  | 	.on('match', function(path){ | 
					
						
							|  |  |  | 		var p = path | 
					
						
							|  |  |  | 			.replace('bootstrap/', '') | 
					
						
							| 
									
										
										
										
											2016-08-15 20:58:56 +03:00
										 |  |  | 			.replace(/\.(json|txt|md|css|html)/, '') | 
					
						
							| 
									
										
										
										
											2022-04-07 16:46:29 +03:00
										 |  |  | 		console.log('Found:', p) | 
					
						
							| 
									
										
										
										
											2016-08-13 03:06:35 +03:00
										 |  |  | 		bootstrap[p] = { | 
					
						
							|  |  |  | 			text: fs.readFileSync(path).toString(), | 
					
						
							| 
									
										
										
										
											2022-04-05 23:06:50 +03:00
										 |  |  | 		} }) | 
					
						
							| 
									
										
										
										
											2016-08-13 03:06:35 +03:00
										 |  |  | 	.on('end', function(){ | 
					
						
							| 
									
										
										
										
											2022-04-07 16:46:29 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// extra root stuff...
 | 
					
						
							| 
									
										
										
										
											2016-08-15 19:24:58 +03:00
										 |  |  | 		if(fs.existsSync('README.md')){ | 
					
						
							|  |  |  | 			console.log('Setting:', 'About') | 
					
						
							|  |  |  | 			bootstrap['Doc/About'] = { | 
					
						
							|  |  |  | 				text: fs.readFileSync('README.md').toString(), | 
					
						
							| 
									
										
										
										
											2022-04-05 23:06:50 +03:00
										 |  |  | 			} } | 
					
						
							| 
									
										
										
										
											2016-08-15 19:24:58 +03:00
										 |  |  | 		if(!bootstrap.WikiHome){ | 
					
						
							|  |  |  | 			console.log('Setting:', 'WikiHome') | 
					
						
							|  |  |  | 			bootstrap.WikiHome = { | 
					
						
							|  |  |  | 				text: '@include(Doc/About)' | 
					
						
							| 
									
										
										
										
											2022-04-05 23:06:50 +03:00
										 |  |  | 			} } | 
					
						
							| 
									
										
										
										
											2022-04-07 16:46:29 +03:00
										 |  |  | 		if(fs.existsSync('LICENSE')){ | 
					
						
							|  |  |  | 			console.log('Setting:', 'LICENSE') | 
					
						
							|  |  |  | 			bootstrap['LICENSE'] = { | 
					
						
							|  |  |  | 				text: `${  | 
					
						
							|  |  |  | 						fs.readFileSync('LICENSE').toString()  | 
					
						
							|  |  |  | 					}<!-- @filter(text) -->`,
 | 
					
						
							|  |  |  | 			} } | 
					
						
							| 
									
										
										
										
											2016-08-15 19:24:58 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-13 03:06:35 +03:00
										 |  |  | 		var txt = '// This file is generated automatically, ' | 
					
						
							|  |  |  | 			+'all changes made here will be lost.' | 
					
						
							|  |  |  | 			+'\n\n' | 
					
						
							|  |  |  | 			+'var Bootstrap = ' + JSON.stringify(bootstrap) | 
					
						
							| 
									
										
										
										
											2022-04-14 21:07:11 +03:00
										 |  |  | 			+'\n\n' | 
					
						
							|  |  |  | 			+'typeof(module) != "undefined" \n' | 
					
						
							|  |  |  | 			+'	&& (module.exports = Bootstrap)' | 
					
						
							| 
									
										
										
										
											2016-08-13 03:06:35 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		console.log('Writing:', 'bootstrap.js') | 
					
						
							| 
									
										
										
										
											2022-04-05 23:06:50 +03:00
										 |  |  | 		fs.writeFileSync('bootstrap.js', txt) }) | 
					
						
							| 
									
										
										
										
											2016-08-13 03:06:35 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /********************************************************************** | 
					
						
							|  |  |  | * vim:set ts=4 sw=4 :                                                */ |