Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 48b48af

Browse files
author
Jelte Lagendijk
committed
Merge branch 'Finaps-master'
2 parents cc43ef6 + 60e5573 commit 48b48af

13 files changed

Lines changed: 1215 additions & 1001 deletions

File tree

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 4
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ test/.project
99

1010
*DS_Store*
1111
node_modules/
12+
*.bak

Gruntfile.js

Lines changed: 178 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,193 @@
1-
'use strict';
1+
// Generated on 2016-01-06 using generator-mendix 1.2.0 :: http://github.com/git+https://github.com/mendix/generator-mendix.git
2+
/*jshint -W069*/
3+
/*global module*/
4+
"use strict";
25

3-
var path = require('path'),
4-
mendixApp = require('node-mendix-modeler-path'),
5-
base64 = require('node-base64-image'),
6-
fs = require('fs'),
7-
xml2js = require('xml2js'),
6+
var path = require("path"),
7+
mendixApp = require("node-mendix-modeler-path"),
8+
base64 = require("node-base64-image"),
9+
semver = require("semver"),
10+
xml2js = require("xml2js"),
811
parser = new xml2js.Parser(),
9-
builder = new xml2js.Builder(),
10-
shelljs = require('shelljs');
12+
builder = new xml2js.Builder({
13+
renderOpts: { pretty: true, indent: " ", newline: "\n" },
14+
xmldec: { standalone: null, encoding: "utf-8" }
15+
}),
16+
shelljs = require("shelljs");
1117

1218
// In case you seem to have trouble starting Mendix through `grunt start-mendix`, you might have to set the path to the Mendix application.
1319
// If it works, leave MODELER_PATH at null
1420
var MODELER_PATH = null;
15-
var MODELER_ARGS = '/file:{path}';
21+
var MODELER_ARGS = "/file:{path}";
1622

1723
// In case you have a different path to the test project (currently in ./test/Test.mpr) point TEST_PATH to the Test-project (full path). Otherwise, leave at null
18-
var TEST_PATH = path.join(shelljs.pwd(), './test/TreeviewDemo.mpr');
24+
var TEST_PATH = path.join(shelljs.pwd(), "./test/TreeviewDemo.mpr");
1925

2026
module.exports = function (grunt) {
21-
var pkg = grunt.file.readJSON("package.json");
22-
grunt.verbose;
23-
grunt.initConfig({
24-
watch: {
25-
autoDeployUpdate: {
26-
"files": [ "./src/**/*" ],
27-
"tasks": [ "newer:copy", "compress" ],
28-
options: {
29-
debounceDelay: 250,
30-
livereload: true
31-
}
32-
}
33-
},
34-
compress: {
35-
makezip: {
36-
options: {
37-
archive: "./dist/" + pkg.name + ".mpk",
38-
mode: "zip"
27+
var pkg = grunt.file.readJSON("package.json");
28+
var widgetXml = path.join(shelljs.pwd(), "/src/", pkg.name, "/", pkg.name + ".xml");
29+
var packageXml = path.join(shelljs.pwd(), "/src/package.xml");
30+
31+
grunt.initConfig({
32+
watch: {
33+
autoDeployUpdate: {
34+
"files": [ "./src/**/*" ],
35+
"tasks": [ "compress", "newer:copy" ],
36+
options: {
37+
debounceDelay: 250,
38+
livereload: true
39+
}
40+
}
41+
},
42+
compress: {
43+
makezip: {
44+
options: {
45+
archive: "./dist/" + pkg.name + ".mpk",
46+
mode: "zip"
47+
},
48+
files: [{
49+
expand: true,
50+
date: new Date(),
51+
store: false,
52+
cwd: "./src",
53+
src: ["**/*"]
54+
}]
55+
}
3956
},
40-
files: [{
41-
expand: true,
42-
date: new Date(),
43-
store: false,
44-
cwd: "./src",
45-
src: ["**/*"]
46-
}]
47-
}
48-
},
49-
copy: {
50-
deployment: {
51-
files: [
52-
{ dest: "./test/deployment/web/Widgets", cwd: "./src/", src: ["**/*"], expand: true }
53-
]
54-
},
55-
mpks: {
56-
files: [
57-
{ dest: "./test/Widgets", cwd: "./dist/", src: [ pkg.name + ".mpk"], expand: true }
58-
]
59-
}
60-
},
61-
clean: {
62-
build: [
63-
"./dist/" + pkg.name + "/*",
64-
"./test/deployment/web/Widgets/" + pkg.name + "/*",
65-
"./test/Widgets/" + pkg.name + ".mpk"
66-
]
67-
}
68-
});
69-
70-
grunt.loadNpmTasks("grunt-contrib-compress");
71-
grunt.loadNpmTasks("grunt-contrib-clean");
72-
grunt.loadNpmTasks("grunt-contrib-watch");
73-
grunt.loadNpmTasks("grunt-contrib-copy");
74-
grunt.loadNpmTasks("grunt-newer");
75-
76-
grunt.registerTask("start-mendix", function () {
77-
var done = this.async(),
78-
testProjectPath = TEST_PATH !== null ? TEST_PATH : path.join(shelljs.pwd(), '/test/Test.mpr');
79-
80-
if (MODELER_PATH !== null || (mendixApp.err === null && mendixApp.output !== null && mendixApp.output.cmd && mendixApp.output.arg)) {
81-
grunt.util.spawn({
82-
cmd: MODELER_PATH || mendixApp.output.cmd,
83-
args: [
84-
(MODELER_PATH !== null ? MODELER_ARGS : mendixApp.output.arg).replace('{path}', testProjectPath)
85-
]
86-
}, function () {
87-
done();
88-
});
89-
} else {
90-
console.error('Cannot start Modeler, see error:');
91-
console.log(mendixApp.err);
92-
done();
93-
}
94-
});
95-
96-
grunt.registerTask("generate-icon", function () {
97-
var iconPath = path.join(shelljs.pwd(), '/ico.png'),
98-
widgetXml = path.join(shelljs.pwd(), '/src/', pkg.name, '/', pkg.name+'.xml'),
99-
options = {localFile: true, string: true},
100-
done = this.async();
101-
102-
grunt.log.writeln('Processing icon');
103-
104-
if (!grunt.file.exists(iconPath) || !grunt.file.exists(widgetXml)) {
105-
grunt.log.error("can't generate icon");
106-
return done();
107-
}
108-
109-
base64.base64encoder(iconPath, options, function (err, image) {
110-
if (!err) {
111-
var xmlOld = grunt.file.read(widgetXml);
112-
parser.parseString(xmlOld, function (err, result) {
113-
if (!err) {
114-
if (result && result.widget && result.widget.icon) {
115-
result.widget.icon[0] = image;
57+
copy: {
58+
deployment: {
59+
files: [
60+
{ dest: "./test/deployment/web/widgets", cwd: "./src/", src: ["**/*"], expand: true }
61+
]
62+
},
63+
mpks: {
64+
files: [
65+
{ dest: "./test/widgets", cwd: "./dist/", src: [ pkg.name + ".mpk"], expand: true }
66+
]
11667
}
117-
var xmlString = builder.buildObject(result);
118-
grunt.file.write(widgetXml, xmlString);
68+
},
69+
clean: {
70+
build: [
71+
"./dist/" + pkg.name + "/*",
72+
"./test/deployment/web/widgets/" + pkg.name + "/*",
73+
"./test/widgets/" + pkg.name + ".mpk"
74+
]
75+
}
76+
});
77+
78+
grunt.loadNpmTasks("grunt-contrib-compress");
79+
grunt.loadNpmTasks("grunt-contrib-clean");
80+
grunt.loadNpmTasks("grunt-contrib-watch");
81+
grunt.loadNpmTasks("grunt-contrib-copy");
82+
grunt.loadNpmTasks("grunt-newer");
83+
84+
grunt.registerTask("start-modeler", function () {
85+
var done = this.async(),
86+
testProjectPath = TEST_PATH !== null ? TEST_PATH : path.join(shelljs.pwd(), "/test/Test.mpr");
87+
88+
if (MODELER_PATH !== null || (mendixApp.err === null && mendixApp.output !== null && mendixApp.output.cmd && mendixApp.output.arg)) {
89+
grunt.util.spawn({
90+
cmd: MODELER_PATH || mendixApp.output.cmd,
91+
args: [
92+
(MODELER_PATH !== null ? MODELER_ARGS : mendixApp.output.arg).replace("{path}", testProjectPath)
93+
]
94+
}, function () {
95+
done();
96+
});
97+
} else {
98+
console.error("Cannot start Modeler, see error:");
99+
console.log(mendixApp.err);
119100
done();
120-
}
101+
}
102+
});
103+
104+
grunt.registerTask("version", function (version) {
105+
var done = this.async();
106+
if (!grunt.file.exists(packageXml)) {
107+
grunt.log.error("Cannot find " + packageXml);
108+
return done();
109+
}
110+
111+
var xml = grunt.file.read(packageXml);
112+
parser.parseString(xml, function (err, res) {
113+
if (err) {
114+
grunt.log.error(err);
115+
return done();
116+
}
117+
if (res.package.clientModule[0]["$"]["version"]) {
118+
var currentVersion = res.package.clientModule[0]["$"]["version"];
119+
if (!version) {
120+
grunt.log.writeln("\nCurrent version is " + currentVersion);
121+
grunt.log.writeln("Set new version by running 'grunt version:x.y.z'");
122+
done();
123+
} else {
124+
if (!semver.valid(version) || !semver.satisfies(version, ">= 1.0.0")) {
125+
grunt.log.error("\nPlease provide a valid version that is higher than 1.0.0. Current version: " + currentVersion);
126+
done();
127+
} else {
128+
res.package.clientModule[0]["$"]["version"] = version;
129+
pkg.version = version;
130+
var xmlString = builder.buildObject(res);
131+
grunt.file.write(packageXml, xmlString);
132+
grunt.file.write("package.json", JSON.stringify(pkg, null, 2));
133+
done();
134+
}
135+
}
136+
} else {
137+
grunt.log.error("Cannot find current version number");
138+
}
121139
});
122-
}
140+
123141
});
124-
});
125-
126-
grunt.registerTask(
127-
"default",
128-
"Watches for changes and automatically creates an MPK file, as well as copying the changes to your deployment folder",
129-
[ "watch" ]
130-
);
131-
132-
grunt.registerTask(
133-
"clean build",
134-
"Compiles all the assets and copies the files to the build directory.",
135-
[ "clean", "compress", "copy" ]
136-
);
137-
138-
grunt.registerTask(
139-
"build",
140-
[ "clean build" ]
141-
);
142-
};
142+
143+
grunt.registerTask("generate-icon", function () {
144+
var iconPath = path.join(shelljs.pwd(), "/icon.png"),
145+
options = {localFile: true, string: true},
146+
done = this.async();
147+
148+
grunt.log.writeln("Processing icon");
149+
150+
if (!grunt.file.exists(iconPath) || !grunt.file.exists(widgetXml)) {
151+
grunt.log.error("can\'t generate icon");
152+
return done();
153+
}
154+
155+
base64.base64encoder(iconPath, options, function (err, image) {
156+
if (!err) {
157+
var xmlOld = grunt.file.read(widgetXml);
158+
parser.parseString(xmlOld, function (err, result) {
159+
if (!err) {
160+
if (result && result.widget && result.widget.icon) {
161+
result.widget.icon[0] = image;
162+
}
163+
var xmlString = builder.buildObject(result);
164+
grunt.file.write(widgetXml, xmlString);
165+
done();
166+
}
167+
});
168+
} else {
169+
grunt.log.error("can\'t generate icon");
170+
return done();
171+
}
172+
});
173+
});
174+
175+
grunt.registerTask("start-mendix", [ "start-modeler" ]);
176+
177+
grunt.registerTask(
178+
"default",
179+
"Watches for changes and automatically creates an MPK file, as well as copying the changes to your deployment folder",
180+
[ "watch" ]
181+
);
182+
183+
grunt.registerTask(
184+
"clean build",
185+
"Compiles all the assets and copies the files to the build directory.",
186+
[ "clean", "compress", "copy" ]
187+
);
188+
189+
grunt.registerTask(
190+
"build",
191+
[ "clean build" ]
192+
);
193+
};

dist/TreeView.mpk

66.9 KB
Binary file not shown.

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "TreeView",
3-
"version": "4.0.1",
4-
"description": "The treeview and gridview widgets provide the highly customizable grid widgets as seen in home.mendix.com.",
3+
"version": "4.0.2",
4+
"description": "",
55
"private": true,
6-
"dependencies": {},
6+
"dependencies": {
7+
},
78
"devDependencies": {
89
"grunt": "0.4.5",
910
"grunt-contrib-clean": "^0.6.0",
@@ -12,13 +13,10 @@
1213
"grunt-contrib-watch": "^0.6.1",
1314
"grunt-newer": "^1.1.1",
1415
"node-base64-image": "^0.1.0",
15-
"node-mendix-modeler-path": "https://github.com/JelteMX/node-mendix-modeler-path/archive/v1.0.0.tar.gz",
1616
"shelljs": "^0.5.3",
17-
"xml2js": "^0.4.15"
18-
},
19-
"repository": {
20-
"type": "git",
21-
"url": "http://github.com/mendix/TreeViewAndGridView"
17+
"xml2js": "^0.4.15",
18+
"semver": "^5.1.0",
19+
"node-mendix-modeler-path": "https://github.com/JelteMX/node-mendix-modeler-path/archive/v1.0.0.tar.gz"
2220
},
2321
"engines": {
2422
"node": ">=0.12.0"

0 commit comments

Comments
 (0)