Contribution¶
Development Guidelines¶
Please have a look at our handbook:technical-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 wordDo not add the word
blueprintto 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} BlueprintLower Case:
{name} blueprintUpper Case:
{NAME} BLUEPRINTCamel Case:
{name}BlueprintPascal Case:
{Name}BlueprintLower Snake Case:
{name}_blueprintUpper Snake Case:
{NAME}_BLUEPRINTLower Kebap Case:
{name}-blueprintUpper 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:
From the blueprint defined in
<blueprint root>/.blueprint-cloner/namespaceFrom 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().