theseer / phpdox

Documentation generator for PHP Code using standard technology (SRC, DOCBLOCK, XML and XSLT)
http://phpdox.de
Other
599 stars 121 forks source link

Run phpdox with a cloned repository on Windows #299

Closed onet4 closed 6 years ago

onet4 commented 7 years ago

Hi,

I could successfully generate documents using the phar file. However, it doesn't seem to run with a cloned repository.

  1. Cloned the repository to local.
  2. Performed composer install and it downloaded dependencies in the vendor directory.
  3. Performed php phpdox --version but it just does not respond. Ctrl + c does not terminate it so I have to close the console window.

Am I missing something?

onet4 commented 7 years ago

It seems the line

$git = exec('command -p git describe --always --dirty 2>'.$devNull, $foo, $rc);

has to be

$git = exec('git describe --always --dirty 2>'.$devNull, $foo, $rc);

The phar version runs just fine though.

theseer commented 7 years ago

Thank you for the additional research and effort.

Good catch. I completely forgot about the usage of command for running git. This is of course a unix-ism and command doesn't exist on windows (sigh), so the problem makes sense.

I'm amazed that "git" without .exe works..?

The phar version is unaffected because it's not a git based checkout and thus no git call is performed. I'll look into changing it. I have to rework the vesion detection anyhow as it is broken for nested git repositories.

onet4 commented 7 years ago

This is of course a unix-ism and command doesn't exist on windows (sigh), so the problem makes sense.

According to this web site,

The command command starts a new instance of the command.com command interpreter. The command command is available in MS-DOS as well as in all 32-bit versions of Windows. The command command is not available in 64-bit versions of Windows.

And my machine Windows 7 x86 supports the command command and when command is typed in a console window, it waits for user inputs. Probably that's why the script hangs on Windows machines that support the command command.

I'm amazed that "git" without .exe works..?

It seems to be working here even though the program path is not registered for the environment variable.

You may want to pay attention to that exec() doesn't halt the script if the command does not exist. It just stores an empty value to the variables and the execution flow continues. This can be confirmed by simply running test code like exec('abcde --version 2> null', $foo, $rc); This still makes me wonder though why the script still can find the version number although the command does not exist. Yet you said the phar version has a different handling for getting the version number so I guess it has something to do with it.

theseer commented 6 years ago

I don't have a windows environment to verify it actually is fixed.