背景
文檔的重要性不言而喻,對於像Javascript這種的動態語言來說就更重要了,目前流行的JDoc工具挺多的,最好的當屬JSDuck,可是JSDuck在Windows下的安裝非常麻煩,這里就寫下來做個備忘。
JSDuck生成的文檔效果

JSDuck安裝步驟
第一步:安裝Ruby
Ruby下載地址:http://rubyinstaller.org/downloads/。
我是64位操作系統,下載的文件如下:

第二步:安裝Development Kit
1、將DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe解壓到指定目錄,下圖是我解壓后的位置:

2、使用批處理程序生成config.yml,下面是使用的批處理程序:
1 cd /d D:\Ruby200-x64\dev 2 ruby dk.rb init
3、修改config.yml的內容:
1 # This configuration file contains the absolute path locations of all 2 # installed Rubies to be enhanced to work with the DevKit. This config 3 # file is generated by the 'ruby dk.rb init' step and may be modified 4 # before running the 'ruby dk.rb install' step. To include any installed 5 # Rubies that were not automagically discovered, simply add a line below 6 # the triple hyphens with the absolute path to the Ruby root directory. 7 # 8 # Example: 9 # 10 # --- 11 # - C:/ruby19trunk 12 # - C:/ruby192dev 13 # 14 --- 15 - D:\Ruby200-x64
4、使用批處理執行安裝,下面是使用的批處理程序:
1 cd /d D:\Ruby200-x64\dev 2 ruby dk.rb install
第三步:安裝rdiscount
執行如下批處理程序:
1 gem install rdiscount
第四步:安裝jsduck
執行如下批處理程序:
1 gem install jsduck
JSDuck教程
官方永遠是最好的學習地方:https://github.com/senchalabs/jsduck/wiki。
備注
寫文檔是個好習慣,當然我也相信好代碼是最好的文檔。
