Skip to content

Commit a221084

Browse files
committed
Init
0 parents  commit a221084

File tree

152 files changed

+6592
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+6592
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.settings/
2+
.project
3+
node_modules/
4+
tmp/
5+
doc/

.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.settings/
2+
.project
3+
node_modules/
4+
tmp/
5+
doc/

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- 0.8
4+
before_script:
5+
- npm install -g grunt-cli

Gruntfile.js

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
* apidoc
3+
* http://apidocjs.com
4+
*
5+
* Copyright (c) 2013 inveris OHG
6+
* Author Peter Rottmann <[email protected]>
7+
* Licensed under the MIT license.
8+
*/
9+
10+
"use strict";
11+
12+
module.exports = function(grunt)
13+
{
14+
/* --------------------------------------------------------------------------------
15+
* Configuration.
16+
* -------------------------------------------------------------------------------- */
17+
grunt.initConfig({
18+
pkg: grunt.file.readJSON("package.json"),
19+
20+
// clear temporary dir.
21+
clean: {
22+
test: ["tmp"]
23+
}, // clean
24+
25+
jshint: {
26+
all: ["Gruntfile.js", "lib/**/*.js", "test/**/*.js"],
27+
options: {
28+
// Enforcing Options
29+
bitwise: true,
30+
camelcase: true,
31+
curly: false,
32+
eqeqeq: true,
33+
forin: true,
34+
immed: true,
35+
latedef: false,
36+
newcap: true,
37+
noarg: true,
38+
noempty: true,
39+
nonew: true,
40+
plusplus: true,
41+
quotmark: "double",
42+
regexp: false,
43+
undef: false,
44+
unused: false,
45+
shadow: true,
46+
strict: false,
47+
trailing: true,
48+
maxlen: 160,
49+
// Relaxing Options
50+
boss: true,
51+
eqnull: true,
52+
smarttabs: true,
53+
sub: true,
54+
// Environments
55+
browser: false,
56+
passfail: false,
57+
node: true
58+
}
59+
}, // jshint
60+
61+
simplemocha: {
62+
options: {
63+
globals: ["should"],
64+
timeout: 2000,
65+
ignoreLeaks: false,
66+
ui: "bdd",
67+
reporter: "spec"
68+
},
69+
all: { src: ["test/apidoc_test.js"] }
70+
} // simplemocha
71+
}); // grunt.initConfig
72+
73+
/* --------------------------------------------------------------------------------
74+
* Modules.
75+
* -------------------------------------------------------------------------------- */
76+
grunt.loadNpmTasks("grunt-contrib-clean");
77+
grunt.loadNpmTasks("grunt-contrib-jshint");
78+
grunt.loadNpmTasks("grunt-simple-mocha");
79+
80+
/* --------------------------------------------------------------------------------
81+
* Tasks.
82+
* -------------------------------------------------------------------------------- */
83+
// Task: default
84+
grunt.registerTask("default", ["jshint"]);
85+
86+
// Task: test
87+
grunt.registerTask("test", ["clean", "simplemocha"]);
88+
};

LICENSE.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2013 inveris OHG
2+
Author Peter Rottmann <[email protected]>
3+
Licensed under the MIT license.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# apiDoc
2+
3+
## About
4+
Generates a RESTful web API Documentation.
5+
6+
Docs and examples at [apidocjs.com](http://apidocjs.com).
7+
8+
## Installation
9+
`npm install apidoc -g`
10+
11+
## Example
12+
`apidoc -i example/ -o doc/`
13+
Creates from input files a documentation in path `doc/`.
14+
15+
## Changelog
16+
17+
* `0.1.5` Official release
18+
19+
## License
20+
Copyright (c) 2013 inveris OHG
21+
Author Peter Rottmann <[email protected]>
22+
Licensed under the MIT license.

bin/apidoc

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#!/usr/bin/env node
2+
3+
"use strict";
4+
5+
/*
6+
* apidoc
7+
* http://apidocjs.com
8+
*
9+
* Copyright (c) 2013 inveris OHG
10+
* Author Peter Rottmann <[email protected]>
11+
* Licensed under the MIT license.
12+
*/
13+
14+
var path = require("path");
15+
var optimist = require("optimist");
16+
17+
var argv = optimist
18+
.usage("Usage: $0 [options]")
19+
20+
.option("f", {
21+
alias: "file-filters",
22+
"default": ".*\\.js$",
23+
describe: "RegEx-Filter to select files that should be parsed (many -f can be used)."
24+
})
25+
26+
.option("i", {
27+
alias: "input",
28+
"default": "./",
29+
describe: "Input / source dirname."
30+
})
31+
32+
.option("o", {
33+
alias: "output",
34+
"default": "./doc/",
35+
describe: "Output dirname."
36+
})
37+
38+
.option("t", {
39+
alias: "template",
40+
"default": path.join(__dirname, "../template/"),
41+
describe: "Use template for output files."
42+
})
43+
44+
.option("v", {
45+
alias: "verbose",
46+
boolean: true,
47+
"default": true,
48+
describe: "Verbose debug output."
49+
})
50+
51+
.option("h", {
52+
alias: "help",
53+
boolean: true,
54+
describe: "Show this help information."
55+
})
56+
57+
.option("parse-filters", {
58+
describe: "Optional user defined filters. Format name=filename"
59+
})
60+
61+
.option("parse-parsers", {
62+
describe: "Optional user defined parsers. Format name=filename"
63+
})
64+
65+
.option("parse-workers", {
66+
describe: "Optional user defined workers. Format name=filename"
67+
})
68+
69+
.option("silent", {
70+
boolean: true,
71+
"default": false,
72+
describe: "Turn verbose information off."
73+
})
74+
75+
.option("simulate", {
76+
boolean: true,
77+
"default": false,
78+
describe: "Execute but not write any file."
79+
})
80+
81+
.argv
82+
;
83+
84+
if(argv.help)
85+
{
86+
optimist.showHelp();
87+
process.exit(0);
88+
}
89+
90+
/**
91+
* Transform Parameters to Objectlist.
92+
*
93+
* @param {String[]} filters
94+
* @returns {Object}
95+
*/
96+
function transformFilters(filters)
97+
{
98+
if( ! filters) return undefined;
99+
if(typeof(filters) === "string") filters = [ filters ];
100+
var retFilters = [];
101+
filters.forEach(function(filter) {
102+
var splits = filter.split("=");
103+
if(splits.length === 2)
104+
{
105+
var obj = {};
106+
obj[splits[0]] = splits[1];
107+
retFilters.push(obj);
108+
}
109+
});
110+
return retFilters;
111+
} // transformFilters
112+
113+
var defaults = {
114+
includeFilters: argv["file-filters"],
115+
src: argv["input"],
116+
dest: argv["output"],
117+
template: argv["template"],
118+
debug: (argv["silent"]) ? false : argv["verbose"],
119+
log: (argv["silent"]) ? false: true,
120+
filters: transformFilters(argv["parse-filters"]),
121+
parsers: transformFilters(argv["parse-parsers"]),
122+
workers: transformFilters(argv["parse-workers"]),
123+
simulate: argv["simulate"]
124+
};
125+
126+
require("../lib/apidoc")(defaults);

example/API.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Example text from API.md
2+
3+
## General
4+
5+
This Text is optionally and not needed to create the documentation.
6+
7+
8+
## HowTo include
9+
10+
This text is from file "API.md".
11+
12+
In your projects "package.json" you can set "apidoc" with a description text or "apidocFilename" with the filename to include into your documentation.
13+
14+
This example attempts to integrate "API.md". If not available, then the "apidoc" string is used.
15+
16+
{
17+
"name": "example",
18+
"version": "0.3.0",
19+
"description": "apidoc example project.",
20+
"apidoc": "This is a description, it will be ignored if parameter apidocFilename exist.",
21+
"apidocFilename": "API.md"
22+
}

0 commit comments

Comments
 (0)