顯示具有 tools - JavaScript 標籤的文章。 顯示所有文章
顯示具有 tools - JavaScript 標籤的文章。 顯示所有文章

2009年8月31日 星期一

ext-doc


解開後在sample目錄下有ext-doc.bat執行檔,以及sample code(sample.js)和configure檔(ext.xml)。可以將js檔加入ext.xml的source裡面,至於document的描述可以參考sample code或者extjs的source file。設定好ext.xml後,直接執行ext-doc.bat就可以產生結果啦,預設的輸出目錄是在output的目錄下。接著把output複製到web server就可以看結果啦。

下載 ext-doc-1.0.131

相關網址:
http://code.google.com/p/ext-doc/downloads/list
http://extjs.com/forum/showthread.php?t=55214
http://groups.google.com/group/ext-doc?pli=1
http://ext-doc.org/docs/



2009年7月8日 星期三

jsdoc-toolkit


jsdoc-toolkit算是google推薦的JavaScript document generator,您可以在 http://code.google.com/p/jsdoc-toolkit/downloads/list下載。
由於jsdoc-toolkit是用java寫的,所以請先安裝好java,Windows底下執行命令把"/"改成"\"就可以了,執行java -jar jsrun.jar app\run.js -a -t=templates\jsdoc mycode.js就可以產生mycode.js的文件檔了,這部分可以參考裡面的README.txt,預設會將document寫到out目錄中。
手邊剛好有extjs,所以直接拿ext-all-debug.js當測試,卻得到exception from uncaught JavaScript throw: java.lang.OutOfMemoryError: Java heap space的錯誤。這導因於heap不夠,可透過設定Xmx解決(請參考後面說明)。

執行java -jar jsrun.jar app/run.js --help 可以獲取更多資訊。
brook@debian:~/jsdoc_toolkit-2.3.0/$ java -Xmx1024m -Xms512m -jar jsrun.jar app/run.js -a -v -t=templates/jsdoc/ ext/adapter/ext/ext-base.js
  ... 省略  ...

brook@debian:~/jsdoc_toolkit-2.3.0/$ java -jar jsrun.jar app/run.js --help
USAGE: java -jar jsrun.jar app/run.js [OPTIONS]   ...

OPTIONS:
  -a or --allfunctions
          Include all functions, even undocumented ones.

  -c or --conf
          Load a configuration file.

  -d= or --directory=
          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= or --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= or --out=
          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= or --recurse=
          Descend into src directories.

  -s or --suppress
          Suppress source code output.

  -S or --securemodules
          Use Secure Modules mode to parse source code.

  -t= or --template=
          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]... or --ext=[,EXT]...
          Scan source files with the given extension/s (defaults to js).
out of memory.
看到java.lang.OutOfMemoryError就是要加大記憶體空間啦,java 程式有-Xms跟-Xmx參數可以用。
-Xms Setting minimum heap size
-Xmx Setting maximum heap size

心得:感覺jsdoc-toolkit還是很陽春,而且很耗記憶體和CPU,感覺很慢,常常讓人以為當機了。不知道哪邊有像ext-js的document一樣漂亮的工具。




熱門文章