-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
173 lines (166 loc) · 6.19 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
module.exports = function (grunt) {
var fs = require('fs');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
aws: fs.existsSync("aws.json") ? grunt.file.readJSON('aws.json') : {},
sources: [
'app/**/*',
'package.json',
'bower_components/**/*',
'node_modules/**/*',
'!node_modules/grunt*/**/*',
'!node_modules/karma*/**/*'
],
nwjs: {
options: {
version: '0.12.3',
platforms: ['linux', 'win', 'osx'],
macPlist: 'files/Info.plist'
},
shared: {
options: {
buildDir: '/mnt/hgfs/s'
},
src: ['<%= sources %>']
},
local: {
options: {
buildDir: 'build'
},
src: ['<%= sources %>']
}
},
compress: {
linux64: {
options: {archive: 'package/<%=pkg.name%>-linux64-<%=pkg.version%>.zip'},
files: [{expand: true, cwd: 'build/<%=pkg.name%>/linux64', src: ['*'], dest: '<%=pkg.name%>'}]
},
linux32: {
options: {archive: 'package/<%=pkg.name%>-linux32-<%=pkg.version%>.zip'},
files: [{expand: true, cwd: 'build/<%=pkg.name%>/linux32', src: ['*'], dest: '<%=pkg.name%>'}]
},
win64: {
options: {archive: 'package/<%=pkg.name%>-win64-<%=pkg.version%>.zip'},
files: [{expand: true, cwd: 'build/<%=pkg.name%>/win64', src: ['*'], dest: '<%=pkg.name%>'}]
},
win32: {
options: {archive: 'package/<%=pkg.name%>-win32-<%=pkg.version%>.zip'},
files: [{expand: true, cwd: 'build/<%=pkg.name%>/win32', src: ['*'], dest: '<%=pkg.name%>'}]
},
osx64: {
options: {archive: 'package/<%=pkg.name%>-osx64-<%=pkg.version%>.zip'},
files: [{expand: true, cwd: 'build/<%=pkg.name%>/osx64', src: ['**'], dest: '<%=pkg.name%>'}]
},
osx32: {
options: {archive: 'package/<%=pkg.name%>-osx32-<%=pkg.version%>.zip'},
files: [{expand: true, cwd: 'build/<%=pkg.name%>/osx32', src: ['**'], dest: '<%=pkg.name%>'}]
}
},
clean: {
node_modules: [
'node_modules/**/test',
'node_modules/**/tests',
'node_modules/**/README*',
'node_modules/**/readme*',
'node_modules/**/*.md',
'node_modules/**/Gruntfile.js',
'node_modules/**/example',
'node_modules/**/doc',
'node_modules/**/LICENSE*',
'node_modules/**/.travis.yml'],
package: ['package'],
build: ['build']
},
"file-creator": {
"debug": {
"./app/js/debug.js": function (fs, fd, done) {
fs.writeSync(fd, 'var debug = true;');
done();
}
},
"release": {
"./app/js/debug.js": function (fs, fd, done) {
fs.writeSync(fd, 'var debug = false;');
done();
}
}
},
less: {
compileTheme: {
files: {
"theme/bootstrap-theme.css": "theme/bootstrap-theme.less",
"app/css/bootstrap-theme.css": "theme/bootstrap-theme.less",
"web/bootstrap-theme.css": "theme/bootstrap-theme.less",
"web/style.css": "web/style.less"
},
options: {
sourceMap: true,
sourceMapURL: '../theme/bootstrap-theme.css.map',
sourceMapFilename: 'theme/bootstrap-theme.css.map'
}
}
},
watch: {
options: {
livereload: true
},
less: {
files: [
"theme/*.less",
"web/style.less"
],
tasks: ['less']
},
html: {
files: [
"theme/bootstrap-theme-test.html",
"web/index.html",
"app/index.html"
]
}
},
connect: {
server: {
options: {
hostname: 'localhost',
port: 9002
}
}
},
aws_s3: {
options: {
accessKeyId: '<%= aws.AWSAccessKeyId %>', // Use the variables
secretAccessKey: '<%= aws.AWSSecretKey %>', // You can also use env variables
region: 'us-west-2',
bucket: 'www.streamtim.com',
differential: true
},
site: {
files: [
{expand: true, cwd: 'web/', src: ['**'], dest: './'}
]
},
packages: {
files: [
{expand: true, cwd: 'package/', src: ['**'], dest: './package', stream: true}
]
}
}
});
grunt.loadNpmTasks('grunt-nw-builder');
grunt.loadNpmTasks('grunt-file-creator');
grunt.loadNpmTasks('grunt-aws-s3');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('shareDebug', ['nwjs:shared']);
grunt.registerTask('shareRelease', ['file-creator:release', 'nwjs:shared', 'file-creator:debug']);
grunt.registerTask('debug', ['nwjs:local']);
grunt.registerTask('release', ['file-creator:release', 'nwjs:local', 'file-creator:debug']);
grunt.registerTask('package', ['clean', 'release', 'compress']);
grunt.registerTask('deploy', ['package', 'aws_s3:packages']);
grunt.registerTask('site', ['aws_s3:site']);
grunt.registerTask('default', ['less', 'connect', 'watch']);
};