mix_generator icon indicating copy to clipboard operation
mix_generator copied to clipboard

Template is still generated if a child template fails

Open tonyvanriet opened this issue 7 years ago • 3 comments

We ran into some confusion when we attempted to generate one of our hierarchical templates into an existing directory.

This template has 3 layers of hierarchy. The lowest-level template failed with Error: Updating an existing project is not yet supported but the rest of the child templates proceeded to generate successfully because the maybe_invoke_based_on func sets the :force option after generating a based_on template.

This made it appear like the gen was successful and it took some time to realize why some things were missing from the generated output.

Perhaps there are some use cases where this is desirable, but from my perspective, I'd prefer to see the mix task fail more completely when any of the templates fail to generate.

tonyvanriet avatar Jun 15 '18 17:06 tonyvanriet

Hi @pragdave Have you had any chance to consider this issue and the proposed fix? We've been using our fork for the last month with good results. Thanks.

tonyvanriet avatar Jul 18 '18 14:07 tonyvanriet

Have you tried with HEAD?

We merged a PR yesterday that deletes the old directory before installing. That might fix it for you.

Dave

On Wed, Jul 18, 2018 at 9:48 AM Tony van Riet [email protected] wrote:

Hi @pragdave https://github.com/pragdave Have you had any chance to consider this issue and the proposed fix? We've been using our fork for the last month with good results. Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pragdave/mix_generator/issues/11#issuecomment-405957948, or mute the thread https://github.com/notifications/unsubscribe-auth/AAApmEqwAksJYWfo2UAMGSm9p1JUEHIuks5uH0q7gaJpZM4Up4y0 .

pragdave avatar Jul 18 '18 20:07 pragdave

@pragdave my PR should only remove the prior entry in .mix/templates/<template-name>. I think @tonyvanriet is talking about raising errors gen-ing into previously existing projects rather than template.install-ing over previously existing templates.

the-mikedavis avatar Jul 21 '18 22:07 the-mikedavis