DSACMS / repo-scaffolder

Templates and commandline tools for creating repositories for US Federal open source projects
Creative Commons Zero v1.0 Universal
21 stars 8 forks source link

fix post gen project hook bug in tiers 0-2 #98

Closed Firebird1029 closed 2 months ago

Firebird1029 commented 2 months ago

Fix boolean type bug in cookiecutter Tier 0-2 hook

Problem

In tiers 0, 1, and 2, when being asked the following:

 [7/8] Would you like to create a repo on github.com?
    1 - True
    2 - False
    Choose from [1/2] (1): 2
  [8/8] Would you like to receive updates from ...
    1 - True
    2 - False
    Choose from [1/2] (1): 2

Selecting false proceeds to be true anyway, because in the hook, the Python variable is actually a string and so the truthy value of "False" is True.

Solution

I changed if CREATE_REPO: to if CREATE_REPO == "True":.

Result

Now, selecting False for those two prompts will not proceed to run the hook functions as unintended.

natalialuzuriaga commented 2 months ago

Note to future self: We will also have to add the hooks directory with post_gen_project.py to Tiers 3 + 4 as well!

Firebird1029 commented 2 months ago

Merging in now. Will switch to enums later if the cookiecutter values get more complicated than booleans