CentreForDigitalHumanities / cookiecutter-webapp-deluxe

BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

New post-generation/bootstrap logic does not consistently check for command success #17

Open jgonggrijp opened 4 years ago

jgonggrijp commented 4 years ago

The bootstrap command convention as I originally wrote it, is to define a named command at module scope:

https://github.com/UUDigitalHumanitieslab/cookiecutter-webapp-deluxe/blob/c32ac65129466650c32b3ec4310c8b70d3093a99/hooks/post_gen_project.py#L118-L121

This enables us to attempt running the command by name, keep track of whether the run was successful, and print out the same command to the user if it wasn't:

https://github.com/UUDigitalHumanitieslab/cookiecutter-webapp-deluxe/blob/c32ac65129466650c32b3ec4310c8b70d3093a99/hooks/post_gen_project.py#L44

https://github.com/UUDigitalHumanitieslab/cookiecutter-webapp-deluxe/blob/c32ac65129466650c32b3ec4310c8b70d3093a99/hooks/post_gen_project.py#L77

The new Angular-centered bootstrap logic does not use this convention, instead using anonymous, immediately-invoked command expressions:

https://github.com/UUDigitalHumanitieslab/cookiecutter-webapp-deluxe/blob/c32ac65129466650c32b3ec4310c8b70d3093a99/%7B%7Bcookiecutter.slug%7D%7D/bootstrap.py#L225-L228

which makes it impossible to display the command to the user if it needs to be reattempted.

Adding to this, error handling in these new parts of the logic is rather inconsistent. In many cases, such as the quote above, errors are simply ignored. This means (a) that the cookiecutter user must pay close attention to the hook output in order to notice the failed command at all and (b) that subsequent steps will be run even if their preconditions are not met.

Fix: restore the convention so that command are only run if their preconditions are met and so that the user gets to see all commands that still have to be run afterwards.