-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
73 lines (68 loc) · 1.91 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
emberTemplates: {
compile: {
options: {
amd: false,
templateBasePath: /client\/app\/templates\//
},
files: {
"client/app/templates/result.js": "client/app/templates/*.handlebars",
}
}
},
neuter: {
options: {
includeSourceURL: true
},
// testing
'client/test/application.js': 'client/app/application.js',
// production
'server/static/js/application.js': 'client/app/application.js'
},
qunit: {
all: {
options: {
urls: ['http://localhost:9000/test/runner.html']
}
}
},
connect: {
server: {
options: {
port: 9000,
base: 'client'
},
}
},
build_test_runner_file: {
all: ['client/test/*_test.js']
},
watch: {
options: {
livereload: true
},
files: ['client/app/**/*', '!client/app/**/result.js'],
tasks: ['default'],
}
});
grunt.loadNpmTasks('grunt-ember-templates');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-neuter');
grunt.registerMultiTask('build_test_runner_file', 'Creates a test runner file.', function(){
var template = grunt.file.read('client/test/runner.html.template');
var renderingContext = {
data: {
files: this.filesSrc.map(function(fileSrc){
return fileSrc.replace('client', '');
})
}
};
grunt.file.write('client/test/runner.html', grunt.template.process(template, renderingContext));
});
grunt.registerTask('test', ['emberTemplates', 'build_test_runner_file', 'neuter', 'connect', 'qunit'])
grunt.registerTask('default', ['emberTemplates', 'neuter']);
};