Jinja wrapper for file and directory transformation and injection
Project description
Jinja wrapper for file and directory transformation and injection
As a single content:
import os
import yaml
import jamurai
with open("/tmp/from.txt", "w") as from_file:
from_file.write("{{ foo }}")
content = {
"source": "from.txt",
"destination": "to.txt"
}
values = {
"foo": "bar"
}
jamurai.build(content, values, "/tmp")
with open("/tmp/to.txt", "r") as to_file:
data = to_file.read()
data
# "bar"
For multiple content:
machine = jamurai.Machine("/tmp")
with open("/tmp/this.txt", "w") as from_file:
from_file.write("{{ this }}")
with open("/tmp/that.txt", "w") as from_file:
from_file.write("{{ that }}")
contents = [
{
"source": "this.txt",
"destination": "these.txt"
},
{
"source": "that.txt",
"destination": "those.txt"
}
]
values = {
"this": "yin",
"that": "yang"
}
for content in contents:
machine.build(content, values)
with open("/tmp/these.txt", "r") as to_file:
data = to_file.read()
data
# "yin"
with open("/tmp/those.txt", "r") as to_file:
data = to_file.read()
data
# "yang"
Look at the content docs at the ‘CnC Forge https://github.com/gaf3/cnc-forge/blob/main/Output.md#content’_
The only difference is the base is the same direcctory unlike transforming from one repo to enother.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jamurai-0.1.3.tar.gz.
File metadata
- Download URL: jamurai-0.1.3.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad838a2f7695460eb777d6e657e4b83489a1c1204c8e046c8d33a92a075d5227
|
|
| MD5 |
3fe36ad01a63cf7dc9ae2431c5e46894
|
|
| BLAKE2b-256 |
31516411c2b5c5ac77ac1ca7aa1a3bf2176d165175e42dfec2fa2bddd55c5a43
|
File details
Details for the file jamurai-0.1.3-py3-none-any.whl.
File metadata
- Download URL: jamurai-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65cdf4d09616204c72b4ea9637fa099d9b92ac0118277ea03d0b87ee98df6c48
|
|
| MD5 |
350442738a1d1e91cd0c4733d5d13e5f
|
|
| BLAKE2b-256 |
c054db4ef356c886f28eb121d12b443fe485e910e4af042a15e0a1ab14a64efe
|