Merge pull request #17 from strongloop/feature/fix-executor

Fix references to loopback; fix jshint warnings
This commit is contained in:
Miroslav Bajtoš 2014-06-26 14:54:42 +02:00
commit f222be477e
2 changed files with 6 additions and 5 deletions

View File

@ -127,7 +127,7 @@ function setupDataSources(app, instructions) {
} }
function setupModels(app, instructions) { function setupModels(app, instructions) {
defineModels(instructions); defineModels(app, instructions);
instructions.models.forEach(function(data) { instructions.models.forEach(function(data) {
// Skip base models that are not exported to the app // Skip base models that are not exported to the app
@ -137,20 +137,20 @@ function setupModels(app, instructions) {
}); });
} }
function defineModels(instructions) { function defineModels(app, instructions) {
instructions.models.forEach(function(data) { instructions.models.forEach(function(data) {
var name = data.name; var name = data.name;
var model; var model;
if (!data.definition) { if (!data.definition) {
model = loopback.getModel(name); model = app.loopback.getModel(name);
if (!model) { if (!model) {
throw new Error('Cannot configure unknown model ' + name); throw new Error('Cannot configure unknown model ' + name);
} }
debug('Configuring existing model %s', name); debug('Configuring existing model %s', name);
} else { } else {
debug('Creating new model %s %j', name, data.definition); debug('Creating new model %s %j', name, data.definition);
model = loopback.createModel(data.definition); model = app.loopback.createModel(data.definition);
if (data.sourceFile) { if (data.sourceFile) {
debug('Loading customization script %s', data.sourceFile); debug('Loading customization script %s', data.sourceFile);
var code = require(data.sourceFile); var code = require(data.sourceFile);

View File

@ -151,7 +151,8 @@ describe('compiler', function() {
appdir.writeConfigFileSync('config.local.json', { cfgLocal: 'applied' }); appdir.writeConfigFileSync('config.local.json', { cfgLocal: 'applied' });
var env = process.env.NODE_ENV || 'development'; var env = process.env.NODE_ENV || 'development';
appdir.writeConfigFileSync('config.' + env + '.json', { cfgEnv: 'applied' }); appdir.writeConfigFileSync('config.' + env + '.json',
{ cfgEnv: 'applied' });
var instructions = boot.compile(appdir.PATH); var instructions = boot.compile(appdir.PATH);
var appConfig = instructions.config; var appConfig = instructions.config;