GithubHelp home page GithubHelp logo

pharbuilder's Issues

No support for Symfony 4

Hi,

I've been attempting to install this project as a dev dependency but I cannot due to this being locked to Version 2.7+, 3.0+ of Symfony.

I'm inclined to submit a pull request, however in addition your sister project macfja/symfony-console-filechooser is also hardcoded to support 2.7+, 3.0+, which makes it just that bit harder to work around.

(Plus, I do not know the source code of this project all that well so I am against bumping up versions of composer without say... running tests or something)

Thank you!

Add Phar Signature

Add the possibility to add a numeric signature to the Phar.

Task to do:

  • Check system requirement (cf. Phar::getSupportedSignatures + extension like OpenSSL)
  • Ask for private key for OpenSSL
  • Add a public key for OpenSSL
  • ?

Official documentation:

how to exclude directory add in phar. such as logs and temp

PHP Fatal error:  Uncaught exception 'Zend_Log_Exception' with message '"phar:///path/bin/main.phar/logs/run.log" cannot be opened with mode "a"' in phar:///path/bin/main.phar/vendor/zf1/zend-log/library/Zend/Log/Writer/Stream.php:81
Stack trace:
#0 phar:///path/bin/main.phar/configs/core.php(52): Zend_Log_Writer_Stream->__construct('phar:///path/b...')
#1 phar:///path/bin/main.phar/bin/cli.php(14): require_once('phar:///path/b...')
#2 /path/bin/main.phar(2): include('phar:///path/b...')
#3 {main}
  thrown in phar:///path/bin/main.phar/vendor/zf1/zend-log/library/Zend/Log/Writer/Stream.php on line 81

Fatal error: Uncaught exception 'Zend_Log_Exception' with message '"phar:///path/bin/main.phar/logs/run.log" cannot be opened with mode "a"' in phar:///path/bin/main.phar/vendor/zf1/zend-log/library/Zend/Log/Writer/Stream.php:81
Stack trace:
#0 phar:///path/bin/main.phar/configs/core.php(52): Zend_Log_Writer_Stream->__construct('phar:///path/b...')
#1 phar:///path/bin/main.phar/bin/cli.php(14): require_once('phar:///path/b...')
#2 /path/bin/main.phar(2): include('phar:///path/b...')
#3 {main}
  thrown in phar:///path/bin/main.phar/vendor/zf1/zend-log/library/Zend/Log/Writer/Stream.php on line 81

Not bundling the composer file fails on some dependencies

I have a dependency in my project which tries to check its own composer.json file to get its version.

In PharBuilder.php you specifically exclude composer files from the build.

Is / was there a specific reason for this and if not would you mind if I open a PR to allow for the composer.json file to be included into the build?

I guess it would be neat if it would be part of the configuration at some point, but for now I quick fix by just removing the line would work for me.

Warning for invalid directories

I'm currently getting the following warning:

image

info is created in a build.before event hook. Seems like the validation happens before hooks are executed.

Performance improvements?

I have a cli application which has a 4000+ php files in its vendor directory, and I find it lasts more then 2 minutes to compile all files into one phar file (PHP version 5.6, AMD A8-9600/ 16G Mem/ Ubuntu 16.04).

Then I read the source. I find that adding files one by one makes poor performance, this can be solved by using Phar::buildFromDirectory or Phar::buildFromIterator and compress once with Phar::compressFiles.

I made a small change to the file app/PharBuilder.php. (https://github.com/jiaojie1989/PharBuilder/blob/master/app/PharBuilder.php)
I just wonder if what I have done is ok? Please help me.
Thanks.

Trouble running the app in a headless CI-Server

Due to

protected function throwErrorForNoInteractiveMode()
it is not easily possible to run the app in a headless server-environment like a CI-Server.

I had trouble getting it set up and running on Travis-CI until I dug into the code and added some default values to the config in the composer.json.

The following keys need to be set in the config to run headless, otherwise the check whether the script runs without IO prevents the default settings being used:

  • entry-point
  • compression
  • name
  • output-dir
  • include
  • skip-shebang

It would be great to find that information in the docs somewhere or prevent the check failing a headless build…

Change the method MacFJA\PharBuilder\Utils\Composer::removeFilesAutoloadFor

The method MacFJA\PharBuilder\Utils\Composer::removeFilesAutoloadFor must be changed as it alter a project file without restoring its original content.

Right now I have those possibility to correct that:

  • Add a method to revert the modification (by storing the previous content in memory)
  • Launch a composer command to regenerate the file
  • Only change the file in the PHAR (by calling \Phar::addFromString)

Add before-script and after-script hooks

Would be nice if it could run git describe --tags optionally and define a version constant like PHAR_BUILDER_GIT_VERSION. It would remove the need to always change a file before tagging a new release.

Might as well be done by using a script to release new versions.

Fatal Error on Startup

Running

vendor/bin/phar-builder package composer.json

with PHP 7.0.3 results in

PHP Warning:  Declaration of MacFJA\PharBuilder\Commands\Base::validateName($value, Symfony\Component\Console\Output\OutputInterface $output) should be compatible with Symfony\Component\Console\Command\Command::validateName($name) in /home/kelunik/GitHub/kelunik/acme-client/vendor/macfja/phar-builder/app/Commands/Base.php on line 289

PHP Fatal error:  Uncaught Symfony\Component\Console\Exception\InvalidArgumentException: Incorrectly nested style tag found. in /home/kelunik/GitHub/kelunik/acme-client/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php:87

InvalidArgumentException

I am unable to run the utility.
Could you please point me to the correct direction to solve this?

I get the following exception:

  [InvalidArgumentException]                       
  The "src/Globals.php" directory does not exist.                                                     

But the file above exists! (src/Globals.php)

My composer.json file is:

{
    "minimum-stability": "dev",
    "name": "gevik/myapp",
    "require": {
        "php": ">=5.5.9",
        "blendsdk/blendengine": "dev-engine2"
    },
    "autoload": {
        "psr-4": {
            "MyApp\\": "src"
        },
        "files": [
            "src/Globals.php"
        ]
    }
}

Default to current directory

It should default to the current directory if it contains a composer.json when running vendor/bin/phar-builder package.

Double slash not handled properly

I tried to package this library https://github.com/kzykhys/Ciconia

Ended with this message:

[BadMethodCallException]
  Entry src//Ciconia/Ciconia.php does not exist and cannot be created: phar error: invalid path "src//Ciconia/Ciconia.php" contains double slash

It was easy to fix, just had to remove the / after src in composer.json, but maybe it would be nice if this was handled automatically.

Fatal on broken Symlink

Example:

 > vendor/consolidation/robo/scenarios/symfony2/tests In PharBuilder.php line 515:
                                                                               
  phar error: unable to open file "vendor/consolidation/robo/scenarios/symfony2/tests" to add to phar archive 

The file vendor/consolidation/robo/scenarios/symfony2/tests is a symlink, and the link in broken

Error if autoload sections are empty

A PHP Notice and a PHP Warning are send if the autoload section is empty in the composer.json file


Error on commit bf48160

Reading composer.json...PHP Notice:  Undefined index: autoload in /home/you/PharBuilder/app/Utils/Composer.php on line 62
PHP Stack trace:
PHP   1. {main}() /home/you/PharBuilder/bin/phar-builder:0
PHP   2. include() /home/you/PharBuilder/bin/phar-builder:3
PHP   3. Symfony\Component\Console\Application->run() /home/you/PharBuilder/bin/phar-builder.php:20
PHP   4. Symfony\Component\Console\Application->doRun() /home/you/PharBuilder/vendor/symfony/console/Application.php:123
PHP   5. Symfony\Component\Console\Application->doRunCommand() /home/you/PharBuilder/vendor/symfony/console/Application.php:192
PHP   6. Symfony\Component\Console\Command\Command->run() /home/you/PharBuilder/vendor/symfony/console/Application.php:844
PHP   7. MacFJA\PharBuilder\Commands\Package->execute() /home/you/PharBuilder/vendor/symfony/console/Command/Command.php:259
PHP   8. MacFJA\PharBuilder\PharBuilder->__construct() /home/you/PharBuilder/app/Commands/Package.php:130
PHP   9. MacFJA\PharBuilder\PharBuilder->buildPhar() /home/you/PharBuilder/app/PharBuilder.php:126
PHP  10. MacFJA\PharBuilder\PharBuilder->readComposerAutoload() /home/you/PharBuilder/app/PharBuilder.php:143
PHP  11. MacFJA\PharBuilder\Utils\Composer->getSourcePaths() /home/you/PharBuilder/app/PharBuilder.php:354
PHP Warning:  Invalid argument supplied for foreach() in /home/you/PharBuilder/app/Utils/Composer.php on line 86
PHP Stack trace:
PHP   1. {main}() /home/you/PharBuilder/bin/phar-builder:0
PHP   2. include() /home/you/PharBuilder/bin/phar-builder:3
PHP   3. Symfony\Component\Console\Application->run() /home/you/PharBuilder/bin/phar-builder.php:20
PHP   4. Symfony\Component\Console\Application->doRun() /home/you/PharBuilder/vendor/symfony/console/Application.php:123
PHP   5. Symfony\Component\Console\Application->doRunCommand() /home/you/PharBuilder/vendor/symfony/console/Application.php:192
PHP   6. Symfony\Component\Console\Command\Command->run() /home/you/PharBuilder/vendor/symfony/console/Application.php:844
PHP   7. MacFJA\PharBuilder\Commands\Package->execute() /home/you/PharBuilder/vendor/symfony/console/Command/Command.php:259
PHP   8. MacFJA\PharBuilder\PharBuilder->__construct() /home/you/PharBuilder/app/Commands/Package.php:130
PHP   9. MacFJA\PharBuilder\PharBuilder->buildPhar() /home/you/PharBuilder/app/PharBuilder.php:126
PHP  10. MacFJA\PharBuilder\PharBuilder->readComposerAutoload() /home/you/PharBuilder/app/PharBuilder.php:143
PHP  11. MacFJA\PharBuilder\Utils\Composer->getSourcePaths() /home/you/PharBuilder/app/PharBuilder.php:354
PHP  12. MacFJA\PharBuilder\Utils\Composer->readAutoload() /home/you/PharBuilder/app/Utils/Composer.php:62

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.