在前面的博文中探讨自动化工程问题时,写过基于NodeJS的,使用gulp、grunt的jsdoc插件实现文档自动化。本文探讨基于java环境的自动化实现。

一、Java安装与环境配置

关于Java的安装与环境配置,可以参考博文YUI Compressor for Sublime text2

二、jsdoc-tookit下载与使用

下载链接:jsdoc-tookit,现在地址可能被墙了,可以通过搜索其它渠道下载。下面完成后,解压到工作目录即可。

-> cmd -> 命令行窗口

-> cd到jsdoc-toolkit所在目录(我的是G:\Workspace\jsdoc-toolkit)

-> windows:java -jar jsrun.jar app\run.js -a -t=templates\jsdoc myTest/myTest.js

Linux:$ java -jar jsrun.jar app/run.js -a -t=templates/jsdoc myTest/myTest.js

-> 运行后生成out(默认)目录

-> 完成自动化API文档。

当然myTest.js文件中的注释需要符合jsDoc规范。 如果我们不想使用默认目录out,可以通过-d命令来设置。

jsdoc-toolkit相关命令参考:

G:\Workspace\jsdoc-toolkit>java -jar jsrun.jar app\run.js --help
USAGE: java -jar jsrun.jar app/run.js [OPTIONS] <SRC_DIR> <SRC_FILE> ... OPTIONS:
-a or --allfunctions
Include all functions, even undocumented ones. -c or --conf
Load a configuration file. -d=<PATH> or --directory=<PATH>
Output to this directory (defaults to "out"). -D="myVar:My value" or --define="myVar:My value"
Multiple. Define a variable, available in JsDoc as JSDOC.opt.D.myVar. -e=<ENCODING> or --encoding=<ENCODING>
Use this encoding to read and write files. -E="REGEX" or --exclude="REGEX"
Multiple. Exclude files based on the supplied regex. -h or --help
Show this message and exit. -n or --nocode
Ignore all code, only document comments with @name tags. -o=<PATH> or --out=<PATH>
Print log messages to a file (defaults to stdout). -p or --private
Include symbols tagged as private, underscored and inner symbols. -q or --quiet
Do not output any messages, not even warnings. -r=<DEPTH> or --recurse=<DEPTH>
Descend into src directories. -s or --suppress
Suppress source code output. -S or --securemodules
Use Secure Modules mode to parse source code. -t=<PATH> or --template=<PATH>
Required. Use this template to format the output. -T or --test
Run all unit tests and exit. -u or --unique
Force file names to be unique, but not based on symbol names. -v or --verbose
Provide verbose feedback about what is happening. -x=<EXT>[,EXT]... or --ext=<EXT>[,EXT]...
Scan source files with the given extension/s (defaults to js).

转载声明:

本文标题:使用jsdoc-toolkit实现JS API文档自动化

本文链接:http://www.zuojj.com/archives/1064.html,转载请注明转自Benjamin-专注前端开发和用户体验

最新文章

  1. Harmonic Number(调和级数+欧拉常数)
  2. JVM 垃圾回收器工作原理及使用实例介绍(转载自IBM),直接复制粘贴,需要原文戳链接
  3. DuiLib 自定义识别控件
  4. 去除Input输入框中边框的方式
  5. ember.js:使用笔记6 子项目的前进与后退
  6. mysql基础知识(5)--视图
  7. 【PAT】1029. Median (25)
  8. [收藏转贴]struct探索&#183;extern &quot;C&quot;含义探索 &#183;C++与C的混合编程&#183;C 语言高效编程的几招
  9. ios5和ios6横竖屏支持及ipad和iphone设备的判断
  10. AJAX POST请求中參数以form data和request payload形式在servlet中的获取方式
  11. 为PO手写添加配置文件(hbm.xml)
  12. Vue-cli搭建完项目,各文件解释
  13. nginx平滑升级(1.14--1.15)
  14. Win10 教育版
  15. UnzipUtil
  16. SpringBoot之Swagger2
  17. 串口接收端verilog代码分析
  18. C# 如何防止重放攻击
  19. 20155207 《网络对抗技术》EXP3 免杀原理与实践
  20. JavaBean递归拷贝工具类Dozer

热门文章

  1. step2-------使用myeclipse创建maven java web项目
  2. 解决:HttpClient导致应用出现过多Close_Wait的问题
  3. LeetCode OJ 331. Verify Preorder Serialization of a Binary Tree
  4. Select查询语句2
  5. [题解]hdu 1009 FatMouse&#39; Trade(贪心基础题)
  6. java多线程详解(6)-线程间的通信wait及notify方法
  7. memcache与memcached介绍及安装配置
  8. android中如何发送及接收数据(两种方法)?
  9. java面试
  10. android4.3 Bluetooth(le)分析之startLeScan分析