Skip to content

Commit a5d6285

Browse files
committed
Bug 956634 - [jsdoc] Enable generate all apps/ jsdoc
- auto load grunt tasks - use jsdoc.json for each app
1 parent 3fd5b86 commit a5d6285

File tree

31 files changed

+326
-35
lines changed

31 files changed

+326
-35
lines changed

Gruntfile.js

+44-33
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,58 @@
1+
/* global module, require */
12
module.exports = function(grunt) {
23
'use strict';
34

5+
var fs = require('fs'),
6+
path = require('path');
7+
var JSDOCJSON = 'jsdoc.json';
8+
9+
// Load the plugin that provides tasks.
10+
require('load-grunt-tasks')(grunt);
11+
grunt.loadTasks('tasks');
12+
13+
// merge source to destination dict
14+
function extend(destination, source) {
15+
for (var property in source) {
16+
if (source.hasOwnProperty(property)) {
17+
destination[property] = source[property];
18+
}
19+
}
20+
return destination;
21+
}
22+
23+
var jsdocConfig = {
24+
// per app configurations are defined in each app's jsdoc.json file
25+
options: {
26+
configure: '.jsdocrc',
27+
lenient: true //comment this out to debug jsdoc strictly
28+
}
29+
};
30+
31+
// processing jsdoc configurations
32+
var files = fs.readdirSync('apps');
33+
files.forEach(function(filePath, i) {
34+
var appName = path.join('apps', filePath);
35+
if (fs.statSync(appName).isDirectory()) {
36+
// read jsdoc.json file in each app
37+
var jsonFile = path.join('apps', filePath, JSDOCJSON);
38+
if (fs.existsSync(jsonFile)) {
39+
console.log('... ' + filePath + ' config file found');
40+
var appcfg = JSON.parse(fs.readFileSync(jsonFile,
41+
{ encoding: 'utf8' }));
42+
extend(jsdocConfig, appcfg);
43+
}
44+
}
45+
});
46+
447
// Project configuration
548
grunt.initConfig({
649
pkg: grunt.file.readJSON('package.json'),
750
clean: {
851
docs: ['docs/']
952
},
10-
jsdoc: {
11-
system: {
12-
src: ['apps/system/js/**/*.js',
13-
// XXX Remove the following exclusion after related javascript
14-
// features are supported by JSDocs parser.
15-
'!apps/system/js/airplane_mode.js',
16-
'!apps/system/js/sound_manager.js',
17-
'!apps/system/js/title.js',
18-
'!apps/system/js/value_selector/date_picker.js',
19-
'!apps/system/js/value_selector/spin_date_picker.js',
20-
'!apps/system/js/lockscreen.js',
21-
'!apps/system/js/edge_swipe_detector.js',
22-
'!apps/system/js/stack_manager.js',],
23-
options: {
24-
destination: 'docs/system'
25-
}
26-
},
27-
keyboard: {
28-
src: ['apps/keyboard/js/**/*.js',
29-
'!apps/keyboard/js/render.js'],
30-
options: {
31-
destination: 'docs/keyboard'
32-
}
33-
},
34-
options: {
35-
configure: '.jsdocrc',
36-
lenient: true
37-
}
38-
}
53+
jsdoc: jsdocConfig
3954
});
4055

41-
// Load the plugin that provides tasks
42-
grunt.loadNpmTasks('grunt-contrib-clean');
43-
grunt.loadNpmTasks('grunt-jsdoc');
44-
4556
// Default task(s)
4657
grunt.registerTask('docs', ['clean', 'jsdoc']);
4758
};

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,15 @@ See [how to run the Gaia endurance tests](https://developer.mozilla.org/en-US/do
212212

213213
To generate API reference locally, you have to install grunt with following command:
214214

215-
$ npm -g grunt-cli
215+
```sh
216+
$ npm -g grunt-cli
217+
```
216218

217219
then run `make docs` command to generate docs.
218220
The generated API docs will be located in `docs` folder.
221+
222+
You could generate single app doc with this:
223+
224+
```sh
225+
$ grunt jsdoc:system
226+
```

apps/bluetooth/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"bluetooth": {
3+
"src": ["apps/bluetooth/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/bluetooth"
6+
}
7+
}
8+
}

apps/bookmark/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"bookmark": {
3+
"src": ["apps/bookmark/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/bookmark"
6+
}
7+
}
8+
}

apps/browser/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"browser": {
3+
"src": ["apps/browser/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/browser"
6+
}
7+
}
8+
}

apps/calendar/jsdoc.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"calendar": {
3+
"src": ["apps/calendar/js/**/*.js",
4+
"!apps/calendar/js/controllers/time.js",
5+
"!apps/calendar/js/models/account.js",
6+
"!apps/calendar/js/models/calendar.js",
7+
"!apps/calendar/js/models/event.js",
8+
"!apps/calendar/js/views/month_child.js"
9+
],
10+
"options": {
11+
"destination": "docs/calendar"
12+
}
13+
}
14+
}
15+

apps/callscreen/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"callscreen": {
3+
"src": ["apps/callscreen/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/callscreen"
6+
}
7+
}
8+
}

apps/camera/jsdoc.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"camera": {
3+
"src": ["apps/camera/README.md",
4+
"apps/camera/js/**/*.js"],
5+
"options": {
6+
"destination": "docs/camera"
7+
}
8+
}
9+
}

apps/communications/jsdoc.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"contacts": {
3+
"src": ["apps/communications/contacts/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/contacts"
6+
}
7+
},
8+
"dialer": {
9+
"src": ["apps/communications/dialer/js/**/*.js"],
10+
"options": {
11+
"destination": "docs/dialer"
12+
}
13+
},
14+
"ftu": {
15+
"src": ["apps/communications/ftu/js/**/*.js"],
16+
"options": {
17+
"destination": "docs/ftu"
18+
}
19+
}
20+
}

apps/costcontrol/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"costcontrol": {
3+
"src": ["apps/costcontrol/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/costcontrol"
6+
}
7+
}
8+
}

apps/email/jsdoc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"email": {
3+
"src": ["apps/email/js/**/*.js",
4+
"!apps/email/js/ext/mailapi/activesync/configurator.js"
5+
],
6+
"options": {
7+
"destination": "docs/email"
8+
}
9+
}
10+
}
11+

apps/emergency-call/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"emergencycall": {
3+
"src": ["apps/emergency-call/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/emergency-call"
6+
}
7+
}
8+
}

apps/findmydevice/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"findmydevice": {
3+
"src": ["apps/findmydevice/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/findmydevice"
6+
}
7+
}
8+
}

apps/fl/jsdoc.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"fl": {
3+
"src": ["apps/fl/js/**/*.js",
4+
"!apps/fl/js/utils.js"],
5+
"options": {
6+
"destination": "docs/forwardlock"
7+
}
8+
}
9+
}

apps/fm/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"fm": {
3+
"src": ["apps/fm/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/fm"
6+
}
7+
}
8+
}

apps/gallery/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"gallery": {
3+
"src": ["apps/gallery/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/gallery"
6+
}
7+
}
8+
}

apps/homescreen/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"homescreen": {
3+
"src": ["apps/homescreen/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/homescreen"
6+
}
7+
}
8+
}

apps/keyboard/jsdoc.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"keyboard": {
3+
"src": ["apps/keyboard/js/**/*.js",
4+
"!apps/keyboard/js/render.js"
5+
],
6+
"options": {
7+
"destination": "docs/keyboard"
8+
}
9+
}
10+
}

apps/music/jsdoc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"music": {
3+
"src": ["apps/music/js/**/*.js",
4+
"!apps/music/js/Player.js",
5+
"!apps/music/js/music.js"
6+
],
7+
"options": {
8+
"destination": "docs/music"
9+
}
10+
}
11+
}

apps/operatorvariant/jsdoc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"operatorvariant": {
3+
"src": ["apps/operatorvariant/js/**/*.js",
4+
"!apps/operatorvariant/js/operator_variant.js"
5+
],
6+
"options": {
7+
"destination": "docs/operatorvariant"
8+
}
9+
}
10+
}
11+

apps/ringtones/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"ringtones": {
3+
"src": ["apps/ringtones/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/ringtones"
6+
}
7+
}
8+
}

apps/search/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"search": {
3+
"src": ["apps/search/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/search"
6+
}
7+
}
8+
}

apps/setringtone/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"setringtone": {
3+
"src": ["apps/setringtone/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/setringtone"
6+
}
7+
}
8+
}

apps/settings/jsdoc.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"settings": {
3+
"src": ["apps/settings/README.md",
4+
"apps/settings/js/**/*.js",
5+
"!apps/settings/js/carrier.js",
6+
"!apps/settings/js/mvvm/views.js",
7+
"!apps/settings/js/settings.js",
8+
"!apps/settings/js/wifi.js",
9+
"!apps/settings/js/modules/mvvm/list_view.js",
10+
"!apps/settings/js/panels/send_feedback/send_feedback.js"
11+
],
12+
"options": {
13+
"destination": "docs/settings"
14+
}
15+
}
16+
}

apps/sms/jsdoc.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"sms": {
3+
"src": ["apps/sms/js/**/*.js",
4+
"!apps/sms/js/desktop-only/contacts.js"],
5+
"options": {
6+
"destination": "docs/sms"
7+
}
8+
}
9+
}
10+

apps/system/jsdoc.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"system": {
3+
"src": ["apps/system/js/**/*.js",
4+
"!apps/system/js/airplane_mode.js",
5+
"!apps/system/js/sound_manager.js",
6+
"!apps/system/js/title.js",
7+
"!apps/system/js/value_selector/date_picker.js",
8+
"!apps/system/js/value_selector/spin_date_picker.js",
9+
"!apps/system/js/lockscreen.js",
10+
"!apps/system/js/edge_swipe_detector.js",
11+
"!apps/system/js/stack_manager.js",
12+
"!apps/system/js/lockscreen_window.js",
13+
"!apps/system/js/lockscreen_window_manager.js",
14+
"!apps/system/js/media_playback.js",
15+
"!apps/system/js/radio.js"
16+
],
17+
"options": {
18+
"destination": "docs/system"
19+
}
20+
}
21+
}

apps/video/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"video": {
3+
"src": ["apps/video/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/video"
6+
}
7+
}
8+
}

apps/wallpaper/jsdoc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"wallpaper": {
3+
"src": ["apps/wallpaper/js/**/*.js"],
4+
"options": {
5+
"destination": "docs/wallpaper"
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)