Skip to content

Commit

Permalink
feat(gen) add grunt-ngdoc
Browse files Browse the repository at this point in the history
Add jsdoc to generated text and add grunt-ngdocs generated documentation
to /docs.

Add grunt-ngdocs to package.json & Gruntfile.js. Basic support in js templates.
Watch for changes in js files & autoreload docs after regeneration.

Init work at yeoman#550
  • Loading branch information
wosinekm committed Jan 20, 2014
1 parent 605f3cb commit 5564641
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 2 deletions.
10 changes: 9 additions & 1 deletion templates/common/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = function (grunt) {
},<% } else { %>
js: {
files: ['<%%= yeoman.app %>/scripts/{,*/}*.js'],
tasks: ['newer:jshint:all'],
tasks: ['ngdocs', 'newer:jshint:all'],
options: {
livereload: true
}
Expand Down Expand Up @@ -393,6 +393,13 @@ module.exports = function (grunt) {
configFile: 'karma.conf.js',
singleRun: true
}
},
ngdocs: {
options: {
dest: '.tmp/docs',
html5Mode: false
},
api: ['<%%= yeoman.app %>/scripts/{,*/}*.js'],
}
});

Expand All @@ -407,6 +414,7 @@ module.exports = function (grunt) {
'bower-install',
'concurrent:server',
'autoprefixer',
'ngdocs',
'connect:livereload',
'watch'
]);
Expand Down
3 changes: 2 additions & 1 deletion templates/common/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"grunt-usemin": "~2.0.0",
"jshint-stylish": "~0.1.3",
"load-grunt-tasks": "~0.2.0",
"time-grunt": "~0.2.1"
"time-grunt": "~0.2.1",
"grunt-ngdocs": "~0.1.7"
},
"engines": {
"node": ">=0.10.0"
Expand Down
8 changes: 8 additions & 0 deletions templates/javascript/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
'use strict';

/**
* @ngdoc overview
* @name <%= scriptAppName %>
* @description
* # <%= scriptAppName %>
*
* Main module of the application.
*/
angular.module('<%= scriptAppName %>', [<%= angularModules %>])<% if (ngRoute) { %>
.config(function ($routeProvider) {
$routeProvider
Expand Down
7 changes: 7 additions & 0 deletions templates/javascript/controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';

/**
* @ngdoc function
* @name <%= scriptAppName %>.controller:<%= classedName %>Ctrl
* @description
* # <%= classedName %>Ctrl
* Controller of the <%= scriptAppName %>
*/
angular.module('<%= scriptAppName %>')
.controller('<%= classedName %>Ctrl', function ($scope) {
$scope.awesomeThings = [
Expand Down
7 changes: 7 additions & 0 deletions templates/javascript/decorator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';

/**
* @ngdoc function
* @name <%= scriptAppName %>.decorator:<%= classedName %>
* @description
* # <%= classedName %>Ctrl
* Decorator of the <%= scriptAppName %>
*/
angular.module('<%= scriptAppName %>')
.config(function ($provide) {
$provide.decorator('<%= cameledName %>', function ($delegate) {
Expand Down
7 changes: 7 additions & 0 deletions templates/javascript/directive.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';

/**
* @ngdoc directive
* @name <%= scriptAppName %>.directive:<%= cameledName %>
* @description
* # <%= cameledName %>
* Directive to replace content with custom text.
*/
angular.module('<%= scriptAppName %>')
.directive('<%= cameledName %>', function () {
return {
Expand Down
8 changes: 8 additions & 0 deletions templates/javascript/filter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
'use strict';

/**
* @ngdoc filter
* @name <%= scriptAppName %>.filter:<%= cameledName %>
* @function
* @description
* # <%= cameledName %>
* Filter to change your value.
*/
angular.module('<%= scriptAppName %>')
.filter('<%= cameledName %>', function () {
return function (input) {
Expand Down
7 changes: 7 additions & 0 deletions templates/javascript/service/constant.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
'use strict';

/**
* @ngdoc service
* @name <%= scriptAppName %>.<%= cameledName %>
* @description
* # <%= cameledName %>
* Constat in the <%= scriptAppName %>.
*/
angular.module('<%= scriptAppName %>')
.constant('<%= cameledName %>', 42);
7 changes: 7 additions & 0 deletions templates/javascript/service/factory.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';

/**
* @ngdoc service
* @name <%= scriptAppName %>.<%= cameledName %>
* @description
* # <%= cameledName %>
* Factory in the <%= scriptAppName %>.
*/
angular.module('<%= scriptAppName %>')
.factory('<%= cameledName %>', function () {
// Service logic
Expand Down
7 changes: 7 additions & 0 deletions templates/javascript/service/provider.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';

/**
* @ngdoc service
* @name <%= scriptAppName %>.<%= cameledName %>
* @description
* # <%= cameledName %>
* Provider in the <%= scriptAppName %>.
*/
angular.module('<%= scriptAppName %>')
.provider('<%= cameledName %>', function () {

Expand Down
7 changes: 7 additions & 0 deletions templates/javascript/service/service.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict';

/**
* @ngdoc service
* @name <%= scriptAppName %>.<%= cameledName %>
* @description
* # <%= cameledName %>
* Service in the <%= scriptAppName %>.
*/
angular.module('<%= scriptAppName %>')
.service('<%= classedName %>', function <%= classedName %>() {
// AngularJS will instantiate a singleton by calling "new" on this function
Expand Down
7 changes: 7 additions & 0 deletions templates/javascript/service/value.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
'use strict';

/**
* @ngdoc service
* @name <%= scriptAppName %>.<%= cameledName %>
* @description
* # <%= cameledName %>
* Value in the <%= scriptAppName %>.
*/
angular.module('<%= scriptAppName %>')
.value('<%= cameledName %>', 42);

0 comments on commit 5564641

Please sign in to comment.