finanalyst / rakuast-rakudoc-render

Renders RakuDoc from RakuAst statement list
Artistic License 2.0
0 stars 1 forks source link

modifying RenderDocs #2

Open finanalyst opened 1 month ago

finanalyst commented 1 month ago
          This installs dependencies via `zef`, but it doesn't quite work yet as a "containerized executable" for the `bin/RenderDocs` script.

It would also be good if you could modify your assumptions in the multi sub MAIN that accepts two parameters. Specifically here

render-files([$file,], '.', :$to)

We need to be able to accept absolute paths here and not make assumptions about the names of directories, where they're run, names of input files, etc.

For example, I cloned your example rakudoc repo and ran this

podman run -w /opt/rakuast-rakudoc-render -v $PWD:/src --rm localhost/rakuast-rakudoc-render:latest RenderDocs /src/docs/README
Processing 「.//src/docs/README.rakudoc」 to 「/src/docs/README.md」
Could not open .//src/docs/README.rakudoc. Failed to stat file: no such file or directory

/src/docs/README.rakudoc is a valid path in the container because I've mounted it there. But it's unclear how to target it.

Originally posted by @dontlaugh in https://github.com/finanalyst/rakuast-rakudoc-render/issues/1#issuecomment-2227119115

finanalyst commented 1 month ago

@dontlaugh Modified RenderDocs as in PR #1 . Try running raku -I. bin/RenderDocs -h to get Usage

finanalyst commented 1 month ago

@dontlaugh After modifying, I ran podman build ... as you specified. Then

$ podman run -w /opt/rakuast-rakudoc-render -v $PWD:/src --rm localhost/rakuast-rakudoc-render:latest RenderDocs

Got expected response:

Documents with .md in CWD, but not in docs/ : (TODO)

So now I think there is a file /src/README.md in the container. Not sure how to get at it.

dontlaugh commented 1 month ago

This sets the working directory

-w /opt/rakuast-rakudoc-render 

And -v mounts in $PWD from the host into /src in the container. You can specify -v multiple times.

Try providing more flags to RenderDocs like --src=/src/docs (or similar).

Note that -v $PWD:/src, since it's a mount from the host, will mean that any /src/README.md file that is generated will end up on your host at $PWD/README.md. -v gives you a read/write mount by default, and the processes in the container can write files to the left-hand side of the :, e.g. $PWD:/whatever