Skip to content

Boolean variables from .scaraplate.conf incorrectly works #23

@rusdevops

Description

@rusdevops

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions