Skip to content

Commit de62bd6

Browse files
committed
Grunt - WIP
1 parent 9d1eb48 commit de62bd6

27 files changed

Lines changed: 690 additions & 77 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
tmp/

.jshintrc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"predef": [
3+
"Ember",
4+
"chrome",
5+
"Conductor",
6+
"$",
7+
"define",
8+
"console",
9+
"alert",
10+
"require",
11+
"requireModule",
12+
"equal",
13+
"notEqual",
14+
"notStrictEqual",
15+
"test",
16+
"asyncTest",
17+
"testBoth",
18+
"testWithDefault",
19+
"raises",
20+
"throws",
21+
"deepEqual",
22+
"start",
23+
"stop",
24+
"ok",
25+
"strictEqual",
26+
"module",
27+
"process",
28+
"expect"
29+
],
30+
"node" : false,
31+
"browser" : true,
32+
"boss" : true,
33+
"curly": false,
34+
"debug": false,
35+
"devel": false,
36+
"eqeqeq": true,
37+
"evil": true,
38+
"forin": false,
39+
"immed": false,
40+
"laxbreak": false,
41+
"newcap": true,
42+
"noarg": true,
43+
"noempty": false,
44+
"nonew": false,
45+
"nomen": false,
46+
"onevar": false,
47+
"plusplus": false,
48+
"regexp": false,
49+
"undef": true,
50+
"sub": true,
51+
"strict": false,
52+
"white": false,
53+
"eqnull": true
54+
}

Gruntfile.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
module.exports = function(grunt) {
2+
require('matchdep')
3+
.filterDev('grunt-*')
4+
.filter(function(name){ return name !== 'grunt-cli'; })
5+
.forEach(grunt.loadNpmTasks);
6+
7+
grunt.initConfig({
8+
pkg: grunt.file.readJSON('package.json'),
9+
transpile: {
10+
main: {
11+
type: "amd",
12+
files: [{
13+
expand: true,
14+
cwd: 'app/',
15+
src: ['**/*.js'],
16+
dest: 'tmp/public/ember_extension'
17+
}]
18+
}
19+
},
20+
clean: ['tmp'],
21+
ember_handlebars: {
22+
compile: {
23+
options: {
24+
processName: function(filename) {
25+
return filename.replace(/app\/templates\//,'').replace(/\.handlebars$/,'');
26+
}
27+
},
28+
files: {
29+
"tmp/public/ember_extension/templates.js": "app/templates/*.handlebars"
30+
}
31+
}
32+
},
33+
jshint: {
34+
all: {
35+
src: [
36+
'Gruntfile.js',
37+
'tmp/public/**/*.js',
38+
'!tmp/public/ember_extension.js',
39+
'!tmp/public/vendor',
40+
'!tmp/public/test.js'
41+
],
42+
options: {
43+
jshintrc: '.jshintrc'
44+
}
45+
}
46+
},
47+
concat: {
48+
main: {
49+
src: ['tmp/public/ember_extension/**/*.js'],
50+
dest: 'tmp/public/ember_extension.js'
51+
}
52+
},
53+
watch: {
54+
scripts: {
55+
files: ['app/**', 'vendor/**'],
56+
tasks: ['build']
57+
// ,
58+
// options: {
59+
// nospawn: true
60+
// }
61+
}
62+
}
63+
});
64+
65+
grunt.registerTask('build', ['clean', 'ember_handlebars', 'transpile', 'jshint', 'concat']);
66+
67+
};

README.md

Whitespace-only changes.

app/application.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import "resolver" as Resolver;
2+
3+
var App = Ember.Application.extend({
4+
modulePrefix: '',
5+
resolver: Resolver
6+
});
7+
8+
export = App;

app/controllers/application.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var ApplicationController = Ember.Controller.extend({
2+
needs: ['mixinStack', 'mixinDetails'],
3+
4+
pushMixinDetails: function(name, property, objectId, details) {
5+
details = { name: name, property: property, objectId: objectId, mixins: details };
6+
this.get('controllers.mixinStack').pushObject(details);
7+
this.set('controllers.mixinDetails.model', details);
8+
},
9+
10+
popMixinDetails: function() {
11+
var mixinStack = this.get('controllers.mixinStack');
12+
var item = mixinStack.popObject();
13+
this.set('controllers.mixinDetails.model', mixinStack.get('lastObject'));
14+
window.releaseObject(item.objectId);
15+
},
16+
17+
activateMixinDetails: function(name, details, objectId) {
18+
var objects = this.get('controllers.mixinStack').forEach(function(item) {
19+
window.releaseObject(item.objectId);
20+
});
21+
22+
this.set('controllers.mixinStack.model', []);
23+
this.pushMixinDetails(name, undefined, objectId, details);
24+
}
25+
});
26+
27+
export = ApplicationController;

app/controllers/mixin_detail.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var MixinDetailController = Ember.ObjectController.extend({
2+
needs: ['mixinDetails'],
3+
4+
isExpanded: function() {
5+
return this.get('model.name') === 'Own Properties';
6+
}.property('model.name'),
7+
8+
digDeeper: function(property) {
9+
var objectId = this.get('controllers.mixinDetails.objectId');
10+
window.digDeeper(objectId, property);
11+
},
12+
13+
calculate: function(property) {
14+
var objectId = this.get('controllers.mixinDetails.objectId');
15+
var mixinIndex = this.get('controllers.mixinDetails.mixins').indexOf(this.get('model'));
16+
window.calculate(objectId, property, mixinIndex);
17+
}
18+
});
19+
20+
export = MixinDetailController;

app/controllers/mixin_details.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var MixinDetailsController = Ember.ObjectController.extend();
2+
3+
export = MixinDetailsController;

app/controllers/mixin_stack.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var MixinStackController = Ember.ArrayController.extend({
2+
needs: ['application'],
3+
4+
trail: function() {
5+
var nested = this.slice(1);
6+
if (nested.length === 0) { return ""; }
7+
return "." + nested.mapProperty('property').join(".");
8+
}.property('[]'),
9+
10+
isNested: function() {
11+
return this.get('length') > 1;
12+
}.property('[]'),
13+
14+
popStack: function() {
15+
this.get('controllers.application').popMixinDetails();
16+
}
17+
});
18+
19+
export = MixinStackController;

app/controllers/view_tree.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var ViewTreeController = Ember.Controller.extend({
2+
showLayer: function(node) {
3+
this.set('pinnedNode', null);
4+
window.showLayer(node.value.objectId);
5+
},
6+
7+
hideLayer: function(node) {
8+
if (!this.get('pinnedNode')) {
9+
window.hideLayer(node.value.objectId);
10+
}
11+
},
12+
13+
pinLayer: function(node) {
14+
this.set('pinnedNode', node);
15+
}
16+
});
17+
18+
export = ViewTreeController;

0 commit comments

Comments
 (0)