Automatically patch generated files: How to?

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Automatically patch generated files: How to?

Post by jsetzer » 2018-08-07 11:58

Hi there,

I am trying to make my changes in hook files only, but there are couple of things which can only be done in overwritable files :? .

Is there a way to automatically apply patches to generated files?

To give an example:
The file inc.Common.php contains the following code which shows the "Jump-To" menu on all pages except the homepage:

Code: Select all

<?php if(!$home_page){ ?>
	<?php echo NavMenus(); ?>
<?php } ?>


I want to remove the condition (first and last line of the code) to see the menu on every page, even on the homepage.

Code: Select all

<?php echo NavMenus(); ?>
or

Code: Select all

<?php if(!$home_page || true){ ?>
    <?php echo NavMenus(); ?>
<?php } ?>
AppGini will overwrite inc.Common.php on next generation :shock: as long as I do not uncheck the code file :roll: .

So I'm wondering if there is any tool out there which will automatically patch the generated files according to some configurable rules (diff/merge?)

How do others handle this?

Thanks, guys!

Kind Regards,
Jan

PS: Maybe BigProf can add a project setting "[x] hide jump-to menu on homepage" in the next release?
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: Automatically patch generated files: How to?

Post by grimblefritz » 2018-08-13 16:07

I used to do this, but have since made all my changes via the files in hooks.

That said, back when I DID make changes in generated files, I never did find a way to patch automatically within the builder app. I posted a suggestion that the AppGini builder needs hooks to execute a command before/after each file is generated, or at the very least before/after generation. Nothing came of that suggestion.

Ultimately, I changed my workflow to use a script to move files from the output folder to the execution folder (which, in my situation, is always on another host so a transfer had to occur anyway.) In that script, I made whatever changes I needed for the generated files. Not as seamless as hooks in the builder, but it worked for me.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Automatically patch generated files: How to?

Post by jsetzer » 2018-08-15 10:20

Thank you @grimblefritz for sharing your ideas!
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

Post Reply