-
Notifications
You must be signed in to change notification settings - Fork 15
/
Gruntfile.js
204 lines (200 loc) · 7.39 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
module.exports = function(grunt) {
/*
* https://github.com/gruntjs/grunt/wiki/Configuring-tasks
*/
grunt.initConfig({
dirs: {
handlebars: 'couch/app/_attachments/templates'
},
watch: {
handlebars: {
files: ['<%= handlebars.compile.src %>'],
tasks: ['handlebars:compile']
},
less: {
files: ['couch/app/_attachments/bower_components/bootstrap/less/*.less'],
tasks: ['less']
},
coffee: {
files: ['couch/app/_attachments/**/*.coffee','couch/app/lists/**/*.coffee','couch/app/views/**/*.coffee'],
tasks: ['coffee', 'couch']
},
docs: {
files: ['docs/**/*'],
tasks: ['couch']
},
configFiles: {
files: [ 'Gruntfile.js']
},
test: {
files: ['test/**/*.coffee','test/**/*.html'],
//tasks: ['coffeeTest', 'mocha_phantomjs']
tasks: ['coffee']
},
},
compileTestCoffee: {
compile: {
options: {
bare: true
},
expand: true,
flatten: false,
cwd: "test",
src: ["**/*.coffee"],
dest: 'test',
ext: ".js"
}
},
handlebars: {
compile: {
options: {
amd: false,
processName: function(filePath) {
var nuPath = filePath.replace("couch/app/", "")
return nuPath;
}
},
src: ["couch/app/_attachments/templates/**/*.handlebars"],
dest: "couch/app/_attachments/templates/precompiled.handlebars.js"
}
},
less: {
development: {
options: {
paths: ["couch/app/attachments/bower_components/bootstrap/less", "couch/app/_attachments/bower_components/bootstrap/dist/css"],
cleancss: true,
yuicompress: true,
compress: true,
sourceMap: true,
sourceMapFilename: "couch/app/_attachments/bower_components/bootstrap/dist/css/bootstrap.css.map",
sourceMapBasepath: "couch/app/_attachments/bower_components/bootstrap/dist/css/"
},
files: {
"couch/app/_attachments/bower_components/bootstrap/dist/css/bootstrap.css": "couch/app/_attachments/bower_components/bootstrap/less/bootstrap.less"
}
}
},
coffee: {
compile: {
options: {
bare: true
},
expand: true,
flatten: false,
cwd: "couch/app/_attachments",
src: ["**/*.coffee"],
dest: 'couch/app/_attachments',
ext: ".js"
},
compileTest: {
options: {
bare: true
},
expand: true,
flatten: false,
cwd: "test",
src: ["**/*.coffee"],
dest: 'test',
ext: ".js"
}
},
'couch-compile': {
app: {
//files: [
// {src: ['couch/*', '!*.coffee', '!bar.js','!couch/bar.js', '!couch/full/bar.js'], dest: 'tmp/app.json'},
// {src: ['docs/*'], dest: 'tmp/forms.json'}
//]
files: {
'tmp/app.json': 'couch/*',
'tmp/forms.json': 'docs/*'
}
}
},
'couch-push': {
options: {
user: 'coco',
pass: 'blond4eva!'
//user: 'admin',
//pass: 'password'
},
localhost: {
files: {
'http://localhost:5984/coconut': 'tmp/app.json',
'http://localhost:5984/coconut-forms': 'tmp/forms.json',
'https://kiwicentral.org/coconut-forms': 'tmp/forms.json'
}
}
},
bowercopy: {
options: {},
libs: {
options: {
destPrefix: 'couch/app/_attachments/js'
},
files: {
'jquery.js': 'jquery/dist/jquery.js',
'underscore.js': 'underscore/underscore.js',
'moment/moment.min.js': 'moment/min/moment.min.js',
'moment/locale/pt.js': 'moment/locale/pt.js',
'backbone.js': 'backbone/backbone.js',
'backbone.wreqr.js': 'backbone.wreqr/lib/backbone.wreqr.js',
'backbone.babysitter.js': 'backbone.babysitter/lib/backbone.babysitter.js',
'backbone.marionette.js': 'marionette/lib/backbone.marionette.js',
'backbone-pouch.js': 'backbone-pouch/index.js',
'pouchdb.js': 'pouchdb/dist/pouchdb.js',
'pouchdb-collate.js': 'pouchdb-collate/dist/pouchdb-collate.js',
'bootstrap.js': 'bootstrap/dist/js/bootstrap.js',
'ladda-bootstrap/spin.min.js': 'ladda-bootstrap/dist/spin.min.js',
'ladda-bootstrap/ladda.js': 'ladda-bootstrap/dist/ladda.js',
'bootstrap-datetimepicker.min.js': 'eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js',
'handlebars.js': 'handlebars/handlebars.js'
}
},
css: {
options: {
destPrefix: 'couch/app/_attachments/css'
},
files: {
'bootstrap.css': 'bootstrap/dist/css/bootstrap.css',
'bootstrap.css.map': 'bootstrap/dist/css/bootstrap.css.map',
'ladda-themeless.min.css': 'ladda-bootstrap/dist/ladda-themeless.min.css',
'bootstrap-datetimepicker.min.css': 'eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css'
}
},
fonts: {
options: {
destPrefix: 'couch/app/_attachments/fonts'
},
files: {
'glyphicons-halflings-regular.woff2': 'bootstrap/dist/fonts/glyphicons-halflings-regular.woff2',
'glyphicons-halflings-regular.woff': 'bootstrap/dist/fonts/glyphicons-halflings-regular.woff',
'glyphicons-halflings-regular.ttf': 'bootstrap/dist/fonts/glyphicons-halflings-regular.ttf',
'glyphicons-halflings-regular.svg': 'bootstrap/dist/fonts/glyphicons-halflings-regular.svg'
}
}
},
mocha_phantomjs: {
all: ['test/**/*.html']
},
});
// Requires the needed plugin
grunt.loadNpmTasks('grunt-contrib-handlebars');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-couch');
grunt.loadNpmTasks('grunt-bowercopy');
grunt.registerTask('default',['couch']);
grunt.registerTask('default',['less']);
//grunt.registerTask('coffeeTest',['compileTestCoffee']);
grunt.registerTask('test', [
'coffee',
'mocha_phantomjs',
]);
grunt.registerTask('testWatch', [
'watch',
'coffee',
'mocha_phantomjs',
]);
grunt.loadNpmTasks('grunt-mocha-phantomjs');
};