Merge pull request #63 from strongloop/feature/fix-lb-issue-756
Fix the test for built-in models on Windows
This commit is contained in:
commit
27bd48e0f6
|
@ -3,6 +3,7 @@ var _ = require('underscore');
|
|||
var semver = require('semver');
|
||||
var debug = require('debug')('loopback:boot:executor');
|
||||
var async = require('async');
|
||||
var path = require('path');
|
||||
|
||||
/**
|
||||
* Execute bootstrap instructions gathered by `boot.compile`.
|
||||
|
@ -181,13 +182,19 @@ function defineModels(app, instructions) {
|
|||
});
|
||||
}
|
||||
|
||||
// Regular expression to match built-in loopback models
|
||||
var LOOPBACK_MODEL_REGEXP = new RegExp(
|
||||
['', 'node_modules', 'loopback', '[^\\/\\\\]+', 'models', '[^\\/\\\\]+\\.js$']
|
||||
.join('\\' + path.sep));
|
||||
|
||||
function isBuiltinLoopBackModel(app, data) {
|
||||
// 1. Built-in models are exposed on the loopback object
|
||||
if (!app.loopback[data.name]) return false;
|
||||
|
||||
// 2. Built-in models have a script file `loopback/{facet}/models/{name}.js`
|
||||
return data.sourceFile &&
|
||||
/node_modules\/loopback\/[^\/]+\/models\/[^\/]+\.js$/.test(data.sourceFile);
|
||||
var srcFile = data.sourceFile;
|
||||
return srcFile &&
|
||||
LOOPBACK_MODEL_REGEXP.test(srcFile);
|
||||
}
|
||||
|
||||
function forEachKeyedObject(obj, fn) {
|
||||
|
|
Loading…
Reference in New Issue