This repository has been archived by the owner on Feb 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Gruntfile.coffee
158 lines (140 loc) · 4.68 KB
/
Gruntfile.coffee
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
os = require 'os'
path = require 'path'
gruntFunction = (grunt) ->
pkg = grunt.file.readJSON 'package.json'
binDir = 'binaries/Vessel.app'
contentsDir = "#{binDir}/Contents"
resourcesDir = "#{contentsDir}/Resources"
appDir = "#{resourcesDir}/app"
staticDir = "#{appDir}/static"
cssDir = "#{staticDir}/css"
infoPlist = "#{contentsDir}/Info.plist"
grunt.initConfig
pkg: pkg
checkDependencies:
this: {}
devUpdate:
main:
options:
updateType: 'prompt'
reportUpdated: false
semver: true
clean:
app: appDir
build: './build'
css: "#{resourcesDir}/*.css"
fonts: "#{appDir}/static/fonts"
icon: "#{resourcesDir}/*.icns"
dist: binDir
coffee:
app:
expand: true
cwd: 'src/app'
src: ['*.coffee', '*/*.coffee']
dest: appDir
ext: '.js'
flatten: false
sourceMap: true
coffeelint:
options:
indentation:
value: 2
level: 'warn'
app:
files:
src: ['src/**/*.coffee', 'src/**/*/*.coffee']
copy:
app:
files: [
{expand: true, src: 'resources/Info.plist', dest: contentsDir, flatten: true, filter: 'isFile'}
{expand: true, src: 'resources/Credits.rtf', dest: resourcesDir, flatten: true, filter: 'isFile'}
{expand: true, src: 'resources/vessel.icns', dest: resourcesDir, flatten: true, filter: 'isFile'}
{expand: true, cwd: 'resources', src: 'fonts/**', dest: staticDir}
{expand: true, cwd: 'resources', src: 'images/**', dest: appDir}
{expand: true, cwd: 'resources', src: 'scripts/**', dest: appDir}
{expand: true, cwd: 'resources', src: 'templates/**', dest: appDir}
{expand: true, src: 'package.json', dest: appDir, filter: 'isFile'}
{expand: true, cwd: 'src', src: 'startup/**', dest: appDir}
{expand: true, cwd: 'src', src: 'renderer/**', dest: appDir}
{expand: true, src: 'lib/**', dest: appDir + '/renderer'}
{expand: true, src: 'lib/jquery.js', dest: appDir + '/startup', flatten: true, filter: 'isFile'}
{expand: true, src: 'resources/vessel.css', dest: cssDir, flatten: true, filter: 'isFile'}
]
'build-atom-shell':
tag: 'v0.22.2'
targetDir: './binaries'
buildDir: './build',
projectName: 'vessel'
productName: 'Vessel'
less:
development:
options:
cleancss: true
paths: ['src/less', 'src/less/font-awesome']
files:
'resources/vessel.css': 'src/less/bootstrap.less'
shell:
dist:
command: "./scripts/dist.sh <%= pkg.version %>"
options:
stdout: true
stderr: true
failOnError: false
kill:
command: 'pkill -9 Vessel'
options:
stdout: false
stderr: false
failOnError: false
run:
command: 'binaries/Vessel.app/Contents/MacOS/Vessel'
options:
stdout: true
stderr: true
failOnError: true
template:
info:
options:
data:
productName: "<%= pkg.productName %>"
version: "<%= pkg.version %>"
files:
'resources/Info.plist': 'resources/Info.plist.tmpl'
watch:
config:
files: ['Gruntfile.coffee']
options:
reload: true
coffee:
files: ['src/app/*.coffee']
tasks: ['coffeelint', 'coffee', 'restart']
less:
files: ['src/less/*.less']
tasks: ['less']
package_json:
files: ['package.json']
tasks: ['npm-install']
source:
files: ['lib/**',
'resources/**',
'src/renderer/**']
tasks: ['coffeelint', 'copy', 'restart']
grunt.loadNpmTasks 'grunt-check-dependencies'
grunt.loadNpmTasks 'grunt-coffeelint'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.loadNpmTasks 'grunt-contrib-less'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-dev-update'
grunt.loadNpmTasks 'grunt-build-atom-shell'
grunt.loadNpmTasks 'grunt-npm-install'
grunt.loadNpmTasks 'grunt-shell-spawn'
grunt.loadNpmTasks 'grunt-template'
grunt.registerTask 'default', ['compile']
grunt.registerTask 'setup', ['checkDependencies', 'devUpdate', 'clean:dist', 'build-atom-shell']
grunt.registerTask 'lint', ['coffeelint:app']
grunt.registerTask 'compile', ['lint', 'coffee', 'less', 'template', 'copy']
grunt.registerTask 'dist', ['compile', 'shell:dist']
grunt.registerTask 'run', ['shell:run']
module.exports = gruntFunction