Skip to content

Commit

Permalink
docs(minErr): Build minErr doc site
Browse files Browse the repository at this point in the history
  • Loading branch information
ksheedlo committed Jul 24, 2013
1 parent dca2317 commit 4a7b6a4
Show file tree
Hide file tree
Showing 52 changed files with 470 additions and 74 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"components-font-awesome": "3.1.0",
"bootstrap": "https://raw.github.com/twitter/bootstrap/v2.0.2/docs/assets/bootstrap.zip",
"closure-compiler": "https://closure-compiler.googlecode.com/files/compiler-20130603.zip",
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.1.1/assets/ng-closure-runner.zip"
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.0/assets/ng-closure-runner.zip"
}
}
68 changes: 68 additions & 0 deletions docs/component-spec/errorDisplaySpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
describe("errorDisplay", function () {

var $location, compileHTML;

beforeEach(module('docsApp'));

beforeEach(inject(function ($injector) {
var $rootScope = $injector.get('$rootScope'),
$compile = $injector.get('$compile');

$location = $injector.get('$location');

compileHTML = function (code) {
var elm = angular.element(code);
$compile(elm)($rootScope);
$rootScope.$digest();
return elm;
};

this.addMatchers({
toInterpolateTo: function (expected) {
// Given a compiled DOM node with a minerr-display attribute,
// assert that its interpolated string matches the expected text.
return this.actual.text() === expected;
}
});
}));

it('should interpolate a template with no parameters', function () {
var elm;

spyOn($location, 'search').andReturn({});
elm = compileHTML('<div error-display="This is a test"></div>');
expect(elm).toInterpolateTo('This is a test');
});

it('should interpolate a template with no parameters when search parameters are present', function () {
var elm;

spyOn($location, 'search').andReturn({ p0: 'foobaz' });
elm = compileHTML('<div error-display="This is a test"></div>');
expect(elm).toInterpolateTo('This is a test');
});

it('should correctly interpolate search parameters', function () {
var elm;

spyOn($location, 'search').andReturn({ p0: '42' });
elm = compileHTML('<div error-display="The answer is {0}"></div>');
expect(elm).toInterpolateTo('The answer is 42');
});

it('should interpolate parameters in the specified order', function () {
var elm;

spyOn($location, 'search').andReturn({ p0: 'second', p1: 'first' });
elm = compileHTML('<div error-display="{1} {0}"></div>');
expect(elm).toInterpolateTo('first second');
});

it('should preserve interpolation markers when fewer arguments than needed are provided', function () {
var elm;

spyOn($location, 'search').andReturn({ p0: 'Fooooo' });
elm = compileHTML('<div error-display="This {0} is {1} on {2}"></div>');
expect(elm).toInterpolateTo('This Fooooo is {1} on {2}');
});
});
7 changes: 7 additions & 0 deletions docs/content/error/cacheFactory/iid.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@ngdoc error
@name $cacheFactory:iid
@fullName Invalid ID
@description

This error occurs when trying to create a new `cacheFactory` object with a
specified cache ID, but the cache ID is already taken.
4 changes: 4 additions & 0 deletions docs/content/error/compile/ctreq.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $compile:ctreq
@fullName Missing Required Controller
@description
4 changes: 4 additions & 0 deletions docs/content/error/compile/iscp.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $compile:iscp
@fullName Invalid Isolate Scope
@description
4 changes: 4 additions & 0 deletions docs/content/error/compile/multidir.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $compile:multidir
@fullName Multiple Directive Resource Contention
@description
4 changes: 4 additions & 0 deletions docs/content/error/compile/noass.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $compile:noass
@fullName Non-Assignable Expression
@description
4 changes: 4 additions & 0 deletions docs/content/error/compile/nodomevents.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $compile:nodomevents
@fullName Interpolated Event Attributes
@description
4 changes: 4 additions & 0 deletions docs/content/error/compile/tpload.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $compile:tpload
@fullName Template Loader Error
@description
4 changes: 4 additions & 0 deletions docs/content/error/compile/tplrt.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $compile:tplrt
@fullName Invalid Template Root
@description
4 changes: 4 additions & 0 deletions docs/content/error/compile/utrat.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $compile:utrat
@fullName Unterminated Attribute
@description
4 changes: 4 additions & 0 deletions docs/content/error/controller/noscp.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $controller:noscp
@fullName Missing $scope object
@description
4 changes: 4 additions & 0 deletions docs/content/error/httpBackend/noxhr.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $httpBackend:noxhr
@fullName Unsupported XHR
@description
13 changes: 13 additions & 0 deletions docs/content/error/index.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@ngdoc overview
@name Error Reference
@description

Use the Error Reference manual to find information about error conditions in
your AngularJS app. Errors thrown in production builds of AngularJS will log
links to this site on the console.

Other useful references for debugging your app include:

- {@link api/ API Reference} for detailed information about specific features
- {@link guide/ Developer Guide} for AngularJS concepts
- {@link tutorial/ Tutorial} for getting started
4 changes: 4 additions & 0 deletions docs/content/error/injector/cdep.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $injector:cdep
@fullName Circular Dependency
@description
4 changes: 4 additions & 0 deletions docs/content/error/injector/itkn.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $injector:itkn
@fullName Bad Injection Token
@description
4 changes: 4 additions & 0 deletions docs/content/error/injector/modulerr.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $injector:modulerr
@fullName Module Error
@description
4 changes: 4 additions & 0 deletions docs/content/error/injector/nomod.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $injector:nomod
@fullName Module Unavailable
@description
4 changes: 4 additions & 0 deletions docs/content/error/injector/pget.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $injector:pget
@fullName Provider Missing $get
@description
4 changes: 4 additions & 0 deletions docs/content/error/injector/unpr.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $injector:unpr
@fullName Unknown Provider
@description
4 changes: 4 additions & 0 deletions docs/content/error/interpolate/interr.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $interpolate:interr
@fullName Interpolation Error
@description
4 changes: 4 additions & 0 deletions docs/content/error/interpolate/noconcat.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $interpolate:noconcat
@fullName Multiple Expressions
@description
4 changes: 4 additions & 0 deletions docs/content/error/jqLite/nosel.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name jqLite:nosel
@fullName Unsupported Selector Lookup
@description
4 changes: 4 additions & 0 deletions docs/content/error/jqLite/off_args.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name jqLite:off_args
@fullName Invalid jqLite#off() parameter
@description
4 changes: 4 additions & 0 deletions docs/content/error/jqLite/on_args.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name jqLite:on_args
@fullName Invalid jqLite#on() Parameters
@description
4 changes: 4 additions & 0 deletions docs/content/error/location/istart.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $location:istart
@fullName Invalid URL
@description
4 changes: 4 additions & 0 deletions docs/content/error/location/nohash.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $location:nohash
@fullName Missing Hash Prefix
@description
4 changes: 4 additions & 0 deletions docs/content/error/location/nopp.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $location:nopp
@fullName Missing Path Prefix
@description
4 changes: 4 additions & 0 deletions docs/content/error/ng/areq.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ng:areq
@fullName Bad Argument
@description
4 changes: 4 additions & 0 deletions docs/content/error/ng/cpi.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ng:cpi
@fullName Bad Copy
@description
4 changes: 4 additions & 0 deletions docs/content/error/ng/cpws.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ng:cpws
@fullName Copying Window or Scope
@description
4 changes: 4 additions & 0 deletions docs/content/error/ngModel/noass.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ngModel:noass
@fullName Non-Assignable Expression
@description
4 changes: 4 additions & 0 deletions docs/content/error/ngOptions/iexp.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ngOptions:iexp
@fullName Invalid Expression
@description
4 changes: 4 additions & 0 deletions docs/content/error/ngPattern/noregexp.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ngPattern:noregexp
@fullName Expected Regular Expression
@description
4 changes: 4 additions & 0 deletions docs/content/error/ngRepeat/dupes.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ngRepeat:dupes
@fullName Duplicate Repeater Key
@description
4 changes: 4 additions & 0 deletions docs/content/error/ngRepeat/iexp.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ngRepeat:iexp
@fullName Invalid Expression
@description
4 changes: 4 additions & 0 deletions docs/content/error/ngRepeat/iidexp.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ngRepeat:iidexp
@fullName Invalid Identifier
@description
4 changes: 4 additions & 0 deletions docs/content/error/ngResource/badargs.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ngResource:badargs
@fullName Too Many Arguments
@description
4 changes: 4 additions & 0 deletions docs/content/error/ngSanitize/badparse.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name ngSanitize:badparse
@fullName Parsing Error
@description
4 changes: 4 additions & 0 deletions docs/content/error/parse/isecfld.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $parse:isecfld
@fullName Referencing constructor Field
@description
4 changes: 4 additions & 0 deletions docs/content/error/parse/isecfn.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $parse:isecfn
@fullName Referencing Function Disallowed
@description
4 changes: 4 additions & 0 deletions docs/content/error/parse/lexerr.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $parse:lexerr
@fullName Lexer Error
@description
4 changes: 4 additions & 0 deletions docs/content/error/parse/syntax.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $parse:syntax
@fullName Syntax Error
@description
4 changes: 4 additions & 0 deletions docs/content/error/parse/ueoe.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $parse:ueoe
@fullName Unexpected End of Expression
@description
4 changes: 4 additions & 0 deletions docs/content/error/rootScope/infdig.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $rootScope:infdig
@fullName Infinite $digest Loop
@description
4 changes: 4 additions & 0 deletions docs/content/error/rootScope/inprog.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ngdoc error
@name $rootScope:inprog
@fullName Action Already In Progress
@description
30 changes: 28 additions & 2 deletions docs/src/gen-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ var reader = require('./reader.js'),
writer = require('./writer.js'),
SiteMap = require('./SiteMap.js').SiteMap,
appCache = require('./appCache.js').appCache,
Q = require('qq');
Q = require('qq'),
errorsJson = require('../../build/errors.json').errors;

var start = now();
var docs;
Expand All @@ -22,10 +23,35 @@ writer.makeDir('build/docs/', true).then(function() {
}).then(function generateHtmlDocPartials(docs_) {
docs = docs_;
ngdoc.merge(docs);
var fileFutures = [];
var fileFutures = [], namespace;

var isErrorDocPresent = function (search) {
return docs.some(function (doc) {
return doc.ngdoc === 'error' && doc.name === search;
});
};

// Check that each generated error code has a doc file.
Object.keys(errorsJson).forEach(function (prop) {
if (typeof errorsJson[prop] === 'object') {
namespace = errorsJson[prop];
Object.keys(namespace).forEach(function (code) {
var search = prop + ':' + code;
if (!isErrorDocPresent(search)) {
throw new Error('Missing ngdoc file for error code: ' + search);
}
});
} else {
if (!isErrorDocPresent(prop)) {
throw new Error('Missing ngdoc file for error code: ' + prop);
}
}
});

docs.forEach(function(doc){
// this hack is here because on OSX angular.module and angular.Module map to the same file.
var id = doc.id.replace('angular.Module', 'angular.IModule');

fileFutures.push(writer.output('partials/' + doc.section + '/' + id + '.html', doc.html()));
});

Expand Down
Loading

0 comments on commit 4a7b6a4

Please sign in to comment.