Permalink
Browse files

Init

0 parents commit a2210841209715c744441d9b5a10f354d1125650 @rottmann rottmann committed Apr 20, 2013
Showing with 6,592 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +5 −0 .npmignore
  3. +5 −0 .travis.yml
  4. +88 −0 Gruntfile.js
  5. +22 −0 LICENSE.md
  6. +22 −0 README.md
  7. +126 −0 bin/apidoc
  8. +22 −0 example/API.md
  9. +136 −0 example/example.js
  10. +7 −0 example/package.json
  11. +323 −0 lib/apidoc.js
  12. +66 −0 lib/filter.js
  13. +341 −0 lib/parser.js
  14. +21 −0 lib/plugins/filter_api_error.js
  15. +21 −0 lib/plugins/filter_api_info.js
  16. +57 −0 lib/plugins/filter_api_param.js
  17. +21 −0 lib/plugins/filter_api_success.js
  18. +30 −0 lib/plugins/parser_api.js
  19. +32 −0 lib/plugins/parser_api_define_error_structure.js
  20. +43 −0 lib/plugins/parser_api_define_permission.js
  21. +23 −0 lib/plugins/parser_api_define_structure.js
  22. +23 −0 lib/plugins/parser_api_define_success_structure.js
  23. +23 −0 lib/plugins/parser_api_description.js
  24. +15 −0 lib/plugins/parser_api_error.js
  25. +15 −0 lib/plugins/parser_api_error_example.js
  26. +24 −0 lib/plugins/parser_api_error_structure.js
  27. +35 −0 lib/plugins/parser_api_example.js
  28. +23 −0 lib/plugins/parser_api_group.js
  29. +15 −0 lib/plugins/parser_api_info.js
  30. +15 −0 lib/plugins/parser_api_info_example.js
  31. +23 −0 lib/plugins/parser_api_name.js
  32. +92 −0 lib/plugins/parser_api_param.js
  33. +23 −0 lib/plugins/parser_api_permission.js
  34. +24 −0 lib/plugins/parser_api_structure.js
  35. +15 −0 lib/plugins/parser_api_success.js
  36. +15 −0 lib/plugins/parser_api_success_example.js
  37. +24 −0 lib/plugins/parser_api_success_structure.js
  38. +29 −0 lib/plugins/parser_api_version.js
  39. +33 −0 lib/plugins/worker_error_structure.js
  40. +170 −0 lib/plugins/worker_permission.js
  41. +172 −0 lib/plugins/worker_structure.js
  42. +33 −0 lib/plugins/worker_success_structure.js
  43. +50 −0 lib/utils/find_files.js
  44. +79 −0 lib/worker.js
  45. +40 −0 package.json
  46. +314 −0 template/api_data.js
  47. +10 −0 template/api_project.js
  48. +327 −0 template/css/style.css
  49. +213 −0 template/handlebars_helper.js
  50. BIN template/img/favicon.ico
  51. BIN template/img/glyphicons-halflings-white.png
  52. BIN template/img/glyphicons-halflings.png
  53. +430 −0 template/index.html
  54. +20 −0 template/locales/de.js
  55. +31 −0 template/locales/locale.js
  56. +501 −0 template/main.js
  57. +9 −0 template/vendor/bootstrap-responsive.min.css
  58. +9 −0 template/vendor/bootstrap.min.css
  59. +6 −0 template/vendor/bootstrap.min.js
  60. +49 −0 template/vendor/diff_match_patch.min.js
  61. +96 −0 template/vendor/handlebars.min.js
  62. +42 −0 template/vendor/lodash.min.js
  63. +101 −0 template/vendor/prettify.css
  64. +2 −0 template/vendor/prettify/lang-apollo.js
  65. +3 −0 template/vendor/prettify/lang-basic.js
  66. +18 −0 template/vendor/prettify/lang-clj.js
  67. +2 −0 template/vendor/prettify/lang-css.js
  68. +3 −0 template/vendor/prettify/lang-dart.js
  69. +2 −0 template/vendor/prettify/lang-erlang.js
  70. +1 −0 template/vendor/prettify/lang-go.js
  71. +2 −0 template/vendor/prettify/lang-hs.js
  72. +3 −0 template/vendor/prettify/lang-lisp.js
  73. +1 −0 template/vendor/prettify/lang-llvm.js
  74. +2 −0 template/vendor/prettify/lang-lua.js
  75. +6 −0 template/vendor/prettify/lang-matlab.js
  76. +2 −0 template/vendor/prettify/lang-ml.js
  77. +2 −0 template/vendor/prettify/lang-mumps.js
  78. +4 −0 template/vendor/prettify/lang-n.js
  79. +3 −0 template/vendor/prettify/lang-pascal.js
  80. +1 −0 template/vendor/prettify/lang-proto.js
  81. +2 −0 template/vendor/prettify/lang-r.js
  82. +1 −0 template/vendor/prettify/lang-rd.js
  83. +2 −0 template/vendor/prettify/lang-scala.js
  84. +2 −0 template/vendor/prettify/lang-sql.js
  85. +3 −0 template/vendor/prettify/lang-tcl.js
  86. +1 −0 template/vendor/prettify/lang-tex.js
  87. +2 −0 template/vendor/prettify/lang-vb.js
  88. +3 −0 template/vendor/prettify/lang-vhdl.js
  89. +2 −0 template/vendor/prettify/lang-wiki.js
  90. +3 −0 template/vendor/prettify/lang-xq.js
  91. +2 −0 template/vendor/prettify/lang-yaml.js
  92. +1 −0 template/vendor/prettify/prettify.css
  93. +30 −0 template/vendor/prettify/prettify.js
  94. +34 −0 template/vendor/prettify/run_prettify.js
  95. +1 −0 template/vendor/require-jquery.min.js
  96. +314 −0 template_basic/api_data.js
  97. +10 −0 template_basic/api_project.js
  98. +288 −0 template_basic/css/style.css
  99. +81 −0 template_basic/handlebars_helper.js
  100. BIN template_basic/img/favicon.ico
  101. BIN template_basic/img/glyphicons-halflings-white.png
  102. BIN template_basic/img/glyphicons-halflings.png
  103. +165 −0 template_basic/index.html
  104. +20 −0 template_basic/locales/de.js
  105. +31 −0 template_basic/locales/locale.js
  106. +309 −0 template_basic/main.js
  107. +9 −0 template_basic/vendor/bootstrap-responsive.min.css
  108. +9 −0 template_basic/vendor/bootstrap.min.css
  109. +6 −0 template_basic/vendor/bootstrap.min.js
  110. +96 −0 template_basic/vendor/handlebars.min.js
  111. +42 −0 template_basic/vendor/lodash.min.js
  112. +101 −0 template_basic/vendor/prettify.css
  113. +2 −0 template_basic/vendor/prettify/lang-apollo.js
  114. +3 −0 template_basic/vendor/prettify/lang-basic.js
  115. +18 −0 template_basic/vendor/prettify/lang-clj.js
  116. +2 −0 template_basic/vendor/prettify/lang-css.js
  117. +3 −0 template_basic/vendor/prettify/lang-dart.js
  118. +2 −0 template_basic/vendor/prettify/lang-erlang.js
  119. +1 −0 template_basic/vendor/prettify/lang-go.js
  120. +2 −0 template_basic/vendor/prettify/lang-hs.js
  121. +3 −0 template_basic/vendor/prettify/lang-lisp.js
  122. +1 −0 template_basic/vendor/prettify/lang-llvm.js
  123. +2 −0 template_basic/vendor/prettify/lang-lua.js
  124. +6 −0 template_basic/vendor/prettify/lang-matlab.js
  125. +2 −0 template_basic/vendor/prettify/lang-ml.js
  126. +2 −0 template_basic/vendor/prettify/lang-mumps.js
  127. +4 −0 template_basic/vendor/prettify/lang-n.js
  128. +3 −0 template_basic/vendor/prettify/lang-pascal.js
  129. +1 −0 template_basic/vendor/prettify/lang-proto.js
  130. +2 −0 template_basic/vendor/prettify/lang-r.js
  131. +1 −0 template_basic/vendor/prettify/lang-rd.js
  132. +2 −0 template_basic/vendor/prettify/lang-scala.js
  133. +2 −0 template_basic/vendor/prettify/lang-sql.js
  134. +3 −0 template_basic/vendor/prettify/lang-tcl.js
  135. +1 −0 template_basic/vendor/prettify/lang-tex.js
  136. +2 −0 template_basic/vendor/prettify/lang-vb.js
  137. +3 −0 template_basic/vendor/prettify/lang-vhdl.js
  138. +2 −0 template_basic/vendor/prettify/lang-wiki.js
  139. +3 −0 template_basic/vendor/prettify/lang-xq.js
  140. +2 −0 template_basic/vendor/prettify/lang-yaml.js
  141. +1 −0 template_basic/vendor/prettify/prettify.css
  142. +30 −0 template_basic/vendor/prettify/prettify.js
  143. +34 −0 template_basic/vendor/prettify/run_prettify.js
  144. +1 −0 template_basic/vendor/require-jquery.min.js
  145. +74 −0 test/apidoc_test.js
  146. +40 −0 test/fixtures/api_data.js
  147. +40 −0 test/fixtures/api_data.json
  148. +10 −0 test/fixtures/api_project.js
  149. +10 −0 test/fixtures/api_project.json
  150. +35 −0 test/fixtures/example/example.js
  151. +13 −0 test/fixtures/index.html
  152. +13 −0 test/template/index.html
@@ -0,0 +1,5 @@
+.settings/
+.project
+node_modules/
+tmp/
+doc/
@@ -0,0 +1,5 @@
+.settings/
+.project
+node_modules/
+tmp/
+doc/
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - 0.8
+before_script:
+ - npm install -g grunt-cli
@@ -0,0 +1,88 @@
+/*
+ * apidoc
+ * http://apidocjs.com
+ *
+ * Copyright (c) 2013 inveris OHG
+ * Author Peter Rottmann <rottmann@inveris.de>
+ * 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"]);
+};
@@ -0,0 +1,22 @@
+Copyright (c) 2013 inveris OHG
+Author Peter Rottmann <rottmann@inveris.de>
+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.
@@ -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 <rottmann@inveris.de>
+Licensed under the MIT license.
@@ -0,0 +1,126 @@
+#!/usr/bin/env node
+
+"use strict";
+
+/*
+ * apidoc
+ * http://apidocjs.com
+ *
+ * Copyright (c) 2013 inveris OHG
+ * Author Peter Rottmann <rottmann@inveris.de>
+ * 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);
@@ -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"
+ }
Oops, something went wrong.

0 comments on commit a221084

Please sign in to comment.