scaraplate icon indicating copy to clipboard operation
scaraplate copied to clipboard

Boolean variables from .scaraplate.conf incorrectly works

Open rusdevops opened this issue 11 months ago • 0 comments

Makefile

{% if cookiecutter.use_proto %}
.PHONY: proto
proto:
  protoc --go_out=. proto/go_example_api.proto
{% endif %}

hooks/post_gen_project.py

def main():

  use_proto = "{{cookiecutter.use_proto}}"
  print("!!!", use_proto)
{% if cookiecutter.use_proto %}
    make = Popen(["make", "proto"], cwd=PROJECT_DIRECTORY)
    make.wait()
{% else %}

make proto is not called (good)

# create repo
$ scaraplate rollup go-project-template go-example-api
`go-example-api/.scaraplate.conf` file doesn't exist

!!! False

$ cat go-example-api/.scaraplate.conf

use_proto = False

make proto is called (bad)

# update repo
scaraplate rollup go-project-template go-example-api
Continuing with the following context from the `go-example-api/.scaraplate.conf` file:
// ...
'use_proto': 'False',

!!! False
 
protoc --go_out=. proto/go_example_api.proto

Expected behavior: make proto will not be called when updating

Environment:

$ scaraplate --version
scaraplate, version 0.5

$ cookiecutter --version
Cookiecutter 2.6.0

rusdevops avatar Mar 21 '24 12:03 rusdevops