运行composer update
后,我需要运行两个命令,一个是调用.sh
文件的Linux控制台命令,另一个是php app/console
命令。通过在composer.json
文件中执行某些操作可以做到这一点吗?我注意到这几行:
"post-update-cmd": [
"Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::buildBootstrap",
"Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::clearCache",
"Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installAssets"
]
但不知道这是否是正确的方式。以第一个命令:/home/data.sh
和第二个命令php app/console doctrine:fixtures:load --append
为例,对此有什么建议吗?
您可以将这些命令包含在post-update-cmd
指令中,如下所示:
"post-update-cmd": [
"Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::buildBootstrap",
"Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::clearCache",
"Sensio''Bundle''DistributionBundle''Composer''ScriptHandler::installAssets",
"/home/data.sh",
"php app/console doctrine:fixtures:load --append"
]
更多信息:https://getcomposer.org/doc/articles/scripts.md