|
21 | 21 | var engineNameForExtension; // generated mapping of extension to engine name
|
22 | 22 |
|
23 | 23 |
|
24 |
| - // free private functions, for internal setup only |
| 24 | + // free "private" functions, for internal setup only |
25 | 25 |
|
26 | 26 | function findSupportedPatternEngineNames() {
|
27 | 27 | var foundPatternEngineNames = [];
|
28 | 28 |
|
29 |
| - console.log('patternEngines: begin diveSync ===================='); |
30 |
| - |
31 | 29 | // find
|
32 | 30 | diveSync(enginesDirectory, {
|
33 | 31 | recursive: false,
|
|
44 | 42 | engineMatch = baseName.match(engineMatcher),
|
45 | 43 | foundEngineName = engineMatch[1];
|
46 | 44 |
|
47 |
| - console.log('patternEngines: FOUND ENGINE', foundEngineName); |
48 | 45 | foundPatternEngineNames.push(foundEngineName);
|
49 | 46 | });
|
50 | 47 |
|
|
53 | 50 |
|
54 | 51 | // try to load all supported engines
|
55 | 52 | function loadAllEngines(enginesObject) {
|
| 53 | + console.log('\nLoading engines...'); |
| 54 | + |
56 | 55 | enginesObject.supportedPatternEngineNames.forEach(function (engineName) {
|
| 56 | + var notLoaded = false; |
| 57 | + |
57 | 58 | try {
|
58 | 59 | enginesObject[engineName] = require('./engine_' + engineName);
|
59 | 60 | } catch (err) {
|
60 |
| - console.log(err, 'pattern engine "' + engineName + '" not loaded. Did you install its dependency with npm?'); |
| 61 | + // Handle errors loading each pattern engine. This will usually be |
| 62 | + // because the engine's renderer hasn't been installed by the end user |
| 63 | + // -- we don't include any of them (except mustache) by default as |
| 64 | + // depedencies in package.json. |
| 65 | + notLoaded = (err.code === 'MODULE_NOT_FOUND'); |
| 66 | + } finally { |
| 67 | + console.log('-', engineName, 'engine:', |
| 68 | + notLoaded ? 'renderer not installed; engine disabled' : 'good to go'); |
61 | 69 | }
|
62 | 70 | });
|
| 71 | + console.log('Done loading engines.\n'); |
63 | 72 | }
|
64 | 73 |
|
65 | 74 | // produce a mapping between file extension and engine name for each of the
|
|
0 commit comments