Merge branch 'release/v2.0.0-beta3' into production

This commit is contained in:
Miroslav Bajtoš 2014-07-17 19:01:16 +02:00
commit be74e7c1ec
3 changed files with 18 additions and 3 deletions

View File

@ -1,4 +1,5 @@
var assert = require('assert'); var assert = require('assert');
var cloneDeep = require('lodash.clonedeep');
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var toposort = require('toposort'); var toposort = require('toposort');
@ -50,14 +51,17 @@ module.exports = function compile(options) {
var modelInstructions = buildAllModelInstructions( var modelInstructions = buildAllModelInstructions(
modelsRootDir, modelsConfig, modelSources); modelsRootDir, modelsConfig, modelSources);
return { // When executor passes the instruction to loopback methods,
// loopback modifies the data. Since we are loading the data using `require`,
// such change affects also code that calls `require` for the same file.
return cloneDeep({
config: appConfig, config: appConfig,
dataSources: dataSourcesConfig, dataSources: dataSourcesConfig,
models: modelInstructions, models: modelInstructions,
files: { files: {
boot: bootScripts boot: bootScripts
} }
}; });
}; };
function assertIsValidConfig(name, config) { function assertIsValidConfig(name, config) {

View File

@ -1,6 +1,6 @@
{ {
"name": "loopback-boot", "name": "loopback-boot",
"version": "2.0.0-beta2", "version": "2.0.0-beta3",
"description": "Convention-based bootstrapper for LoopBack applications", "description": "Convention-based bootstrapper for LoopBack applications",
"keywords": [ "keywords": [
"StrongLoop", "StrongLoop",
@ -25,6 +25,7 @@
"dependencies": { "dependencies": {
"commondir": "0.0.1", "commondir": "0.0.1",
"debug": "^0.8.1", "debug": "^0.8.1",
"lodash.clonedeep": "^2.4.1",
"semver": "^2.3.0", "semver": "^2.3.0",
"toposort": "^0.2.10", "toposort": "^0.2.10",
"underscore": "^1.6.0" "underscore": "^1.6.0"

View File

@ -402,6 +402,16 @@ describe('compiler', function() {
expect(function() { boot.compile(appdir.PATH); }) expect(function() { boot.compile(appdir.PATH); })
.to.throw(/cyclic dependency/i); .to.throw(/cyclic dependency/i);
}); });
it('returns a new copy of JSON data', function() {
appdir.createConfigFilesSync();
var instructions = boot.compile(appdir.PATH);
instructions.config.modified = true;
instructions = boot.compile(appdir.PATH);
expect(instructions.config).to.not.have.property('modified');
});
}); });
}); });