-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gruntfile.js
75 lines (51 loc) · 1.59 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
74
75
module.exports = function(grunt) {
// Load grunt-microlib config & tasks
var microlibConfig = require('grunt-microlib').init.bind(this)(grunt);
grunt.loadNpmTasks('grunt-microlib');
var config = {
cfg: {
// Name of the project
name: 'ember-data-factory.js',
// Name of the root module (i.e. 'rsvp' -> 'lib/rsvp.js')
barename: 'factory',
// Name of the global namespace to export to
namespace: 'Factory'
},
pkg: grunt.file.readJSON('package.json'),
qunit: {
all: {
options: {
urls: [
'http://localhost:8000'
]
}
}
},
buildTestFiles: {
dist: {
src: ['dist/<%= pkg.name %>-<%= pkg.version %>.js', 'test/tests.js'],
dest: 'tmp/tests.js'
}
},
browserify: {
tests: {
src: ['test/tests.js'],
dest: 'tmp/tests-bundle.js'
}
}
};
// I have no idea what i'm doing
this.registerTask('tests', "Builds the test package", ['concat:deps', 'browserify:tests', 'buildTestFiles:dist']);
grunt.registerMultiTask('buildTestFiles', "Execute the tests", function() {
this.files.forEach(function(f) {
var output = ["(function(globals) {"];
output.push.apply(output, f.src.map(grunt.file.read));
output.push('})(window);');
grunt.file.write(f.dest, output.join("\n"));
});
});
// Merge config into microlibConfig, overwriting existing settings
grunt.initConfig(grunt.util._.merge(microlibConfig, config));
// Load custom tasks from NPM
grunt.loadNpmTasks('grunt-browserify');
};