from pathlib import Path


configfile: "config.yaml"

rule all:
    input:
        "test.out",
        "test.html",
        "rel_source.out",
        "julia.out",
        "rust.out",
        "rust-manifest.out",
        "rust-outer-line-doc.out",
        "bash.out",

rule:
    input:
        "test.in"
    output:
        txt="test.out"
    params:
        xy=True
    conda:
        "envs/r.yaml"
    script:
        "scripts/test.R"

rule:
    output:
        "test.in"
    script:
        Path("scripts/test.py")

rule:
    output:
        "test.html"
    params:
        test="testparam"
    conda:
        "envs/r.yaml"
    script:
        "scripts/test.Rmd"

rule:
    output:
        "rel_source.out"
    conda:
        "envs/r.yaml"
    script:
        "scripts/rel_source.R"

rule:
    input:
        "test.in",
        named_input="test.in"
    output:
        "julia.out"
    params:
        integer=123
    conda:
        "envs/julia.yaml"
    script:
        "scripts/test.jl"

rule:
    input:
        "test.in",
        "test2.in",
        ["test.in", "test2.in"],
        named_input="test.in",
    output:
        "rust.out",
    params:
        integer=123
    conda:
        "envs/rust.yaml"
    script:
        "scripts/test.rs"

rule:
    output:
        "rust-manifest.out",
    params:
        keep="-"
    conda:
        "envs/rust.yaml"
    log:
        "rust-manifest.log"
    script:
        "scripts/test-manifest.rs"

rule:
    output:
        "rust-outer-line-doc.out",
    params:
        keep="-",
    conda:
        "envs/rust.yaml"
    script:
        "scripts/test-outer-line-doc.rs"


rule bash:
    input:
        "test2.in",
        named_input="test.in",
    output:
        "bash.out"
    params:
        integer=123,
        string="foo",
        d={"a": "foo"}
    resources:
        mem_mb=1024
    log:
        "bash.log"
    conda:
        "envs/bash.yaml"
    script:
        "scripts/test.sh"
