Fork me on GitHub
#perun
<
2016-11-10
>
edannenberg02:11:45

@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.

bhagany02:11:24

@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?

edannenberg02:11:25

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

bhagany02:11:02

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?

bhagany02:11:07

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.

edannenberg02:11:21

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

bhagany02:11:02

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.

edannenberg02:11:59

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

bhagany04:11:47

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

bhagany04:11:56

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)))

bhagany04:11:36

like this, I get the following output:

% boot dev
Starting reload server on 
Writing adzerk/boot_reload/init2725.cljs to connect to ...
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 

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 "<p>Super insightful placeholder text fills you with wonder and stretches your imagination. You <em>never</em> <strong><em>never</em></strong> thought such bliss was possible. Synapses fire at an exponentially increasing rate. The entire <a href=\"http://google.com?q=universe\">universe</a> submits itself to your gaze as the <em>concerned looks</em> on your loved ones' <strong>faces</strong> fade to <code>black</code>.</p>\n<pre><code>Maybe this is code? eh?\n</code></pre>\n<blockquote>\n  <p>howdy mr blockquote</p>\n</blockquote>\n<ul>\n  <li>well,</li>\n  <li>if it isn't</li>\n  <li>an unordered list</li>\n</ul>",
  :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

bhagany04:11:30

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

% boot dev
Starting reload server on 
Writing adzerk/boot_reload/init2725.cljs to connect to ...
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 

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

bhagany04:11:19

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

bhagany04:11:29

I would really appreciate any insight.

bhagany12:11:12

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

martinklepsch13:11:30

@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

martinklepsch14:11:07

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

bhagany14:11:58

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

bhagany20:11:23

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

bhagany20:11:56

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?