Contribution

Development Guidelines

Please have a look at our Development guidelines when contributing to this project.

Blueprint Development

Create New Blueprint

Since the Blueprint Cloner only depends on Git(Lab) projects for blueprints, you only have to:

  • Create a new Git project in the Blueprints GitLab group

  • Ensure the project path is lower-kebap-cased (i.e. foo-bar), at best a single word

  • Do not add the word blueprint to the project path

As soon as the project is created, the Blueprint Cloner should work. Add some files & directories and they will automatically be cloned.

Substitutions

Most of the time, the project’s name is used in several files within the project itself (e.g. in variables), or even in filenames or directories. Since renaming / refactoring this can be a PITA, the Blueprint Cloner will do the substitutions for you as well.

The substitution works like “magic”, you simply have to use the correct formats, such as:

  • Title Case: {Name} Blueprint

  • Lower Case: {name} blueprint

  • Upper Case: {NAME} BLUEPRINT

  • Camel Case: {name}Blueprint

  • Pascal Case: {Name}Blueprint

  • Lower Snake Case: {name}_blueprint

  • Upper Snake Case: {NAME}_BLUEPRINT

  • Lower Kebap Case: {name}-blueprint

  • Upper Kebap Case: {NAME}-BLUEPRINT

Please note you’ve to replace the {name} placeholder in your blueprint. The {name} must match the name of the blueprint project.

See also

As an example, have a look at the blueprint_cloner.cloner.Cloner.build_names_and_substitutes() method to see how the substitutions work for a blueprint called example and a project named Foo Bar.

Default Namespace

When a new GitLab project is created, the user can specify an explicit GitLab namespace. However, if the user doesn’t explicitly define one, a default namespace is looked in the following order:

  1. From the blueprint defined in <blueprint root>/.blueprint-cloner/namespace

  2. From the cloner defaults defined in blueprint_cloner.settings.DEFAULT_NAMESPACE

See also

The lookup of the default namespace happens in blueprint_cloner.cloner.Cloner.load_default_namespace().

Post Scripts

You might want to execute some extra steps after cloning a blueprint. The Blueprint Cloner will enable you to do that via custom blueprint post scripts. Simply copy the post scripts to the <blueprint>/.blueprint-cloner/post.d/ directory and ensure they’re executable.

See also

The execution of the post scripts happens in blueprint_cloner.cloner.Cloner.run_post_scripts().