| 
									
										
										
										
											2010-12-12 01:58:43 -07:00
										 |  |  | (function () { | 
					
						
							| 
									
										
										
										
											2010-12-12 02:13:40 -07:00
										 |  |  |   var walk = require("../lib/walk.js"), | 
					
						
							| 
									
										
										
										
											2010-12-12 01:58:43 -07:00
										 |  |  |     emit = walk(process.argv[2] || "/tmp"), | 
					
						
							|  |  |  |     util = require('util'), | 
					
						
							|  |  |  |     path = require('path'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // nor the root, nor the node should ever be empty
 | 
					
						
							|  |  |  |   walk.fnodeTypesPlural.forEach(function (fnodeType) { | 
					
						
							|  |  |  |     emit.on(fnodeType, function (root, nodes, next) { | 
					
						
							|  |  |  |       if (!nodes || !nodes.length || !root) { | 
					
						
							|  |  |  |         console.log(fnodeType, "empty set", root, nodes.length); //JSON.stringify(nodes));
 | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       next(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   walk.fnodeTypes.forEach(function (fnodeType) { | 
					
						
							|  |  |  |     emit.on(fnodeType, function (root, node, next) { | 
					
						
							|  |  |  |       if (!node || !node.name || !root) { | 
					
						
							|  |  |  |         console.log(fnodeType, "empty item", root, node.name); //JSON.stringify(node));
 | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       next(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   emit.on('directory', function (root, dir, next) { | 
					
						
							|  |  |  |     console.log(path.join(root, dir.name)); | 
					
						
							|  |  |  |     next(); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   /* | 
					
						
							|  |  |  |   emit.on('file', function (root, file, next) { | 
					
						
							|  |  |  |     console.log(path.join(root, file.name)); | 
					
						
							|  |  |  |     next(); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   */ | 
					
						
							| 
									
										
										
										
											2010-12-12 02:13:40 -07:00
										 |  |  |   emit.on('end', function () { | 
					
						
							|  |  |  |     console.log("All Done!"); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2010-12-12 01:58:43 -07:00
										 |  |  | }()); | 
					
						
							|  |  |  | 
 |