daux.io icon indicating copy to clipboard operation
daux.io copied to clipboard

Separate "generate" and "upload" steps for remote platforms like confluence - Cannot get processor to work.

Open KoenDG opened this issue 4 years ago • 6 comments

Is your feature request related to a problem? Please describe. Inspired by this issue: https://github.com/dauxio/daux.io/issues/264

Since the "generate" commands not only generates, but also uploads, there's no chance to potentially fix the HTML if need be. There's always going to be an edge case that a general purpose parser won't catch, that the person can deal with in terms of the project they're working on.

Describe the solution you'd like The "generate" step no longer performing an upload, only writing resulting HTML files to disk. The upload step being split into its own step, preferably with a configurable location, which can then be pointed at the generated files.

KoenDG avatar Jun 14 '21 16:06 KoenDG

Hi, the current model of Daux wouldn't work with what you propose.

I can consider adding a method to extensions to change the content before publishing, would that work for you ?

I'll check also on how to fix #264

onigoetz avatar Jun 15 '21 19:06 onigoetz

Hello, sorry for the delay on this.

When you say "Method to extensions to change the content before publishing", what exactly do you mean?

Running via the docker container, how would one do this?

KoenDG avatar Jun 21 '21 13:06 KoenDG

It can be done by mounting a folder containing the processors (https://daux.io/For_Developers/Creating_a_Processor.html) as a docker volume.

I do it for my own projects when I want to add some information to a project through front_matter or something like this.

onigoetz avatar Jun 21 '21 16:06 onigoetz

Hello, me again.

I've had a bit of time to look into this processor business and am running into the problem that the Processor.php file can not be found.

So, using the steps from this page: https://daux.io/For_Developers/Creating_a_Processor.html

Could not get the dump of the array.

The project I'm working on is set up to generate the markdown files and put them all in subfolders in a directory, let's call it dist/

There's several subdirectories under here, basically like this:

dist | --dir1 | --dir2 | --dir3 | --dir4 | --dir5

And each dir has markdown files in it.

Considering that this was the top-level directory, and becomes /build inside the container, I put daux/Processor.php in there.

Then, I tried running this:

docker run --rm -w /build -v dist:/build daux/daux.io daux generate -s . --format confluence --processor=Processor

And it gave me:

In Daux.php line 163:
                                                                                          
  Class '\Todaymade\Daux\Extension\Processor' not found. We cannot use it as a Processor  
                                                                                          
generate [-c|--configuration CONFIGURATION] [-s|--source SOURCE] [-p|--processor PROCESSOR] [--no-cache] [-t|--themes THEMES] [--value VALUE] [-f|--format FORMAT] [--delete] [-d|--destination DESTINATION]

Where should I put this Processor?

KoenDG avatar Jul 04 '21 12:07 KoenDG

Everything seems correct in what you describe, except one thing; the volume mapping in the Docker run

-v dist:/build means you are only mounting the dist folder.

There are two things I might have misunderstood.

  • Did you put the processor in dist/daux/Processor.php ? The daux directory should be relative to the current working directory, in this case /build in the container.
  • I'm never sure how Docker treats relative volume paths, I personally prefer using absolute paths : -w /build -v "$PWD":/build

If that all is done as described, one thing that might not work is the namespace of the Processor.php file. you can try to add an echo "test"; next to the class to see if the file is even loaded by Daux and it's just a wrong namespace;

onigoetz avatar Jul 09 '21 21:07 onigoetz

I had some time to test this and got it working. That being: it no longer gives an error and instead prints the tree, as stated by the documentation.

As you said, it was an issue with pathing.

Once I fixed that, there was still an error.

I read the documentation again and saw the line: By default, we created a daux/Processor.php file to get you started.

Now, using the docker container, which gets deleted after running, I didn't know about this default file. I went and checked the default file here on github and copied the contents from that.

For completeness, I mean this file: https://github.com/dauxio/daux.io/blob/master/daux/Processor.php

Running it again like that, I got tree, as described by the documentation.

I'd like to humbly request the link to that file be included in the documentation. Currently only a part of it is present.

There was some confusion there, PHP isn't something I've used professionally since 2011, but I got there after checking that default file.

So, thank you kindly for your time and effort. I've updated the title to reflect the content of the conversation a bit more. Here's hoping others with the same issue will find this.

KoenDG avatar Jul 10 '21 19:07 KoenDG