Skip to main content

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

jamurai-0.1.2.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

jamurai-0.1.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file jamurai-0.1.2.tar.gz.

File metadata

  • Download URL: jamurai-0.1.2.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

Hashes for jamurai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 926e0c53446d243d73d308336941d55ff5be4d9c4b65f1ecc6c00a77ffe904f2
MD5 428b7ae4a69adb6a5151ce2c34bb127b
BLAKE2b-256 ce1db88831ece0bf88b0f59cb488136398279f28dbadd1fabfc721b52e0b0fa8

See more details on using hashes here.

File details

Details for the file jamurai-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: jamurai-0.1.2-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

Hashes for jamurai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 69bf25485f14a5984ff06290bee05b1023a2be42f82652017a1c141564fefb33
MD5 540cd9d369d1081782e7084be76420a5
BLAKE2b-256 dc868a6efe8336143bf9010a4f47fc22a0bcbf44b662cda7da2d3b1bdce93f5b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page