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.4.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jamurai-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 ada09b5c6a03b550cdc1ca3d1fc4ddbdfd0a2e828986ae4e6597598ccafb4d57
MD5 e8db8d9680f4b1250574df595fce3a7e
BLAKE2b-256 79e07729c2eccdb8b1c13cb5929878e981d4cb870df35b068900a4aa80998c94

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jamurai-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9336998952dfc281bb1177d60132eb150ad801d4f537adb6e5217869a317a278
MD5 a9a7b3e7b6b41249c386edd0a2b24266
BLAKE2b-256 cb60eeecf5c2eef2d9dc608fdab5a0e578bc0cdada6645889ddf3e96a1d203bc

See more details on using hashes here.

Supported by

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