Metadata-Version: 2.1
Name: cnd-scaffold
Version: 2.1.1
Summary: Tools initiate a new project in git lab, based on a existing definition
Home-page: https://gitlab.com/changendevops/gitopstoolkit/cnd-scaffold.git
Author: Denis FABIEN
Author-email: denis.fabien@changendevops.com
License: MIT/X11
Project-URL: Documentation, https://changendevops.com
Project-URL: Source, https://gitlab.com/changendevops/gitopstoolkit/cnd-scaffold.git
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: mockito
Requires-Dist: mamba
Requires-Dist: expects
Requires-Dist: cndprint
Requires-Dist: pyyaml
Requires-Dist: requests
Requires-Dist: cndIo
Requires-Dist: yamale
Requires-Dist: twine
Requires-Dist: Jinja2

# CndScaffold

# Why use CndScaffold

CndScaffold is a python lib, designed to help management of GitOps process.
With CndScaffold, you need data and template definition and then CndScaffold do the magic and generate content

# New in 2.0.0
CndScaffold are now compatible with jinja2 engine (https://realpython.com/primer-on-jinja-templating/)

It allow use more complexe structure in file

# Requirements

This lib use 
- CndIo : This lib allow you to easilly push conten on gitlab/azuredevops or localfile
- CndPrint : This lib to manage display of alert message

# How to use it
```
source = {
	'project_id': 'gitlab-source-project-id',
	'definition': 'org-demo1_product1',
	'branch': 'main',
}
target = {
	'project_id': 'gitlab-target-project-id',
	'folder': 'home',
	'branch': 'main',
}

data_to_replace = {
	'env': ['alpha', 'gamma'],
	'client': [{'name': 'A', 'token': 'B'}, {'name': 'A', 'token': 'B'}],
	'app': 'beta',
	'abc': 'def',
	'yaml': {
		'abc': 'def',
		'ghi': ['jkl', 'lmo']
	}
}

level = "Trace"
_print = cndprint.CndPrint(level=level, silent_mode=True)
provider = cnd_io.CndProviderLocalfile(creds={}, print=_print)
cnd_io = cnd_io.CndIO(provider, print=_print)

self.cnd_scaffold = cnd_scaffold.CndScaffold(source, target, data_to_replace, cnd_io, print=_print)
self.cnd_scaffold.build()
```

# Usage with array of item with jinja2

in model file
```
module "acl-org-{{ app }}-{{ org_read.org_shortname }}" {
  source  = "./modules/acl-org"
  org = "{{ org_read.org }}"
  action = "read"
}
```

Example of data to works with model file
```
data_to_replace = {
	'app': 'beta',
	'org_read': {
		'org': 'def',
		'org_shortname': 'd'
	}
}
```
