forked from tarunc/intercom.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·106 lines (100 loc) · 2.76 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
/*
* Gruntfile.js
*/
'use strict';
// intercom.io uses `[grunt](http://gruntjs.com)` to define and run repetitive tasks
// such as minification, compilation, unit testing, linting, etc.
var path = require('path');
// ## Grunt configuration.
// @export `ConfigureGruntService` a function which configures tasks to be run with
// `grunt`
module.exports = function ConfigureGruntService(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Provide some basic configuration for grunt
grunt.initConfig({
// Read in the package.json to get access to the variables defined in there
pkg: grunt.file.readJSON('package.json'),
// Define the Docker task to generate documentation from our codebase.
docker: {
app: {
expand: true,
src: ['./lib/*.js'],
dest: 'docs',
options: {
onlyUpdated: false,
colourScheme: 'default',
ignoreHidden: false,
sidebarState: false,
exclude: false,
lineNums: true,
js: [],
css: [],
extras: ['fileSearch', 'goToLine']
}
}
},
// Define the various shell tasks
shell: {
// Define a `sweetenDocker` command which sweetens the output from docker
sweetenDocker: {
command: 'bin/sweeten-docker ./docs',
stdout: true,
stderr: true,
failOnError: true
}
},
jshint: {
options: {
jshintrc: true
},
files: {
src: ['lib/*.js', 'index.js', 'Gruntfile.js']
}
},
'gh-pages': {
options: {
base: 'docs',
push: true,
message: 'Auto-generated commit'
},
src: '**/*'
},
copy: {
docs: {
files: [{
src: './docs/intercom.io.js.html',
dest: './docs/index.html'
}]
}
},
'string-replace': {
docs: {
files: [{
expand: true,
cwd: 'docs/lib/',
src: '*',
dest: 'docs/'
}],
options: {
replacements: [{
pattern: /\.\.\//g,
replacement: './'
}]
}
}
}
});
// ## Define the tasks
// ### Default task(s).
// Just running `grunt` will load the default tasks.
// For now, the only default tasks are `jshint:app`
grunt.registerTask('default', ['jshint:app']);
// ### Doc task(s).
// Running `grunt doc` will generate documentation for Quad.
// The documentation will be put into the `./docs` folder in project's root
// folder.
grunt.registerTask('doc', ['docker', 'shell:sweetenDocker', 'string-replace:docs', 'copy:docs', 'gh-pages']);
// @note `grunt docs` provides an alias for the `grunt doc` task
grunt.registerTask('docs', ['doc']);
};