phpqa icon indicating copy to clipboard operation
phpqa copied to clipboard

Create phar and installer

Open cryptiklemur opened this issue 10 years ago • 7 comments

Similar to Gush, Bldr, and Composer. A phar file, and an installer would make this a lot easier to install

cryptiklemur avatar Jul 21 '15 17:07 cryptiklemur

@aequasi I tried but had some issue with the symlinks of each project example (bin/phpunit, bin/php-cs-fixer) when added to the phar file.

I will create a branch to start working on this feature and do some tests.

jmolivas avatar Jul 21 '15 21:07 jmolivas

I would also suggest using symfony console and you can use the box framework to create the phar file. thanks.

geshan avatar Jul 22 '15 07:07 geshan

@geshan:

  • This project currently uses symfony/console as you can see on the composer.json file => https://github.com/jmolivas/phpqa/blob/master/composer.json#L16
  • And as mentioned below, I tried to use box but had some issues with the symlinks of each project example (bin/phpunit, bin/php-cs-fixer) when added to the phar file.

Also as mentioned below too, I will create a branch to start working on this feature and do some tests.

jmolivas avatar Jul 22 '15 07:07 jmolivas

thanks for letting me know @jmolivas , appreciated.

geshan avatar Jul 22 '15 07:07 geshan

@aequasi and @geshan

I just push a new branch build-phar => https://github.com/jmolivas/phpqa/tree/build-phar

This branch includes a box.json file => https://github.com/jmolivas/phpqa/blob/build-phar/box.json with this content

{
    "alias": "phpqa.phar",
    "chmod": "0755",
    "directories": [
        "config",
        "src",
        "bin"
    ],
    "files": [
        "phpqa.yml",
        "bin/phpqa.php",
        "config/.php_cs",
        "config/phpunit.xml.dist",
        "vendor/autoload.php"
    ],
    "finder": [
        {
            "name": "/(\\.php|\\.json|\\.yml)$/",
            "exclude": ["Tests","tests", "docs"],
            "in": "vendor"
        }
    ],
    "main": "bin/phpqa.php",
    "output": "phpqa.phar",
    "stub": true
}

I ran the box project to build the phar using:

$ box build

And then extract the file phpqa.phar content using:

$ box extract phpqa.phar

After listing the bin directory, I found, the binary symlinks are no longer symlinks after building the phar file: php-phar-symlinks

Because of this, the execution of this project, throws the following exception
phar-error

jmolivas avatar Jul 22 '15 08:07 jmolivas

are you including the symlink locations in the phar file? (vendor/bin/phpunit)

cryptiklemur avatar Jul 22 '15 15:07 cryptiklemur

The box.json It's including the vendor directory but applying some filters https://github.com/jmolivas/phpqa/blob/build-phar/box.json#L20

I will take a look at the extracted pharcontents and comment with the results

jmolivas avatar Jul 22 '15 16:07 jmolivas