-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
92 lines (80 loc) · 2.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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
simplemocha: {
options: {
globals: [],
timeout: 3000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'dot'
},
all: { src: ['test'] }
},
docco: {
debug: {
src: ['lib/index.js'],
options: {
output: 'docs',
layout: 'parallel'
}
}
},
doxx: {
all: {
src: 'lib/index.js',
target: 'docs/api',
options: {
title: 'flx'
}
}
},
'gh-pages': {
options: {
branch: 'gh-pages',
base: 'docs'
},
deploy: {
options: {
user: {
name: 'gh-pages',
email: '[email protected]'
},
repo: 'https://' + process.env.GH_TOKEN + '@github.com/etnbrd/flx-lib.git',
message: 'publish gh-pages (auto)' + getDeployMessage(),
silent: true
},
src: ['**/*']
}
}
});
function getDeployMessage() {
var ret = '\n\n';
if (process.env.TRAVIS !== 'true') {
ret += 'missing env vars for travis-ci';
return ret;
}
ret += 'branch: ' + process.env.TRAVIS_BRANCH + '\n';
ret += 'SHA: ' + process.env.TRAVIS_COMMIT + '\n';
ret += 'range SHA: ' + process.env.TRAVIS_COMMIT_RANGE + '\n';
ret += 'build id: ' + process.env.TRAVIS_BUILD_ID + '\n';
ret += 'build number: ' + process.env.TRAVIS_BUILD_NUMBER + '\n';
return ret;
}
function deploy(){
// if (process.env.TRAVIS === 'true' && process.env.TRAVIS_SECURE_ENV_VARS === 'true' && process.env.TRAVIS_PULL_REQUEST === 'false') {
grunt.log.writeln('executing deployment');
grunt.task.run('gh-pages:deploy');
// } else {
// grunt.log.writeln('skipped deployment');
// }
}
grunt.loadNpmTasks('grunt-docco');
grunt.loadNpmTasks('grunt-doxx');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.registerTask('default', ['simplemocha', 'docco']);
grunt.registerTask('deploy', deploy);
grunt.registerTask('publish', ['docco', 'deploy']);
};