Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate shell hook templates from PHP code #50

Open
stecman opened this issue May 17, 2015 · 2 comments
Open

Separate shell hook templates from PHP code #50

stecman opened this issue May 17, 2015 · 2 comments
Milestone

Comments

@stecman
Copy link
Owner

stecman commented May 17, 2015

Currently the templates for shell hooks live in PHP code as a static array of nowdoc strings (HookFactory::$hooks). At runtime these templates are populated using a str_replace call.

In the interest of keeping this part of the code maintainable, these templates should really be extracted from the PHP code and rendered with a more common templating system (Twig would be my choice).

@aik099
Copy link
Contributor

aik099 commented May 17, 2015

👎 , because this would force any project using this library also have Twig (or similar) as a Composer dependency just to generate hooks.

If array with hook content doesn't sound right, then we can just move out each hook template into separate sh/zsh file in say bin sub-folder. Then we do file_get_contents and replace what's needed.

@stecman
Copy link
Owner Author

stecman commented Aug 30, 2015

I kind of agree, though I'm sure there are some light-weight templating libraries that mitigate the large dependency issue (if it even is an issue?). The scripts should definitely be extracted to separate files, so we'll go with that for now - thanks.

@stecman stecman changed the title Use a tempting engine for generating hooks Separate shell hook templates from PHP code Aug 30, 2015
@stecman stecman added this to the 1.0 milestone Aug 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants