perun

Discuss perun static site generator
edannenberg 2016-11-10T02:23:45.000152Z

@bhagany relevant quote from the docs: As mentioned earlier Perun works by passing values from task to task. Most of Perun's tasks don't write files directly but instead add information to this value so that it can all be written to files at a later stage.

bhagany 2016-11-10T02:32:24.000153Z

@edannenberg: I think I understand that... but I'm not sure how it relates to my question about using a pod in the same manner as perun's built in tasks?

edannenberg 2016-11-10T02:34:25.000154Z

the point is you don't need a pod for what you are trying to accomplish, just run your task after the markdown task and use the passed fileset

bhagany 2016-11-10T02:35:02.000155Z

I think it would have to be before the markdown task, but okay. why do the built in tasks use pods, if they’re not necessary?

bhagany 2016-11-10T02:36:07.000156Z

I’m not using the filesystem (as in, a target dir) at all for this, fwiw, which is why I’m still not sure why you quoted that bit from the docs.

edannenberg 2016-11-10T02:37:21.000158Z

sorry for being cryptic, somewhat late here. was really just to point out to use the passed fileset instead of trying to do all the work again

edannenberg 2016-11-10T02:38:24.000159Z

https://github.com/Deraen/deraen.github.io/blob/blog/build.boot#L26 something like this task should to the trick

bhagany 2016-11-10T02:41:02.000161Z

no worries, and please don’t feel pressure to continue if you’d rather not due to lateness, or any other reason. My issue was that I started with the markdown task, since it does a superset of the work I need, and I wasn’t sure if I needed the pod that’s in there. I’ll try to continue without a pod. Thank you for your help.

edannenberg 2016-11-10T02:46:59.000162Z

yw, it looks all a bit complicated in the beginning but it's really just a long task pipeline that transforms the fileset

bhagany 2016-11-10T04:07:47.000163Z

ooooooookay, so this is… odd, but maybe it provides me with some insight into why pods are used -

bhagany 2016-11-10T04:07:56.000164Z

Here’s the entirety of build.boot:

(set-env!
 :source-paths #{"src" "content"}
 :resource-paths #{"resources"}
 :dependencies '[[pandeiro/boot-http "0.7.0"]
                 [adzerk/boot-cljs "1.7.228-2" :scope "test"]
                 [adzerk/boot-reload "0.4.12" :scope "test"]
                 [hiccup "1.0.5"]
                 [perun "0.3.0" :scope "test"]
                 #_[circleci/clj-yaml "0.5.5" :scope "test"]
                 [org.pegdown/pegdown "1.6.0" :scope "test"]])

(require '[adzerk.boot-cljs :refer [cljs]]
         '[pandeiro.boot-http :refer [serve]]
         '[adzerk.boot-reload :refer [reload]]
         '[io.perun :as p])

(deftask dev
  []
  (comp (serve :resource-root "public/")
        (watch)
        (p/markdown)
        (p/render :renderer 'nicerthantriton.core/dev-page)
        (reload :asset-path "/public")
        (cljs)
        (p/print-meta)))

bhagany 2016-11-10T04:08:36.000166Z

like this, I get the following output:

% boot dev
Starting reload server on <ws://localhost:63902>
Writing adzerk/boot_reload/init2725.cljs to connect to <ws://localhost:63902>...
2016-11-09 21:46:48.570:INFO::clojure-agent-send-off-pool-0: Logging initialized @19512ms
2016-11-09 21:46:48.725:INFO:oejs.Server:clojure-agent-send-off-pool-0: jetty-9.2.10.v20150310
2016-11-09 21:46:48.780:INFO:oejs.ServerConnector:clojure-agent-send-off-pool-0: Started ServerConnector@70ed13f1{HTTP/1.1}{0.0.0.0:3000}
2016-11-09 21:46:48.781:INFO:oejs.Server:clojure-agent-send-off-pool-0: Started @19723ms
Started Jetty on <http://localhost:3000>

Starting file watcher (CTRL-C to quit)...

[markdown] - parsed 1 markdown files
[render] - rendered 1 pages
Adding :require adzerk.boot-reload.init2725 to main.cljs.edn...
Compiling ClojureScript...
• public/js/main.js
({:content "&lt;p&gt;Super insightful placeholder text fills you with wonder and stretches your imagination. You &lt;em&gt;never&lt;/em&gt; &lt;strong&gt;&lt;em&gt;never&lt;/em&gt;&lt;/strong&gt; thought such bliss was possible. Synapses fire at an exponentially increasing rate. The entire &lt;a href=\"http://google.com?q=universe\"&gt;universe&lt;/a&gt; submits itself to your gaze as the &lt;em&gt;concerned looks&lt;/em&gt; on your loved ones' &lt;strong&gt;faces&lt;/strong&gt; fade to &lt;code&gt;black&lt;/code&gt;.&lt;/p&gt;\n&lt;pre&gt;&lt;code&gt;Maybe this is code? eh?\n&lt;/code&gt;&lt;/pre&gt;\n&lt;blockquote&gt;\n  &lt;p&gt;howdy mr blockquote&lt;/p&gt;\n&lt;/blockquote&gt;\n&lt;ul&gt;\n  &lt;li&gt;well,&lt;/li&gt;\n  &lt;li&gt;if it isn't&lt;/li&gt;\n  &lt;li&gt;an unordered list&lt;/li&gt;\n&lt;/ul&gt;",
  :extension "md",
  :filename "index.md",
  :full-path "/Users/brent/.boot/cache/tmp/www/nicerthantriton.com/199s/-grrwi1/index.md",
  :original true,
  :parent-path "",
  :path "index.md",
  :published #inst "2016-11-08T00:00:00.000-00:00",
  :short-filename "index",
  :tags ("Clojure" "Analemma"),
  :title "Something about Analemmas"})
Elapsed time: 17.048 sec

bhagany 2016-11-10T04:09:30.000167Z

If I uncomment the line [circleci/clj-yaml "0.5.5" :scope “test”], I get the following:

% boot dev
Starting reload server on <ws://localhost:63895>
Writing adzerk/boot_reload/init2725.cljs to connect to <ws://localhost:63895>...
2016-11-09 21:45:56.769:INFO::clojure-agent-send-off-pool-0: Logging initialized @19173ms
2016-11-09 21:45:56.892:INFO:oejs.Server:clojure-agent-send-off-pool-0: jetty-9.2.10.v20150310
2016-11-09 21:45:56.945:INFO:oejs.ServerConnector:clojure-agent-send-off-pool-0: Started ServerConnector@137c9bbc{HTTP/1.1}{0.0.0.0:3000}
2016-11-09 21:45:56.954:INFO:oejs.Server:clojure-agent-send-off-pool-0: Started @19359ms
Started Jetty on <http://localhost:3000>

Starting file watcher (CTRL-C to quit)...

[markdown] - parsed 1 markdown files
[render] - rendered 0 pages
Adding :require adzerk.boot-reload.init2725 to main.cljs.edn...
Compiling ClojureScript...
• public/js/main.js
()
Elapsed time: 18.500 sec

bhagany 2016-11-10T04:10:19.000168Z

So… it appears that simply including clj-yaml in my dependencies causes … um… something?

bhagany 2016-11-10T04:10:29.000169Z

I would really appreciate any insight.

bhagany 2016-11-10T12:40:12.000170Z

It occurs to me this morning that this is probably more of a boot problem. I’ll ask there.

martinklepsch 2016-11-10T13:35:30.000171Z

@bhagany I think the render functions passed to render and collection tasks get an argument that contains the list of all entries. That would probably be enough to render the sidebar you're describing

martinklepsch 2016-11-10T14:35:20.000172Z

@bhagany https://github.com/martinklepsch/martinklepsch.org/blob/master/src/org/martinklepsch/blog.clj#L129 this is passed to the render task

martinklepsch 2016-11-10T14:35:46.000174Z

https://github.com/martinklepsch/martinklepsch.org/blob/master/src/org/martinklepsch/blog.clj#L90 and I think this is used by the collection task

martinklepsch 2016-11-10T14:36:07.000176Z

so basically inspect the argument to your render functions and you may find what you're looking for

bhagany 2016-11-10T14:36:58.000177Z

ha! thank you. maybe I was blinded by my desire to write a task that wasn’t just a composition of other tasks.

bhagany 2016-11-10T14:37:03.000178Z

@martinklepsch ^

bhagany 2016-11-10T20:52:23.000179Z

Easy enough, once I just printed out the data passed to the render fn. thanks again.

bhagany 2016-11-10T20:53:56.000180Z

But of course I have another question. I'm looking for a way to set the content type of rendered files. Is this something that I should look for in perun, or is this more a concern of boot-http?