-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGruntfile.js
95 lines (83 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
92
93
94
95
var TEST_CONFIG = {
appName: 'whysaurustest',
appVersion: 'a'
};
var STAGING_CONFIG = {
appName: 'whysaurus',
appVersion: 'c',
};
var PROD_CONFIG = {
appName: 'whysaurus',
appVersion: 'a',
};
var preprocessAppYaml = function(config) {
return {
src : 'app.yaml.stub' ,
dest: 'app.yaml',
options: { inline : true, context : config }
};
};
module.exports = function(grunt) {
// configure the tasks
grunt.initConfig({
clean: {
main: {
src: [ 'app.yaml' ],
},
},
preprocess: {
test: preprocessAppYaml(TEST_CONFIG),
staging: preprocessAppYaml(STAGING_CONFIG),
prod: preprocessAppYaml(PROD_CONFIG),
},
shell: {
local: {
command: 'dev_appserver.py --skip_sdk_update_check --host localhost --port 8081 --admin_host localhost .',
options: {
async: false,
},
}
},
gae: {
options: {
auth: './gae.auth'
},
test: {
action: 'update',
options: {
application: 'whysaurustest',
version: 'a'
}
},
staging: {
action: 'update',
options: {
application: 'whysaurus',
version: 'c'
}
},
live: {
action: 'update',
options: {
application: 'whysaurus',
version: 'a'
}
}
}
});
// load the tasks
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-preprocess');
grunt.loadNpmTasks('grunt-shell-spawn');
grunt.loadNpmTasks('grunt-gae');
// define the tasks
grunt.registerTask('local', 'Builds and deploys to the TEST appengine environment.',
[ 'clean', 'preprocess:test', 'shell:local' ]);
grunt.registerTask('test', 'Builds and deploys to the TEST appengine environment.',
[ 'gae:test' ]);
grunt.registerTask('staging', 'Builds and deploys to the STAGING appengine environment.',
[ 'gae:staging']);
grunt.registerTask('prod', 'Builds and deploys to the PROD appengine environment.',
[ 'gae:live' ]);
};