Skip to content

Commit 0a80e45

Browse files
Erwan CarriouErwan Carriou
authored andcommitted
- package of system is automatic (no more manual modification of the system needed),
- update web monoco core addon for package of system, - default value of attribute 'isSyn' for importation of system is 'false', - remove $component.find method (you can use $db.find and $component.get instead), - update documentation and - update build process.
1 parent 2430161 commit 0a80e45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+724
-800
lines changed

Gruntfile.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* You should have received a copy of the GNU General Public License
2020
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
*/
22-
22+
2323

2424
module.exports = function (grunt) {
2525
grunt.initConfig({
@@ -264,6 +264,26 @@ module.exports = function (grunt) {
264264
system.schemas = grunt.option('schemas');
265265
system.types = grunt.option('types');
266266
system.behaviors = grunt.option('behaviors');
267+
268+
// process addon in order to insert subsytem
269+
system.components.MonocoSystem = {};
270+
271+
grunt.file.recurse('src/addons', loadSubSystem);
272+
273+
function loadSubSystem(abspath, rootdir, subdir, filename) {
274+
if (filename.indexOf('.') !== 0) {
275+
var subSystem = grunt.file.readJSON(abspath);
276+
277+
system.components.MonocoSystem[subSystem._id] = {
278+
"_id": subSystem._id,
279+
"name": subSystem.name,
280+
"version": subSystem.version,
281+
"description": subSystem.description,
282+
"subsystem": true,
283+
"master": false
284+
};
285+
}
286+
}
267287

268288
return JSON.stringify(system);
269289
}

addons/web.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
"_id": "1aaee1e6311ff39",
3333
"component": "monoco",
3434
"state": "load",
35-
"action": "function load(url, async) { var xhr = null, callbackLoad = null; xhr = new XMLHttpRequest(); callbackLoad = function callbackLoad(system) { var sysId = $db.system(system); var sys = $component.get(sysId); var systems = document.querySelectorAll('link[rel=system]'); if (sys) { sys.main(); } if (systems.length + 1 === $db.MonocoSystem.count() ) { $component.get('monoco').ready(); } }; if (async) { xhr.open('GET', url, true); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { if (xhr.status === 200) { callbackLoad(JSON.parse(xhr.response)); } } }; xhr.send(null); } else { xhr.open('GET', url, false); xhr.send(null); if (xhr.status === 200) { callbackLoad(JSON.parse(xhr.response)); } }}",
35+
"action": "function load(url, async) { var xhr = null, callbackLoad = null; xhr = new XMLHttpRequest(); callbackLoad = function callbackLoad(system) { var sysId = $db.system(system), sys = $component.get(sysId), systems = document.querySelectorAll('link[rel=system]'), nbSubsystem = $db.MonocoSystem.find({ 'subsystem': true }); if (sys) { sys.main(); } if (systems.length + 1 + nbSubsystem.length === $db.MonocoSystem.count()) { $component.get('monoco').ready(); } }; if (async) { xhr.open('GET', url, true); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { if (xhr.status === 200) { callbackLoad(JSON.parse(xhr.response)); } } }; xhr.send(null); } else { xhr.open('GET', url, false); xhr.send(null); if (xhr.status === 200) { callbackLoad(JSON.parse(xhr.response)); } }}",
3636
"core": true,
3737
"useCoreAPI": true
3838
},
3939
"1f6001773a18791": {
4040
"_id": "1f6001773a18791",
4141
"component": "e89c617b6b15d24",
4242
"state": "main",
43-
"action": "function main() { var systems = [], system = null, i = 0, length = 0; if (typeof document !== 'undefined') { systems = document.querySelectorAll('link[rel=system]'); length = systems.length; for (i = 0; i < length; i++) { system = systems[i]; if (system.getAttribute('async') === 'true') { this.require('monoco').load(system.href, true); } else { this.require('monoco').load(system.href, false); } } if (length === 0) { this.require('monoco').ready(); } }}",
43+
"action": "function main() { var subsystems = [], systems = [], system = null, i = 0, length = 0; subsystems = $db.MonocoSystem.find({ 'subsystem': true }); subsystems.forEach(function (subsystem) { var subsystemId = subsystem._id; this.require(subsystemId).main(); }, this); if (typeof document !== 'undefined') { systems = document.querySelectorAll('link[rel=system]'); length = systems.length; for (i = 0; i < length; i++) { system = systems[i]; if (system.getAttribute('async') === 'false') { this.require('monoco').load(system.href, false); } else { this.require('monoco').load(system.href, true); } } if (length === 0) { this.require('monoco').ready(); } }}",
4444
"core": true
4545
}
4646
},

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monoco",
3-
"version": "0.6.7",
3+
"version": "0.7.0",
44
"description": "A Model and a NoSQL Database for Components",
55
"license": "GPL-3.0",
66
"homepage": "https://github.com/monocojs/monoco.git",

build/monoco-min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)