Skip to main content

Jijna wrapper for file and directory transformation and injection

Project description

Jijna 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.0.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

jamurai-0.1.0-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

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