post-install-cmd not launching on composer install
Opened this issue · 9 comments
Hello,
I installed your package following the readme instructions but the interactive configuration won't show up unless I add these lines to my composer.json
{
"require-dev": {
"bruli/php-git-hooks": "^4.1"
},
"scripts": {
"post-install-cmd": "PhpGitHooks\\Application\\Composer\\ConfiguratorScript::buildConfig",
"post-update-cmd": "PhpGitHooks\\Application\\Composer\\ConfiguratorScript::buildConfig"
}
}
Which, I think, I shouldn't... Why aren't the post-install-cmd taken into account ?
My setup:
Composer version 1.0-dev (cc14bb3ba99eaf2b1ee45bf292962551b4f1436d) 2016-02-29 19:10:08
PHP 5.6.15-1+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans
Trying to call the scripts manually doesn't work either.
And here's what I've got following the readme installation instructions:
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing symfony/filesystem (v3.0.3)
Loading from cache
- Installing symfony/config (v3.0.2)
Loading from cache
- Installing symfony/dependency-injection (v3.0.2)
Loading from cache
- Installing bruli/ignore-files (1.0.1)
Loading from cache
- Installing seld/jsonlint (1.3.1)
Loading from cache
- Installing fiunchinho/phpunit-randomizer (2.0.2)
Loading from cache
- Installing sebastian/recursion-context (1.0.2)
Loading from cache
- Installing sebastian/exporter (1.2.1)
Loading from cache
- Installing sebastian/environment (1.3.5)
Loading from cache
- Installing sebastian/diff (1.4.1)
Loading from cache
- Installing sebastian/comparator (1.2.0)
Loading from cache
- Installing doctrine/instantiator (1.0.5)
Loading from cache
- Installing phpunit/php-text-template (1.2.1)
Loading from cache
- Installing phpunit/php-timer (1.0.7)
Loading from cache
- Installing phpunit/php-token-stream (1.4.8)
Loading from cache
- Installing phpunit/php-file-iterator (1.4.1)
Loading from cache
- Installing symfony/yaml (v3.0.2)
Loading from cache
- Installing pdepend/pdepend (2.2.3)
Loading from cache
- Installing phpmd/phpmd (2.3.2)
Loading from cache
- Installing squizlabs/php_codesniffer (2.5.1)
Loading from cache
- Installing myclabs/deep-copy (1.5.0)
Loading from cache
- Installing sebastian/version (2.0.0)
Loading from cache
- Installing sebastian/resource-operations (1.0.0)
Loading from cache
- Installing sebastian/global-state (1.1.1)
Loading from cache
- Installing phpdocumentor/reflection-docblock (2.0.4)
Loading from cache
- Installing phpspec/prophecy (v1.6.0)
Loading from cache
- Installing phpunit/phpunit-mock-objects (3.0.6)
Loading from cache
- Installing sebastian/code-unit-reverse-lookup (1.0.0)
Loading from cache
- Installing phpunit/php-code-coverage (3.2.1)
Loading from cache
- Installing phpunit/phpunit (5.2.9)
Loading from cache
- Installing mybuilder/phpunit-accelerator (v1.1.1)
Loading from cache
- Installing hamcrest/hamcrest-php (v1.2.2)
Loading from cache
- Installing mockery/mockery (0.9.4)
Loading from cache
- Installing symfony/polyfill-mbstring (v1.1.0)
Loading from cache
- Installing symfony/stopwatch (v3.0.3)
Loading from cache
- Installing symfony/process (v3.0.3)
Loading from cache
- Installing symfony/finder (v3.0.3)
Loading from cache
- Installing symfony/event-dispatcher (v3.0.3)
Loading from cache
- Installing symfony/console (v3.0.3)
Loading from cache
- Installing fabpot/php-cs-fixer (v1.11.2)
Loading from cache
- Installing bruli/php-git-hooks (v4.1.2)
Loading from cache
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
sebastian/global-state suggests installing ext-uopz (*)
phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
symfony/event-dispatcher suggests installing symfony/http-kernel ()
symfony/console suggests installing psr/log (For using the console logger)
Writing lock file
Generating autoload files
I not understand what's the problem?.
The problem is the configuration dialog doesn't show up after installation.
Configuration script only works if you don't have a php-git-hook.yml file or this file is not with all data.
I'm testing instalation and works fine.
Ok. Here's how I went:
mkdir something
cd !$
git init .
composer require bruli/php-git-hooks --dev
And the configuration script isn't launched 😭
Am I doing it right ?
Ok.
You need add (manually) in your composer.json:
"scripts": {
"post-install-cmd": [
"PhpGitHooks\\Application\\Composer\\ConfiguratorScript::buildConfig"
],
"post-update-cmd": [
"PhpGitHooks\\Application\\Composer\\ConfiguratorScript::buildConfig"
]
Maybe README.md file is not very clear.
Thanks for your reply. As I stated in my previous comment that was what I did to enable your configuration script on my project but I wasn't sure I was doing it the right way.
Thanks again for your time. I can send you a PR to make the corresponding change in the README if you want.
Yes, off course. Feel free to create a PR.