[Ubuntu] Yii API manual for Vim

I found a good plugin for vim, that is Yii API manual for Vim, which you can check 

the api in vim!

here is the website: https://github.com/vim-scripts/Yii-API-manual-for-Vim

 

But that, why i write this article is that, when i Creatting custom version follows:

git clone https://github.com/yiisoft/yii.git /media/My_Documents/htdocs/yii
cd /media/My_Documents/htdocs/yii/build

export YII_CONSOLE_COMMANDS=/path/to/yii-api-vim/yii_commands/
./build vimapi /media/My_Documents/htdocs/yii/docs

I got these errors: 

Building.. : Yii Framework Class Reference for vim
Version... : 1.1.14-dev
Source URL : http://code.google.com/p/yii/source/browse/trunk/framework

Building model...
PHP Error[2]: require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory
    in file /media/My_Documents/htdocs/yii/framework/test/CTestCase.php at line 11
#0 /media/My_Documents/htdocs/yii/framework/test/CTestCase.php(11): require_once()
#1 /media/My_Documents/htdocs/yii/framework/YiiBase.php(395): include()
#2 unknown(0): autoload()
#3 /media/My_Documents/htdocs/yii/framework/test/CDbTestCase.php(41): spl_autoload_call()
#4 /media/My_Documents/htdocs/yii/build/commands/api/ApiModel.php(35): require_once()
#5 /media/My_Documents/htdocs/yii/build/commands/api/ApiModel.php(26): ApiModel->findClasses()
#6 /home/davidhhuan/.vim/bundle/Yii-API-manual-for-Vim/yii_commands/VimApiCommand.php(139): ApiModel->build()
#7 /home/davidhhuan/.vim/bundle/Yii-API-manual-for-Vim/yii_commands/VimApiCommand.php(126): VimApiCommand->buildModel()
#8 /media/My_Documents/htdocs/yii/framework/console/CConsoleCommandRunner.php(67): VimApiCommand->run()
#9 /media/My_Documents/htdocs/yii/framework/console/CConsoleApplication.php(91): CConsoleCommandRunner->run()
#10 /media/My_Documents/htdocs/yii/framework/base/CApplication.php(169): CConsoleApplication->processRequest()
#11 /media/My_Documents/htdocs/yii/framework/yiic.php(33): CConsoleApplication->run()
#12 /media/My_Documents/htdocs/yii/build/build(17): require_once()
davidhhuan@davidhhuan-ThinkPad-T410:/media/My_Documents/htdocs/yii/build$ pear install phpunit/PHPUnit
Attempting to discover channel "phpunit"...
downloading channel.xml ...
Starting to download channel.xml (1 bytes)
....done: 1 bytes
unknown channel "phpunit" in "phpunit/PHPUnit"
invalid package name/package file "phpunit/PHPUnit"
install failed

My system is Ubuntu 12.04

 

that means i have NOT installed the PHPUnit, then i install the PHPUnit

sudo apt-get install phpunit

after that, i re-run this command:

./build vimapi /media/My_Documents/htdocs/yii/docs

again, this time i got these errors:

Building.. : Yii Framework Class Reference for vim
Version... : 1.1.14-dev
Source URL : http://code.google.com/p/yii/source/browse/trunk/framework

Building model...
PHP Error[2]: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory
    in file /usr/share/php/PHPUnit/Autoload.php at line 46
#0 /usr/share/php/PHPUnit/Autoload.php(46): require_once()
#1 /media/My_Documents/htdocs/yii/framework/test/CTestCase.php(15): require_once()
#2 /media/My_Documents/htdocs/yii/framework/YiiBase.php(395): include()
#3 unknown(0): autoload()
#4 /media/My_Documents/htdocs/yii/framework/test/CDbTestCase.php(41): spl_autoload_call()
#5 /media/My_Documents/htdocs/yii/build/commands/api/ApiModel.php(35): require_once()
#6 /media/My_Documents/htdocs/yii/build/commands/api/ApiModel.php(26): ApiModel->findClasses()
#7 /home/davidhhuan/.vim/bundle/Yii-API-manual-for-Vim/yii_commands/VimApiCommand.php(139): ApiModel->build()
#8 /home/davidhhuan/.vim/bundle/Yii-API-manual-for-Vim/yii_commands/VimApiCommand.php(126): VimApiCommand->buildModel()
#9 /media/My_Documents/htdocs/yii/framework/console/CConsoleCommandRunner.php(67): VimApiCommand->run()
#10 /media/My_Documents/htdocs/yii/framework/console/CConsoleApplication.php(91): CConsoleCommandRunner->run()
#11 /media/My_Documents/htdocs/yii/framework/base/CApplication.php(169): CConsoleApplication->processRequest()
#12 /media/My_Documents/htdocs/yii/framework/yiic.php(33): CConsoleApplication->run()
#13 /media/My_Documents/htdocs/yii/build/build(17): require_once()

ok, follow these steps:

sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear install phpunit/PHP_CodeCoverage

after that, i re-run this command:

./build vimapi /media/My_Documents/htdocs/yii/docs

now, i got these errors...

Building.. : Yii Framework Class Reference for vim
Version... : 1.1.14-dev
Source URL : http://code.google.com/p/yii/source/browse/trunk/framework

Building model...
PHP Fatal error:  Call to undefined method PHP_CodeCoverage_Filter::getInstance() in /usr/share/php/PHPUnit/Autoload.php on line 64

Damn... After searching and trying for serveal methods from google, i still blocked here, then i try to modify the file /usr/share/php/PHPUnit/Autoload.php, add 

these codes to it:

private static $_self = null;
public static function getInstance()
{
    if (self::$_self==null)
    {
        self::$_self = new PHP_CodeCoverage_Filter;
    }
    return self::$_self;
}

and then i modify the file, /etc/php5/cli/php.ini, uncommend this line:

include_path = ".:/usr/share/php"

then i re-try:

./build vimapi /media/My_Documents/htdocs/yii/docs

yes, again, i got new errors:

Building.. : Yii Framework Class Reference for vim
Version... : 1.1.14-dev
Source URL : http://code.google.com/p/yii/source/browse/trunk/framework

Building model...
PHP Error[2]: require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open stream: No such file or directory
    in file /media/My_Documents/htdocs/yii/framework/test/CWebTestCase.php at line 12
#0 /media/My_Documents/htdocs/yii/framework/test/CWebTestCase.php(12): require_once()
#1 /media/My_Documents/htdocs/yii/build/commands/api/ApiModel.php(35): require_once()
#2 /media/My_Documents/htdocs/yii/build/commands/api/ApiModel.php(26): ApiModel->findClasses()
#3 /home/davidhhuan/.vim/bundle/Yii-API-manual-for-Vim/yii_commands/VimApiCommand.php(139): ApiModel->build()
#4 /home/davidhhuan/.vim/bundle/Yii-API-manual-for-Vim/yii_commands/VimApiCommand.php(126): VimApiCommand->buildModel()
#5 /media/My_Documents/htdocs/yii/framework/console/CConsoleCommandRunner.php(67): VimApiCommand->run()
#6 /media/My_Documents/htdocs/yii/framework/console/CConsoleApplication.php(91): CConsoleCommandRunner->run()
#7 /media/My_Documents/htdocs/yii/framework/base/CApplication.php(169): CConsoleApplication->processRequest()
#8 /media/My_Documents/htdocs/yii/framework/yiic.php(33): CConsoleApplication->run()
#9 /media/My_Documents/htdocs/yii/build/build(17): require_once()

ok, i download the PHPUnit_Selenium from http://pear.phpunit.de/, uncompress it and copy the folder PHPUnit to /usr/share/php

then i re-try:

./build vimapi /media/My_Documents/htdocs/yii/docs

then....

Building.. : Yii Framework Class Reference for vim
Version... : 1.1.14-dev
Source URL : http://code.google.com/p/yii/source/browse/trunk/framework

Building model...
Building help files...
Done.

Thanks goodsness!!! I done it!!!

 

BTW, If you want to use keyword search (which allows to press <S-k> over any keyword) then you should add this line to your .vimrc:

autocmd BufNewFile,Bufread *.php set keywordprg="help"

 

Have fun with Yii and vim!!!

 

 

 

 

posted @ 2013-01-12 03:08  DavidHHuan  阅读(17526)  评论(0编辑  收藏  举报