Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
rottmann committed Apr 20, 2013
0 parents commit a221084
Show file tree
Hide file tree
Showing 152 changed files with 6,592 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.settings/
.project
node_modules/
tmp/
doc/
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.settings/
.project
node_modules/
tmp/
doc/
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- 0.8
before_script:
- npm install -g grunt-cli
88 changes: 88 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* apidoc
* http://apidocjs.com
*
* Copyright (c) 2013 inveris OHG
* Author Peter Rottmann <[email protected]>
* Licensed under the MIT license.
*/

"use strict";

module.exports = function(grunt)
{
/* --------------------------------------------------------------------------------
* Configuration.
* -------------------------------------------------------------------------------- */
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),

// clear temporary dir.
clean: {
test: ["tmp"]
}, // clean

jshint: {
all: ["Gruntfile.js", "lib/**/*.js", "test/**/*.js"],
options: {
// Enforcing Options
bitwise: true,
camelcase: true,
curly: false,
eqeqeq: true,
forin: true,
immed: true,
latedef: false,
newcap: true,
noarg: true,
noempty: true,
nonew: true,
plusplus: true,
quotmark: "double",
regexp: false,
undef: false,
unused: false,
shadow: true,
strict: false,
trailing: true,
maxlen: 160,
// Relaxing Options
boss: true,
eqnull: true,
smarttabs: true,
sub: true,
// Environments
browser: false,
passfail: false,
node: true
}
}, // jshint

simplemocha: {
options: {
globals: ["should"],
timeout: 2000,
ignoreLeaks: false,
ui: "bdd",
reporter: "spec"
},
all: { src: ["test/apidoc_test.js"] }
} // simplemocha
}); // grunt.initConfig

/* --------------------------------------------------------------------------------
* Modules.
* -------------------------------------------------------------------------------- */
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-simple-mocha");

/* --------------------------------------------------------------------------------
* Tasks.
* -------------------------------------------------------------------------------- */
// Task: default
grunt.registerTask("default", ["jshint"]);

// Task: test
grunt.registerTask("test", ["clean", "simplemocha"]);
};
22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2013 inveris OHG
Author Peter Rottmann <[email protected]>
Licensed under the MIT license.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# apiDoc

## About
Generates a RESTful web API Documentation.

Docs and examples at [apidocjs.com](http://apidocjs.com).

## Installation
`npm install apidoc -g`

## Example
`apidoc -i example/ -o doc/`
Creates from input files a documentation in path `doc/`.

## Changelog

* `0.1.5` Official release

## License
Copyright (c) 2013 inveris OHG
Author Peter Rottmann <[email protected]>
Licensed under the MIT license.
126 changes: 126 additions & 0 deletions bin/apidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#!/usr/bin/env node

"use strict";

/*
* apidoc
* http://apidocjs.com
*
* Copyright (c) 2013 inveris OHG
* Author Peter Rottmann <[email protected]>
* Licensed under the MIT license.
*/

var path = require("path");
var optimist = require("optimist");

var argv = optimist
.usage("Usage: $0 [options]")

.option("f", {
alias: "file-filters",
"default": ".*\\.js$",
describe: "RegEx-Filter to select files that should be parsed (many -f can be used)."
})

.option("i", {
alias: "input",
"default": "./",
describe: "Input / source dirname."
})

.option("o", {
alias: "output",
"default": "./doc/",
describe: "Output dirname."
})

.option("t", {
alias: "template",
"default": path.join(__dirname, "../template/"),
describe: "Use template for output files."
})

.option("v", {
alias: "verbose",
boolean: true,
"default": true,
describe: "Verbose debug output."
})

.option("h", {
alias: "help",
boolean: true,
describe: "Show this help information."
})

.option("parse-filters", {
describe: "Optional user defined filters. Format name=filename"
})

.option("parse-parsers", {
describe: "Optional user defined parsers. Format name=filename"
})

.option("parse-workers", {
describe: "Optional user defined workers. Format name=filename"
})

.option("silent", {
boolean: true,
"default": false,
describe: "Turn verbose information off."
})

.option("simulate", {
boolean: true,
"default": false,
describe: "Execute but not write any file."
})

.argv
;

if(argv.help)
{
optimist.showHelp();
process.exit(0);
}

/**
* Transform Parameters to Objectlist.
*
* @param {String[]} filters
* @returns {Object}
*/
function transformFilters(filters)
{
if( ! filters) return undefined;
if(typeof(filters) === "string") filters = [ filters ];
var retFilters = [];
filters.forEach(function(filter) {
var splits = filter.split("=");
if(splits.length === 2)
{
var obj = {};
obj[splits[0]] = splits[1];
retFilters.push(obj);
}
});
return retFilters;
} // transformFilters

var defaults = {
includeFilters: argv["file-filters"],
src: argv["input"],
dest: argv["output"],
template: argv["template"],
debug: (argv["silent"]) ? false : argv["verbose"],
log: (argv["silent"]) ? false: true,
filters: transformFilters(argv["parse-filters"]),
parsers: transformFilters(argv["parse-parsers"]),
workers: transformFilters(argv["parse-workers"]),
simulate: argv["simulate"]
};

require("../lib/apidoc")(defaults);
22 changes: 22 additions & 0 deletions example/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Example text from API.md

## General

This Text is optionally and not needed to create the documentation.


## HowTo include

This text is from file "API.md".

In your projects "package.json" you can set "apidoc" with a description text or "apidocFilename" with the filename to include into your documentation.

This example attempts to integrate "API.md". If not available, then the "apidoc" string is used.

{
"name": "example",
"version": "0.3.0",
"description": "apidoc example project.",
"apidoc": "This is a description, it will be ignored if parameter apidocFilename exist.",
"apidocFilename": "API.md"
}
Loading

0 comments on commit a221084

Please sign in to comment.