perun

Discuss perun static site generator
Petrus Theron 2016-12-26T10:39:11.000006Z

Anyone around still using Perun? I’m struggling to get it going even though I followed the Getting Started page.

pesterhazy 2016-12-26T11:50:04.000007Z

@petrus I'm using it right now

pesterhazy 2016-12-26T11:50:44.000008Z

just discovered there hasn't been a release since Jan. It'd be great to get a new version out guys! (I'm interested in render's meta options)

Petrus Theron 2016-12-26T11:51:50.000009Z

I’m getting this error:

❯ boot dev                                                                                                                                                                                    [13:27:49]
             clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: option :renderer must be of type sym
    data: {:file
           "/var/folders/8j/27sz_2rj0kd1b3v9y4n1_1t00000gn/T/boot.user1717875104820046032.clj",
           :line 29}
with this simple definion of renderer:
(defn renderer [{global :meta posts :entries post :entry}] (:name post))

(deftask build-dev
  "Build blog but don't push anywhere. Todo: combine this with prod."
  []
  (comp (markdown)
    (render :renderer renderer)
    (notify)))
But I can run ❯ boot serve --resource-root public markdown render -r site.core/page wait when site.core/page is a fn.

Petrus Theron 2016-12-26T11:52:11.000010Z

Have tried (render :renderer ‘#renderer) but no luck

pesterhazy 2016-12-26T11:53:00.000011Z

try 'site.core/page

Petrus Theron 2016-12-26T11:55:41.000012Z

Is there a way I can keep boot “running” so I don’t have to wait for the JVM? I.e. run boot tasks from REPL

pesterhazy 2016-12-26T11:55:52.000013Z

yeah

pesterhazy 2016-12-26T11:55:56.000014Z

do boot repl

pesterhazy 2016-12-26T11:56:07.000015Z

than call (boot "dev") etc

Petrus Theron 2016-12-26T11:56:49.000016Z

Ok so 'render-fn almost works. I’m getting:

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

[markdown] - parsed 1 markdown files
java.lang.AssertionError: Assert failed: (namespace sym)
              io.perun/render-in-pod     perun.clj:  374
          io.perun/eval2147/fn/fn/fn     perun.clj:  403
          io.perun/eval1651/fn/fn/fn     perun.clj:  116
boot.task.built-in/fn/fn/fn/fn/fn/fn  built_in.clj:  264
   boot.task.built-in/fn/fn/fn/fn/fn  built_in.clj:  264
      boot.task.built-in/fn/fn/fn/fn  built_in.clj:  261
                 boot.core/run-tasks      core.clj:  794
                   boot.core/boot/fn      core.clj:  804
 clojure.core/binding-conveyor-fn/fn      core.clj: 1916
                                 ...
Elapsed time: 0.426 sec

Petrus Theron 2016-12-26T11:56:58.000017Z

using (render :renderer 'page)

pesterhazy 2016-12-26T11:57:08.000018Z

like I told you

pesterhazy 2016-12-26T11:57:17.000019Z

'your.namsepace/page

Petrus Theron 2016-12-26T11:57:30.000020Z

I have it defined in the build.boot namespace

Petrus Theron 2016-12-26T11:57:44.000021Z

Is there a name for the “local” namespace?

Petrus Theron 2016-12-26T11:58:04.000023Z

(defn page [data]
  (html5
    [:div {:style "max-width: 900px; margin: 40px auto;"}
     [:h2 "tstsrt"]
     (-> data :entry :content)]))

(deftask build-dev
  "Build blog but don't push anywhere. Todo: combine this with prod."
  []
  (comp (markdown)
    (render :renderer 'page)
    (notify)))

pesterhazy 2016-12-26T11:58:50.000024Z

'boot.user/page

pesterhazy 2016-12-26T11:59:02.000025Z

but not sure if that works, given that it's going to be run in a pod

Petrus Theron 2016-12-26T11:59:03.000026Z

ahh

pesterhazy 2016-12-26T11:59:11.000027Z

may be better to use a separate ns for that

Petrus Theron 2016-12-26T11:59:12.000028Z

yayyy

Petrus Theron 2016-12-26T11:59:36.000029Z

voila. working! Now if only I can inject a boot-reload websocket thing to reload the page on render...

pesterhazy 2016-12-26T11:59:42.000030Z

hah

pesterhazy 2016-12-26T11:59:44.000031Z

I just did that

pesterhazy 2016-12-26T11:59:50.000032Z

hang on

Petrus Theron 2016-12-26T12:00:04.000033Z

I’m getting the notify OSX alerts

pesterhazy 2016-12-26T12:00:15.000034Z

check my set up: https://github.com/pesterhazy/presumably/blob/master/build.boot

pesterhazy 2016-12-26T12:00:53.000036Z

it automatically reloads when you update an md file, or even css file

Petrus Theron 2016-12-26T12:01:18.000037Z

Awesome! I also ran into this: https://github.com/hashobject/perun/issues/127

Petrus Theron 2016-12-26T12:01:27.000039Z

I see you’re calling sync-bucket

pesterhazy 2016-12-26T12:02:53.000040Z

it's confetti

Petrus Theron 2016-12-26T12:02:55.000041Z

Is weasel for the reload websocket, or something else?

pesterhazy 2016-12-26T12:03:14.000042Z

weasel is for the example projects, not needed

pesterhazy 2016-12-26T12:03:39.000043Z

I also include the code examples in the blog source, in example-src

Petrus Theron 2016-12-26T12:04:02.000044Z

cool. how are you using reagent in your static site?

pesterhazy 2016-12-26T12:04:21.000045Z

I'm not

Petrus Theron 2016-12-26T12:04:25.000046Z

ah, ok

pesterhazy 2016-12-26T12:04:27.000047Z

some of the examples are based on reagent

pesterhazy 2016-12-26T12:04:49.000048Z

also boot-reload was easier to than boot-livereload

pesterhazy 2016-12-26T12:05:01.000049Z

well, "easy" is relative

Petrus Theron 2016-12-26T12:05:35.000050Z

where are you injecting the JS to reload on the boot trigger?

Petrus Theron 2016-12-26T12:05:46.000051Z

(busy looking through https://github.com/pesterhazy/presumably/blob/master/src/site/core.clj)

pesterhazy 2016-12-26T12:07:28.000053Z

look for include-js

pesterhazy 2016-12-26T12:10:35.000054Z

I'm going out for a Christmas walk, but will be back later

pesterhazy 2016-12-26T12:11:14.000055Z

it's weird that you can't pass any arguments to your render fn from build.boot

Petrus Theron 2016-12-26T12:12:03.000056Z

Is it possible to use boot-reload without ClojureScript?

Petrus Theron 2016-12-26T12:12:11.000057Z

thanks for the help, @pesterhazy

pesterhazy 2016-12-26T12:12:17.000058Z

I don't think so...

pesterhazy 2016-12-26T14:59:27.000059Z

@petrus, I've pushed a change to my repo to have a dev version (with reloading) and prod version (without)

martinklepsch 2016-12-26T15:40:10.000060Z

@pesterhazy did you choose env vars over the .edn file intentionally

pesterhazy 2016-12-26T15:40:31.000061Z

why env vars @martinklepsch ?

martinklepsch 2016-12-26T15:40:55.000062Z

@pesterhazy sorry, lack of context hehe, referring to this: https://github.com/pesterhazy/presumably/blob/master/build.boot#L44-L46

pesterhazy 2016-12-26T15:41:20.000064Z

ah, yes

pesterhazy 2016-12-26T15:41:31.000065Z

I like to have all my credentials in a .envrc

pesterhazy 2016-12-26T15:41:43.000066Z

it's a very nice setup

martinklepsch 2016-12-26T15:42:10.000067Z

cool, what's that?

martinklepsch 2016-12-26T15:42:24.000068Z

is that read into the env upon cd

pesterhazy 2016-12-26T15:44:36.000069Z

yes, it's a revelation. I use it for every project now

pesterhazy 2016-12-26T15:44:48.000070Z

https://direnv.net/

pesterhazy 2016-12-26T15:45:27.000071Z

it's great for teams too, where everyone can use their own AWS key, customizations etc.

martinklepsch 2016-12-26T15:52:39.000072Z

that's pretty cool indeed

martinklepsch 2016-12-26T15:55:07.000073Z

Think I heard about it before but somehow thought it would be incompatible with fish. But seems it supports a bunch of shells

pesterhazy 2016-12-26T15:57:11.000074Z

it does

martinklepsch 2016-12-26T16:10:38.000075Z

it's written in go though? A program for setting env vars? 😄

pesterhazy 2016-12-26T16:11:23.000076Z

it's the future man, go with the flow

martinklepsch 2016-12-26T16:12:38.000077Z

😂

pesterhazy 2016-12-26T16:26:39.000078Z

It's published! http://presumably.de/reagent.html

2016-12-26T17:49:20.000079Z

@pesterhazy: very elegant design