forked from agrc/atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntFile.js
131 lines (127 loc) · 4.41 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* jshint camelcase:false */
module.exports = function(grunt) {
var jsFiles = 'src/app/**/*.js';
var otherFiles = [
'src/app/**/*.html',
'src/app/**/*.css',
'src/index.html',
'src/ChangeLog.html'
];
var gruntFile = 'GruntFile.js';
var internFile = 'tests/intern.js';
var jshintFiles = [jsFiles, gruntFile, internFile];
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jasmine: {
// for embedded map projects...
// app: {
// src: ['src/EmbeddedMapLoader.js'],
// options: {
// specs: ['src/app/tests/spec/*.js']
// }
// }
// for regular apps...
'default': {
src: ['src/app/run.js'],
options: {
specs: ['src/app/**/Spec*.js'],
vendor: [
'src/jasmine-favicon-reporter/vendor/favico.js',
'src/jasmine-favicon-reporter/jasmine-favicon-reporter.js',
'src/app/tests/jasmineTestBootstrap.js',
'src/dojo/dojo.js'
],
host: 'http://localhost:8000'
}
}
},
jshint: {
files: jshintFiles,
options: {
jshintrc: '.jshintrc'
}
},
watch: {
jshint: {
files: jshintFiles,
tasks: ['jshint', 'jasmine:default:build']
},
src: {
files: jshintFiles.concat(otherFiles),
options: {
livereload: true
}
}
},
connect: {
uses_defaults: {}
},
dojo: {
prod: {
options: {
// You can also specify options to be used in all your tasks
profiles: ['profiles/prod.build.profile.js', 'profiles/build.profile.js'] // Profile for build
}
},
stage: {
options: {
// You can also specify options to be used in all your tasks
profiles: ['profiles/stage.build.profile.js', 'profiles/build.profile.js'] // Profile for build
}
},
options: {
// You can also specify options to be used in all your tasks
dojo: 'src/dojo/dojo.js', // Path to dojo.js file in dojo source
load: 'build', // Optional: Utility to bootstrap (Default: 'build')
releaseDir: '../dist',
require: 'src/app/run.js', // Optional: Module to require for the build (Default: nothing)
basePath: './src'
}
},
processhtml: {
options: {},
dist: {
files: {
'dist/index.html': ['src/index.html']
}
}
},
imagemin: {
dynamic: {
options: {
optimizationLevel: 3
},
files: [{
expand: true, // Enable dynamic expansion
cwd: 'src/', // Src matches are relative to this path
src: ['**/*.{png,jpg,gif}'], // Actual patterns to match
dest: 'dist/' // Destination path prefix
}]
}
},
copy: {
main: {
src: 'src/ChangeLog.html',
dest: 'dist/ChangeLog.html'
}
},
esri_slurp: {
options: {
version: 3.9
}
},
clean: ['dist']
});
// Loading dependencies
for (var key in grunt.file.readJSON('package.json').devDependencies) {
if (key !== 'grunt' && key.indexOf('grunt') === 0) {
grunt.loadNpmTasks(key);
}
}
// Default task.
grunt.registerTask('default', ['jasmine:default:build', 'jshint', 'connect', 'watch']);
grunt.registerTask('build', ['clean', 'dojo:prod', 'imagemin:dynamic', 'copy', 'processhtml:dist']);
grunt.registerTask('stage-build', ['clean', 'dojo:stage', 'imagemin:dynamic', 'copy', 'processhtml:dist']);
grunt.registerTask('travis', ['esri_slurp', 'jshint', 'connect', 'jasmine:default']);
};