...But this approach would take a pretty long time to implement
Why would it take so long? Isn't such script exactly what you'd need, and couldn't it quickly be implemented with a series of regular expressions, combined with a loop through your files?
What perhaps makes this complicated are 'situations', like:
- one or more placeholders aren't substituted by a value.
(what should happen if you forget to configure a value for "**var-something**", for instance?)
- you introduce a placeholder string which already exists elsewhere
- how do you prevent two developers from using the script more or less simultaneously
Thanks for your reply.
It is harder to implement (with some sort of error detection) than if there was maybe already a similar function built in to PGB :-) I hoped there was some way to generate the config files while compiling. But it looks like there isn't. So I will probably just create the script like I said. Thanks for your "to do" list. I think this is a good start for me to think about. The part with simultaneous usage can be fixed by generating the resulting files "on the fly" (without saving them on the server). I will probably use a simple markup so that I only have to upload a configuration file which can be converted to variables and then to regular expressions. The error detection will be a bit harder but I think I can find a solution here as well :-)
Yeah sorry nothing like this built-in to PGB, you'd likely have to implement some kind of build/deployment script on your own side. Always interesting to hear use cases though ... might even be third-party solutions to this out there that you could hook into build. Or you could make one and share it!
I am currently trying to fix one potential problem - do you maybe have an idea how to solve it? Let's say I am working on version 1.1.0 of my app. In my php script, I accidentally generate older config files (for version 1.0.0). Now, when overriding the code base with these config files, this might lead to problems (e.g. an old config.xml could not include some plugins I need). So I thought about some sort of test whether the right config files were generated. I would add a file "1.1.0.xml" into my build path. Now comes the part where I need help: Is it possible to check while compiling if a file exists or not? I thought I could maybe make the build fail when using sth like
<xi:include href="1.0.0.xml" xmlns:xi="http://www.w3.org/2003/XInclude" />
in my config.xml.
But that didn't work - the app is still being compiled even though the file 1.0.0.xml doesn't exist. Is it somehow possible to find out whether a file (xml or other) exists or not while building? I was hoping to get a "malformed xml" when the file 1.0.0.xml doesn't exist but it seems like PGB simply ignores the line with xi:include.