Proposal: introduce composer_manager_build_complete(), which fires after a composer_manager build is complete.
Use case:
- User enables module A, which has a library dependency managed by composer_manager
- Module A needs to fire off a few functions in hook_install(), but it cannot because dependencies are not yet build when that hook in invoked
- Instead, Module A implements composer_manager_build_complete(). which is fired after dependencies are built. Necessary install functions are then called within that implementation.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | composer_manager-invoke-post-install-hook-2272547-7.patch | 1.49 KB | Anonymous (not verified) |
| #3 | composer_manager-invoke-post-install-hook-2272547-4.patch | 1.48 KB | Anonymous (not verified) |
Comments
Comment #1
cpliakas commentedI'm all for adding hooks, thanks for the idea and I think the use case makes a lot of sense.
The one comment I have is to consider changing the name to reflect nomenclature used in the Composer project and be consistent with Drupal things like
hook_node_loadandhook_node_insertwhere the format is "hook" _ "noun" _ "verb that just happened". I would propose naming this hook "composer_manager_dependencies_install".Thoughts? Other suggestions?
Thanks!
Chris
Comment #2
boztek commentedThis patch invokes hook_composer_manager_install after every drush invocation of composer install.
Comment #3
Anonymous (not verified) commentedI needed to re-roll this patch to make a small modification to it. This now works with the use case we had with the code currently checked in here: http://drupal.org/project/behatrunner
Comment #4
cpliakas commentedPatch function looks great, but I would like to adhere to the hook - noun - verb convention. I know that
hook_composer_manager_dependencies_installis verbose, but it is explicit whereas hook_composer_manager_install implies it is invoked after the module is installed. Let me know if you feel strongly otherwise.Thanks for rolling the patch!
Comment #5
cpliakas commentedIn order to make it more terse, we could also do
hook_composer_dependencies_install(). This is consistent withhook_composer_json_alter()and makes it a little more human readable as well.Comment #6
Anonymous (not verified) commentedNo problem at all, I completely understand. I'll re-roll and post momentarily.
Comment #7
Anonymous (not verified) commentedPatch re-rolled with updated name.
Comment #8
cpliakas commentedLooks good, works as advertised. Thanks for the contribution @boztek and @nateswart!
Comment #9
cpliakas commentedCommitted to 7.x and 6.x branches, rolled a 6.x-1.5 and 7.x-1.5 release so that the hook is available in a stable release for modules like BehatRunner to use without requiring the dev version or a patch.
Comment #10
Anonymous (not verified) commentedAwesome - thanks a ton, Chris!