jenssegers/optimus

Command not working

MartijnThomas opened this issue ยท 5 comments

Not sure why this is happening, but I just installed Optimus in a fresh Laravel 5.1 install and once I run php vendor/bin/optimus spark.

This is the result

SRC_DIR="`pwd`"
cd "`dirname "$0"`"
cd '../jenssegers/optimus'
BIN_TARGET="`pwd`/optimus"
cd "$SRC_DIR"
"$BIN_TARGET" "$@"

And I don't see any number being generated. Running the command directly from vendor/bin does not help.

That's weird. My first guess is that this is related to your development environment.

I ran the command from a fresh homestead box.

This is the result of passing the shell script to php. The vendor/bin/optimus path is that of the shell script which executes the vendor/jenssegers/optimus/bin/optimus PHP script.

The vendor/bin/optimus spark command should be used instead and the README.md file should be updated to reflect this.

The readme says to use the vendor/bin/optimus command, no?

It says to use php vendor/bin/optimus, not vendor/bin/optimus.

Interestingly, I tried to reproduce it and I got different results than before. It appears that vendor/bin/optimus may be either a shell script or a symlink to the PHP script. Composer's source code shows that it will create the shell script if the symlink creation failed.

When I encountered this problem, it must have been because symlink creation failed due to my document root being shared from Windows to my virtual machine, which resulted in:

$ file vendor/bin/optimus
vendor/bin/optimus: a /usr/bin/env sh script, ASCII text executable
$ file vendor/jenssegers/optimus/bin/optimus
vendor/jenssegers/optimus/bin/optimus: a /usr/bin/env php script, ASCII text executable

Installing outside of the shared directory results in:

$ file vendor/bin/optimus
vendor/bin/optimus: symbolic link to ../jenssegers/optimus/optimus
$ file --dereference vendor/bin/optimus
vendor/bin/optimus: a /usr/bin/env php script executable (binary data)

Running vendor/bin/optimus instead of php vendor/bin/optimus will work in both cases, but php vendor/bin/optimus will only work if the symlink route was taken by Composer during installation.