-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathGruntfile.js
91 lines (74 loc) · 2.32 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
jshintrc: true
},
all: [ 'Gruntfile.js', 'index.js', 'lib/**/*.js' ]
},
mochaTest: {
options: {
reporter: 'spec'
},
src: [ 'test/*.js' ]
},
clean: {
"modules": [ 'test/fake-titanium-app/modules' ],
"app": [ 'test/fake-titanium-app/build' ]
},
titaniumifier: {
"module": {}
},
titanium: {
"ios": {
options: {
command: 'build',
logLevel: 'trace',
projectDir: './test/fake-titanium-app',
platform: 'ios'
}
},
"droid": {
options: {
command: 'build',
logLevel: 'trace',
projectDir: './test/fake-titanium-app',
platform: 'android',
deviceId: grunt.option('device-id')
}
}
},
unzip: {
"module": {
src: '<%= pkg.name %>-commonjs-<%= pkg.version %>.zip',
dest: 'test/fake-titanium-app'
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-titanium');
grunt.loadNpmTasks('grunt-titaniumifier');
grunt.loadNpmTasks('grunt-zip');
grunt.registerTask('test:node', [ 'mochaTest' ]);
grunt.registerTask('setup-spec', function () {
grunt.file.copy('./test/config.js', './test/fake-titanium-app/Resources/config.js', {
process: banner
});
grunt.file.copy('./test/spec.js', './test/fake-titanium-app/Resources/spec.js', {
process: banner
});
function banner(source) {
return "\n\n/* DO NOT MODIFY THIS FILE! Work on test/spec.js instead! */\n\n" + source;
}
});
grunt.registerTask('build:titanium', [ 'titaniumifier:module' ]);
grunt.registerTask('test:ios', [ 'unzip:module', 'setup-spec', 'titanium:ios' ]);
grunt.registerTask('test:droid', [ 'unzip:module', 'setup-spec', 'titanium:droid' ]);
grunt.registerTask('ios', [ 'jshint:all', 'clean', 'build:titanium', 'test:ios' ]);
grunt.registerTask('droid', [ 'jshint:all', 'clean', 'build:titanium', 'test:droid' ]);
grunt.registerTask('node', [ 'jshint:all', 'test:node' ]);
grunt.registerTask('default', [ 'node' ]);
};