Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use phpdoc.xml.dist for configuration file name #799

Closed
ghost opened this issue Apr 26, 2013 · 2 comments
Closed

Cannot use phpdoc.xml.dist for configuration file name #799

ghost opened this issue Apr 26, 2013 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 26, 2013

I am having trouble executing the Phar against my project.

  • The configuration file is located in a sub directory called app (Symfony).
    • The configuration file is named phpdoc.xml.dist.
  • The Phar is in a separate location in $PATH (or %PATH% in my case for Windows).
    • I renamed the Phar to phpdoc.phar.

Using PHPUnit frequently, I have grown accustomed to running it like this: phpunit -c app. Unfortunately that generates the following error for phpdoc -c app:

[Zend\Config\Exception\RuntimeException]
Filename "D:\Projects\CEMSv4\Application\app" is missing an extension and cannot be auto-detected

I then tried using the configuration file name: phpdoc -c app\phpdoc.xml.dist. That also did not work:

[Zend\Config\Exception\RuntimeException]
Unsupported config file extension: .dist

Thinking that the .dist extension is automatically appended, I tried: phpdoc -c app\phpdoc.xml. That, surprisingly to me, did not work either.

PHP Warning:  chdir(): Invalid argument (errno 22) in phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/src/phpDocumentor/Command/ConfigurableCommand.php on line 70
PHP Stack trace:
PHP   1. {main}() C:\Users\kherrera\Programs\php-phars\phpdoc.phar:0
PHP   2. include() C:\Users\kherrera\Programs\php-phars\phpdoc.phar:9
PHP   3. require_once() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/_cli_stub.php:11
PHP   4. phpDocumentor\Application->run() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/bin/phpdoc.php:28
PHP   5. Symfony\Component\Console\Application->run() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/src/phpDocumentor/Application.php:74
PHP   6. Symfony\Component\Console\Application->doRun() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:105
PHP   7. Symfony\Component\Console\Command\Command->run() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:192
PHP   8. phpDocumentor\Command\Project\RunCommand->execute() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:238
PHP   9. phpDocumentor\Command\ConfigurableCommand->execute() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/src/phpDocumentor/Command/Project/RunCommand.php:222
PHP  10. chdir() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/src/phpDocumentor/Command/ConfigurableCommand.php:70

Warning: chdir(): Invalid argument (errno 22) in phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/src/phpDocumentor/Command/ConfigurableCommand.php on line 70

Call Stack:
    0.0648    1058480   1. {main}() C:\Users\kherrera\Programs\php-phars\phpdoc.phar:0
    0.0652    1051904   2. include('phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/_cli_stub.php') C:\Users\kherrera\Programs\php-phars\phpdoc.phar:9
    0.0655    1058264   3. require_once('phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/bin/phpdoc.php') phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/_cli_stub.php:11
    0.0988    2904368   4. phpDocumentor\Application->run() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/bin/phpdoc.php:28
    0.1001    3004808   5. Symfony\Component\Console\Application->run() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/src/phpDocumentor/Application.php:74
    0.1033    3152224   6. Symfony\Component\Console\Application->doRun() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:105
    0.1035    3152888   7. Symfony\Component\Console\Command\Command->run() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:192

    0.1039    3155528   8. phpDocumentor\Command\Project\RunCommand->execute() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:238
    0.1039    3155800   9. phpDocumentor\Command\ConfigurableCommand->execute() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/src/phpDocumentor/Command/Project/RunCommand.php:222
    0.1040    3156040  10. chdir() phar://C:/Users/kherrera/Programs/php-phars/phpdoc.phar/src/phpDocumentor/Command/ConfigurableCommand.php:70

Initializing parser and collecting files .. OK
Parsing files



  [Exception]
  No parsable files were found, did you specify any using the -f or -d parameter?

It seems that ConfigurableCommand.php#70 does not check for the distribution file, and Zend Config will not let me specify the distribution file for use. Renaming phpdoc.xml.dist to phpdoc.xml allows me to run the application.

@boenrobot
Copy link
Contributor

You need to use phpdoc.dist.xml as opposed to phpdoc.xml.dist.

(Strictly speaking, this is how PHPUnit should be doing it, except it doesn't...)

As for specifying the literal file name... that's a know bug with the PHAR file... for some reason, the path to the configuration file is relative to the PHAR file itself, rather than the CWD. Currently, the only workaround is to simply use the %cd% environment variable, e.g.

phpdoc -c %cd%\app\phpdoc.dist.xml

@ghost
Copy link
Author

ghost commented Apr 26, 2013

That worked, thanks!

I must have glossed over that bit in the docs.

@ghost ghost closed this as completed Apr 26, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant