forked from gherynos/pluschannel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
151 lines (113 loc) · 4.26 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
Copyright (C) 2012-2017 Luca Zanconato (<luca.zanconato@nharyes.net>)
This file is part of Plus Channel.
Plus Channel is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Plus Channel is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Plus Channel. If not, see <http://www.gnu.org/licenses/>.
*/
module.exports = function (grunt) {
var path = require('path');
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: './app/static/js/app.js',
dest: './app/static/js/app.js'
}
},
concat: {
options: {},
dist: {
src: [
'./temp/min-safe-app.js',
'./temp/min-safe-app-shared.js',
'./temp/min-safe-app-components.js'
],
dest: './app/static/js/app.js'
}
},
ngAnnotate: {
options: {
singleQuotes: true
},
app: {
files: {
'./temp/min-safe-app.js': ['./angular-app/app.module.js', './angular-app/app.routes.js'],
'./temp/min-safe-app-shared.js': ['./angular-app/shared/**/*.js'],
'./temp/min-safe-app-components.js': ['./angular-app/components/**/*.js']
}
}
},
shell: {
pythonServer: {
options: {
stdout: true
},
command: '. venv/bin/activate && python run.py && deactivate'
}
},
copy: {
templates: {
files: [{
expand: true,
flatten: true,
src: ['./angular-app/**/*.tpl.html'],
dest: './app/static/tpl'
}]
},
deploy: {
files: [{
expand: true,
src: ['./app/**', './app.wsgi', './config.py', './config.yaml', './requirements.txt', './db.sqlite', './credentials.json'],
dest: './deploy'
}]
}
},
clean: {
deploy: './deploy',
initial: ['./deploy', './temp', './app/static/js/app.js', './app/static/tpl/*.tpl.html']
},
bower: {
install: {
options: {
targetDir: './app/static',
install: false,
verbose: false,
prune: true,
cleanTargetDir: false,
cleanBowerDir: false,
layout: function (type, component, source) {
return path.join(type);
}
}
}
}
});
// load grunt tasks
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-ng-annotate');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-newer');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-bower-task');
// tasks
grunt.registerTask('copy-templates', ['newer:copy:templates']);
grunt.registerTask('generate-app', ['copy-templates', 'newer:ngAnnotate', 'newer:concat']);
grunt.registerTask('generate-ugly-app', ['generate-app', 'newer:uglify']);
grunt.registerTask('dev-server', ['generate-app', 'shell:pythonServer']);
grunt.registerTask('clear', ['clean:initial']);
grunt.registerTask('default', ['clear', 'generate-ugly-app', 'clean:deploy', 'copy:deploy']);
};