Skip to content

Commit 35a4d07

Browse files
committed
preparing to try to produce some docs
1 parent 0aecf7e commit 35a4d07

12 files changed

+259
-140
lines changed

bit-docs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var processJavaScript = require("./process/javascript");
33
module.exports = function(bitDocs){
44
// register your tags
55
bitDocs.register("tags", tags);
6-
bitDocs.register("process", processJavaScript);
6+
bitDocs.register("processor", processJavaScript);
77

88
var dependencies = {},
99
pack = require("./package.json");

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
"description": "tags and templates for JS apps",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "mocha test.js --reporter spec",
8+
"postversion": "git push --tags && git push",
9+
"preversion": "npm test",
10+
"release:pre": "npm version prerelease && npm publish",
11+
"release:patch": "npm version patch && npm publish",
12+
"release:minor": "npm version minor && npm publish",
13+
"release:major": "npm version major && npm publish"
814
},
915
"repository": {
1016
"type": "git",

tags/function_test.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ var func = require("./function"),
22
option = require("./option"),
33
assert = require("assert");
44

5-
6-
describe("documentjs/lib/tags/function",function(){
7-
5+
6+
describe("bit-docs-js/tags/function",function(){
7+
88
it("basic add",function(){
9-
9+
1010
var obj = {};
1111
var docMap = {Foo: {name: "Foo", type: "constructor"}}
1212
func.add.call(obj,"@function bar title",null,docMap.Foo, docMap );
13-
13+
1414
assert.deepEqual(obj,{
1515
name: "Foo.bar",
1616
type: "function",
1717
title: "title",
1818
parent: "Foo"
1919
});
20-
20+
2121
});
22-
22+
2323
it("codeMatch", function(){
2424
assert.ok(func.codeMatch.test("Thing = function(){}"));
2525
assert.ok(func.codeMatch.test("Thing: function(){}"));
2626
assert.ok(!func.codeMatch.test("foo: bar"))
2727
});
28-
28+
2929
it("code",function(){
30-
30+
3131
assert.deepEqual(func.code("method: function(arg1, arg2){"),{
3232
name: "method",
3333
params: [
@@ -36,13 +36,13 @@ describe("documentjs/lib/tags/function",function(){
3636
],
3737
type: "function"
3838
});
39-
39+
4040
});
41-
41+
4242
it("code with scope",function(){
43-
43+
4444
var docMap = {Foo: {name: "Foo", type: "constructor"}};
45-
45+
4646
assert.deepEqual(func.code("method: function(arg1, arg2){", docMap.Foo, docMap),{
4747
name: "Foo.method",
4848
params: [
@@ -52,11 +52,11 @@ describe("documentjs/lib/tags/function",function(){
5252
type: "function",
5353
parent: "Foo"
5454
});
55-
55+
5656
});
57-
57+
5858
it("variable set to function before terinary", function(){
59-
59+
6060
var res = func.code("var keys = !nativeKeys ? shimKeys : function(object) {");
6161
assert.deepEqual(res, {
6262
name: "keys",
@@ -65,8 +65,8 @@ describe("documentjs/lib/tags/function",function(){
6565
],
6666
type: "function"
6767
});
68-
68+
6969
});
7070

71-
71+
7272
});

tags/module_test.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,42 @@ var mod = require('./module'),
33
option = require("./option"),
44
returns = require("./return"),
55
assert = require("assert");
6-
7-
8-
describe("documentjs/lib/tags/module", function(){
9-
6+
7+
8+
describe("bit-docs-js/tags/module", function(){
9+
1010
it("basic",function(){
11-
11+
1212
var obj = {};
1313
var docMap = {Foo: {name: "Foo", type: "constructor"}}
1414
mod.add.call(obj,"@module {{}} name title",null,docMap.Foo, docMap );
15-
15+
1616
assert.deepEqual(obj,{
1717
name: "name",
1818
title: "title",
1919
type: "module",
2020
types: [{type: "Object", options: []}]
2121
})
22-
22+
2323
})
24-
25-
24+
25+
2626
it("function module followed by params",function(){
27-
27+
2828
var obj = {};
2929
var docMap = {Foo: {name: "Foo", type: "constructor"}}
3030
mod.add.call(obj,"@module {function(String):Number} func(name) functionjunction",null,docMap.Foo, docMap );
3131
param.add.call(obj,"@param {String} name DESCRIPTION",null,docMap.Foo, docMap );
3232
returns.add.call(obj,"@return {Number} RET DESCRIPTION",null,docMap.Foo, docMap );
33-
33+
3434
delete obj._curParam;
3535
delete obj._curReturn;
3636
assert.deepEqual(obj,{
3737
name: "func",
3838
title: "functionjunction",
3939
type: "module",
4040
types: [{
41-
type: "function",
41+
type: "function",
4242
constructs: undefined,
4343
context: undefined,
4444
params:[{
@@ -54,15 +54,15 @@ describe("documentjs/lib/tags/module", function(){
5454
description: "RET DESCRIPTION",
5555
types: [
5656
{
57-
57+
5858
type: "Number"
59-
59+
6060
}
6161
]
6262
}
6363
}]
6464
});
65-
65+
6666
});
6767

6868
it("@option on a module with a template", function(){
@@ -88,7 +88,7 @@ describe("documentjs/lib/tags/module", function(){
8888
}]
8989
}]
9090
});
91-
92-
91+
92+
9393
});
9494
});

tags/option_test.js

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ var option = require('./option'),
33
property = require('./property'),
44
returns = require('./return'),
55
assert = require("assert");
6-
7-
describe("documentjs/lib/tags/option",function(){
8-
6+
7+
describe("bit-docs-js/tags/option",function(){
8+
99
it("@option",function(){
10-
10+
1111
var obj = {};
1212
param.add.call(obj,"@param {{name: String, foo}=} thing a description");
1313
option.add.call(obj, "@option name name description");
1414
option.add.call(obj, "@option {Bar} [foo=thing] foo description");
1515
option.add.call(obj, "@option {Extra} extra extra description");
16-
16+
1717
assert.deepEqual(obj.params[0],
1818
{
1919
name: "thing",
@@ -23,8 +23,8 @@ describe("documentjs/lib/tags/option",function(){
2323
options: [
2424
{types: [{type: "String"}], name: "name", description: "name description" },
2525
{
26-
types: [{type: "Bar"}],
27-
name: "foo",
26+
types: [{type: "Bar"}],
27+
name: "foo",
2828
description: "foo description",
2929
defaultValue: "thing",
3030
optional: true
@@ -33,17 +33,17 @@ describe("documentjs/lib/tags/option",function(){
3333
]
3434
}]
3535
});
36-
36+
3737
});
38-
38+
3939
it("@option on Object",function(){
40-
40+
4141
var obj = {};
4242
param.add.call(obj,"@param {Object} thing a description");
4343
option.add.call(obj, "@option {String} name name description");
4444
option.add.call(obj, "@option {Bar} [foo=thing] foo description");
4545
option.add.call(obj, "@option {Extra} extra extra description");
46-
46+
4747
assert.deepEqual(obj.params[0],
4848
{
4949
name: "thing",
@@ -53,8 +53,8 @@ describe("documentjs/lib/tags/option",function(){
5353
options: [
5454
{types: [{type: "String"}], name: "name", description: "name description" },
5555
{
56-
types: [{type: "Bar"}],
57-
name: "foo",
56+
types: [{type: "Bar"}],
57+
name: "foo",
5858
description: "foo description",
5959
defaultValue: "thing",
6060
optional: true
@@ -63,17 +63,17 @@ describe("documentjs/lib/tags/option",function(){
6363
]
6464
}]
6565
});
66-
66+
6767
});
68-
69-
68+
69+
7070
it("@option - for function",function(){
71-
71+
7272
var obj = {}
7373
param.add.call(obj,"@param {function(String,Bar)} thing(first,second) a description");
7474
option.add.call(obj, "@option first first description");
7575
option.add.call(obj, "@option second second description");
76-
76+
7777
assert.deepEqual(obj.params[0],
7878
{
7979
name: "thing",
@@ -85,24 +85,24 @@ describe("documentjs/lib/tags/option",function(){
8585
params: [
8686
{types: [{type: "String"}], name: "first", description: "first description" },
8787
{
88-
types: [{type: "Bar"}],
89-
name: "second",
88+
types: [{type: "Bar"}],
89+
name: "second",
9090
description: "second description",
9191
}
9292
],
9393
returns : {types: [{type: "undefined"}]}
9494
}]
9595
});
96-
96+
9797
});
98-
98+
9999
it("@option on a property", function(){
100-
100+
101101
var obj = {}
102102
property.add.call(obj,"@property {String|Thing} thing");
103103
option.add.call(obj, "@option {String} String description");
104104
option.add.call(obj, "@option {Thing} Thing description");
105-
105+
106106
assert.deepEqual(obj,
107107
{
108108
name: "thing",
@@ -116,17 +116,17 @@ describe("documentjs/lib/tags/option",function(){
116116
description: "Thing description"
117117
}]
118118
});
119-
119+
120120
});
121-
121+
122122
it("@option on a @return value", function(){
123-
123+
124124
var obj = {}
125125
returns.add.call(obj,"@return {Foo|Bar} ret description");
126126
option.add.call(obj, "@option {Foo} Foo description");
127127
option.add.call(obj, "@option {Bar} Bar description");
128-
129-
128+
129+
130130
assert.deepEqual(obj.returns,
131131
{
132132
description: "ret description",
@@ -141,10 +141,10 @@ describe("documentjs/lib/tags/option",function(){
141141
}
142142
]
143143
});
144-
145-
144+
145+
146146
});
147-
147+
148148
it("@property with @function option with @option on returns", function(){
149149
var obj = {};
150150
property.add.call(obj,"@property {String|function} thing");
@@ -160,18 +160,18 @@ describe("documentjs/lib/tags/option",function(){
160160
]);
161161

162162
});
163-
163+
164164
it("@option can add on a @param that is not an object (#72)", function(){
165165
var obj = {};
166166
param.add.call(obj,"@param {Something} thing a description");
167167
option.add.call(obj, "@option {Foo} foo foo description");
168-
168+
169169
assert.deepEqual(obj.params[0].types[0].options,
170170
[
171171
{name: "foo", types: [{type:"Foo"}], description: "foo description"}
172172
]);
173-
173+
174174
});
175-
176-
175+
176+
177177
});

0 commit comments

Comments
 (0)