-
Notifications
You must be signed in to change notification settings - Fork 6
/
Gruntfile.js
105 lines (102 loc) · 2.6 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
module.exports = function(grunt) {
var config = grunt.file.readJSON('couch.json');
var couch = grunt.option('couch') || 'localhost';
var couchpushopts = null;
if (couch) {
couchpushopts = {
options: {
user: config.couches[couch].user,
pass: config.couches[couch].pass
}
};
couchpushopts[couch] = {};
var files = {};
files[config.couches[couch].database] = 'tmp/libremap-api.json';
couchpushopts[couch] = { files: files};
}
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// lint js files
jshint: {
options: {
'-W025': true // Missing name in function declaration.
},
files: ['ddoc/**/*.js', 'vendor/**/*.js']
},
replace: {
'glue-libremap-common': {
options: { patterns: [ {
match: 'module', replacement: 'libremap-common'
}]},
files: [
{
src: ['couchdb-browserify-glue-module.js'],
dest: 'tmp/libremap-common.glue'
}
]
},
'glue-couchmap-common': {
options: { patterns: [ {
match: 'module', replacement: 'couchmap-common'
}]},
files: [
{
src: ['couchdb-browserify-glue-module.js'],
dest: 'tmp/couchmap-common.glue'
}
]
}
},
browserify: {
'glue-libremap-common': {
dest: 'tmp/libremap-common.js',
src: ['tmp/libremap-common.glue'],
},
'glue-couchmap-common': {
dest: 'tmp/couchmap-common.js',
src: ['tmp/couchmap-common.glue'],
}
},
concat: {
'glue-libremap-common': {
src: [
'tmp/libremap-common.js',
'couchdb-browserify-glue-footer.js'
],
dest: 'tmp/merge/views/lib/libremap-common.js'
},
'glue-couchmap-common': {
src: [
'tmp/couchmap-common.js',
'couchdb-browserify-glue-footer.js'
],
dest: 'tmp/merge/views/lib/couchmap-common.js'
}
},
'couch-compile': {
'libremap-api': {
options: {
merge: 'tmp/merge'
},
files: {
'tmp/libremap-api.json': 'ddoc'
}
}
},
'couch-push': couchpushopts
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-couch');
// Default task(s).
grunt.registerTask('default', ['jshint']);
grunt.registerTask('push', [
'jshint',
'replace',
'browserify',
'concat',
'couch'
]);
};