hongqn / cookiecutter_project_upgrader

Update cookiecutter projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cookiecutter Project Upgrader

CI Status Documentation Status Code Coverage

Upgrade projects created from a Cookiecutter template.

Features

Cookiecutter Project Upgrader allows upgrading projects that were created using Cookiecutter.

After a project has been created from a Cookiecutter template, changes made to the Cookiecutter template usually have to be applied manually to the project. This tool automates this process.

When run the first time on a project, it creates a new branch from the first commit of the current branch (the oldest one). It then generates the project again using the latest version of the template and creates a new commit that contains the latest cookiecuttered code,

Usage: cookiecutter_project_upgrader [OPTIONS]

Upgrade projects created from a Cookiecutter template
Options:
-c, --context-file PATH
 Default: docs/cookiecutter_input.json
-b, --branch TEXT
 Default: cookiecutter-template
-m, --merge-now BOOLEAN
 Execute a git merge after a successful update, default: ask if interactive, otherwise false.
-m, --push-template-branch-changes BOOLEAN
 Push changes to the remote Git branch on a successful update, default: ask if interactive, otherwise false.
--help Show this message and exit.

Preconditions

The tool requires a JSON file with context that matches the existing service. This file can be created through Cookiecutter with the following contents:

{{ cookiecutter | jsonify }}

You will need a recent version of git for this to work. (it needs --no-checkout on git worktree)

Auto-Completion

The script uses the Click toolkit. Because the script uses Click, you can enable completion for Zsh and Bash.

For Bash, add the following to your .bashrc or some other profile initialization file. eval "$(_COOKIECUTTER_PROJECT_UPGRADER_COMPLETE=source cookiecutter_project_upgrader)"

For Zsh, please read the Click documentation.

Credits

The concept and some code is heavily based on https://github.com/senseyeio/cupper, with some changes to use Click and some flags and default values to ease usage. Also cleanup has been done and automated tests have been added.

This package was created with Cookiecutter and the thomasjahoda/cookiecutter-pypackage project template.

About

Update cookiecutter projects

License:MIT License


Languages

Language:Python 91.7%Language:Makefile 7.8%Language:Shell 0.5%