2016-06-01 24 views
3

我正在使用yiisoft/yii2-apidoc(#0.2.4)構建用yii2編寫的項目的文檔。我已經構建了一個shell腳本來發布文檔,並且當我僅包含項目文件和通過作曲程序引入的自己的cms代碼庫時,它工作正常。Yii2 apidoc不會讓我將我的項目和yii框架添加到相同的文檔中。

下面的代碼

#!/bin/sh 

VENDOR="../vendor" 

# remove existing docs 
rm -rf ./frontend/web/docs 

# create new docs, by drawing in all prroject code and TiCMS code. exclude the docs themselves. 
$VENDOR/yiisoft/yii2-apidoc/apidoc api ./,$VENDOR/toruinteractive/ti-cms ./frontend/web/docs --interactive=0 --exclude="./frontend/web/docs" 

所以這產生具有列出的所有我的代碼文件...

docs generated showing my classes

但問題是當我補充Yii框架 - 我需要爲了顯示我的代碼繼承的方法和參數。因此,與添加的yii2 framwork新的代碼是...

#!/bin/sh 

VENDOR="../vendor" 

# remove existing docs - this is needed as it sometimes doesn't exclude the docs folder and the output then gets cached. 
rm -rf ./frontend/web/docs 

# create new docs, by drawing in all prroject code and TiCMS code. exclude the docs themselves. 
$VENDOR/yiisoft/yii2-apidoc/apidoc api ./,$VENDOR/toruinteractive/ti-cms,$VENDOR/yiisoft/yii2 ./frontend/web/docs --interactive=0 --exclude="./frontend/web/docs" 

這將生成ONLY列出的yii2代碼文件 - 我所有的類都走了(見下圖)。我看不出我在這裏做錯了什麼,任何人都可以幫忙?

when you add yii2 into the mix you only see their classes

+0

它應該可能在版本2.1.1。請參閱:https://github.com/yiisoft/yii2-apidoc/milestone/9 –

回答

0

您在yiisoft/yii2 #7789和爲Yii developer replied描述遇到同樣的問題,apidoc命令現在是Yii框架文檔。

如果您仍想使用它,您必須排除Yii框架所在的目錄。假設這是./vendor/yiisoft,那麼排除選項將

--exclude="./frontend/web/docs,./vendor/yiisoft" 

通過檢查BaseController.phpApiController.php,你可以看到,如果排除選項未提供整個vendortests目錄僅被忽略。由於您提供了排除選項,因此不使用默認排除。

如果你想知道爲什麼包括vendor/yiisoft目錄會導致這個問題,你需要研究apidoc擴展的細節,特別是你的案例中的bootstrap template

相關問題