perun

Discuss perun static site generator
martinklepsch 2017-02-18T06:09:29.000438Z

@bhagany Resuming my perun-upgrading today… fixed the get-meta thing (turns out I don’t need it anymore) but now I run into the following...

martinklepsch 2017-02-18T06:10:42.000439Z

I need the rendered markdown in two places (one render and one collection task, e.g. the most recent article is on the index page)

martinklepsch 2017-02-18T06:11:35.000440Z

The render task however replaces the :content field of the the files metadata with the rendered HTML and so I think there’s no way for me to obtain the previous markdown rendering result

martinklepsch 2017-02-18T06:45:25.000443Z

On the plus side the new :io.perun/trace was quite helpful in figuring out what’s going wrong πŸ™‚

bhagany 2017-02-18T15:06:22.000444Z

@martinklepsch I think this can be fixed by reordering the tasks. If it is (markdown) (collection) (render) then collection and render will both see only the results from markdown. You may need to add a filterer to render though, to exclude the collection.

bhagany 2017-02-18T16:50:55.000445Z

Now that I'm a bit more awake, I have a few more bits of advice that are semi-related to the difficulty you're having. Previously, render functions had to go from unique content to completed page in one step. This meant that if you had things in common on each page, like the header and footer, you had to write separate functions for the common elements, and call them in each render function. In recent versions of Perun, you still can do this, but in my opinion, it's better to think of pages as having many layers, like an onion, and to build them from the inside out.

bhagany 2017-02-18T16:52:48.000446Z

So a simple example would be something like:

(comp
  (markdown)
  (collection :renderer 'render-collection-content)
  (render :renderer 'render-header))

bhagany 2017-02-18T16:56:28.000447Z

render-collection-content, produces content that's analogous to what markdown produces - that is, it's just a page fragment, not a complete html page. Then render-header adds the header to the markdown results and the collection results alike. Your render functions will end up being simpler as well.

bhagany 2017-02-18T17:04:24.000448Z

... I can't remember what my other bits of advice were. More coffee.

2017-02-18T17:35:32.000449Z

@bhagany I'm trying to follow up on your work (thanks again!) and upgrade our page from 0.3.0. I picked up from your [Merge Request](https://gitlab.com/200ok/200ok.gitlab.io/merge_requests/12/diffs) and had to uprade to 0.4.2-SNAPSHOT to get boot dev running. Otherwise it would not have found the new assortment task that you used. Now it stats and all pages are being built. So far so good(:

2017-02-18T17:36:19.000451Z

However, there are some regressions in how pages are built and I'm kinda stuck. The collection task seems to render post into the index page twice.

2017-02-18T17:37:14.000453Z

Compared to http://200ok.ch (where the old version still runs), there's two things: 1. Each post is rendered twice 2. Both renders are different and neither yields the post(;

2017-02-18T17:37:57.000454Z

As I can see from the new and awesome(!!) guides, the collection task shouldn't have changed for how we are using it. Do you have any hunch on what's going on?

bhagany 2017-02-18T17:38:29.000455Z

ah, I was probably using a local build that was still called 0.4.1-SNAPSHOT, apologies for that. I'll take a look at the rendering problems πŸ™‚

2017-02-18T17:39:35.000456Z

No need to apologize, you are incredibly helpful! Also, you don't have to fix the issue^^ I was just wondering on whether this might be a known thing and you can point me to the right direction(; I don't want to be lazy, I tried before I asked^^

bhagany 2017-02-18T17:40:16.000457Z

I don't have any good guesses off the cuff, and don't worry, I didn't think you were being lazy πŸ™‚

2017-02-18T17:40:44.000458Z

^^

2017-02-18T17:40:53.000459Z

I'll keep searching in parallel.

bhagany 2017-02-18T17:43:26.000460Z

@munen okay, I think I got it

bhagany 2017-02-18T17:44:04.000461Z

it's actually related to my random advice above - try moving the two render tasks after the assortment task, and see if that does what you expect (It looks good to me)

2017-02-18T17:45:32.000462Z

That was quick and looks perfect!

2017-02-18T17:46:04.000463Z

Seems like I have to keep up better with the good things that are said in this channel. I have to admit that I'm sometimes skimming and sometimes skipping it.

2017-02-18T17:46:13.000464Z

I'll read up to understand^^

bhagany 2017-02-18T17:46:49.000465Z

heh, I'm not sure if I'd have picked it up right away myself, if our roles were reversed. I learn a lot better by doing than by reading.

2017-02-18T17:48:08.000466Z

One last question that comes to mind: Will there be a '0.4.2' on Clojars, soon? Alternatively, do you plan new API changes in 0.4.2-SNAPSHOT before you do it? I'd be a little afraid to keep the -SNAPSHOT in the build file otherwise, because our page gets re-built on every change. This means that if the Perun API changes in the snapshot that we are targeting, this might yield a regression even though we only changed content.

bhagany 2017-02-18T17:50:52.000467Z

I think there are not many large API changes in the works anymore, but I definitely hear you on the snapshot builds in production. I think @podviaznikov would be open to doing a non-snapshot release soon, hopefully. In the meantime, I remember someone saying in #boot that there's a way to peg to a particular day's snapshot. googling that now...

2017-02-18T17:54:13.000468Z

That's good advice. Seems like this can be done with Maven: http://dev.clojure.org/display/community/Maven+Settings+and+Repositories

2017-02-18T17:54:18.000469Z

I'll try.

bhagany 2017-02-18T17:56:27.000470Z

yeah, I'm looking for a way to see the timestamp on the snapshot that's being used now. no luck yet

2017-02-18T17:59:36.000471Z

I found the timestamp, but boot will not find it later.

bhagany 2017-02-18T17:59:48.000472Z

huh, how did you find the timestamp?

2017-02-18T18:00:03.000473Z

In my ~/.m2 folder, I found perun-0.4.2-20170215.172730-2

bhagany 2017-02-18T18:00:16.000474Z

ah, that makes sense

2017-02-18T18:00:53.000475Z

➜  .m2 find . | ag perun
./repository/perun/perun/0.4.2-SNAPSHOT
./repository/perun/perun/0.4.2-SNAPSHOT/resolver-status.properties
./repository/perun/perun/0.4.2-SNAPSHOT/maven-metadata-clojars.xml.sha1
./repository/perun/perun/0.4.2-SNAPSHOT/perun-0.4.2-SNAPSHOT.jar
./repository/perun/perun/0.4.2-SNAPSHOT/perun-0.4.2-20170215.172730-2.pom
./repository/perun/perun/0.4.2-SNAPSHOT/perun-0.4.2-SNAPSHOT.pom
./repository/perun/perun/0.4.2-SNAPSHOT/perun-0.4.2-20170215.172730-2.jar
./repository/perun/perun/0.4.2-SNAPSHOT/maven-metadata-clojars.xml
./repository/perun/perun/0.4.2-SNAPSHOT/perun-0.4.2-20170215.172730-2.jar.sha1
./repository/perun/perun/0.4.2-SNAPSHOT/_maven.repositories
./repository/perun/perun/0.4.2-SNAPSHOT/perun-0.4.2-20170215.172730-2.pom.sha1
./repository/perun/perun/perun-0.4.2-SNAPSHOT
./repository/perun/perun/perun-0.4.2-20170215.172730

2017-02-18T18:01:36.000476Z

But neither perun-0.4.2-20170215.172730 nor perun-0.4.2-20170215.172730-2 seem to be ok for boot to find the snapshot on clojars on a new run.

bhagany 2017-02-18T18:03:23.000477Z

hmm, [perun "0.4.2-20170206.061747-1"] works for me, but obviously that's older...

bhagany 2017-02-18T18:04:08.000478Z

have you built perun locally?

2017-02-18T18:04:40.000479Z

No.

2017-02-18T18:05:28.000480Z

Your version works! Magic(;

2017-02-18T18:06:34.000481Z

With the knowledge on how to do a specific pin, I guess my question above is obsolete. Please continue doing leading edge and fast work and don't be afraid to break things^^

bhagany 2017-02-18T18:06:46.000482Z

that was the last non-local build I had

2017-02-18T18:06:50.000483Z

Thank you very much for your help, Sir!

bhagany 2017-02-18T18:07:22.000484Z

I just deleted the 0.4.2-SNAPSHOT folder and it pulled down [perun "0.4.2-20170215.172730-2"], which matches yours

2017-02-18T18:07:39.000485Z

Ah, let me try doing that.

bhagany 2017-02-18T18:07:49.000486Z

then, deleting the folder again and running with that dependency works for me as well

2017-02-18T18:09:12.000487Z

I confirm. This works!

bhagany 2017-02-18T18:09:25.000488Z

excellent πŸ™‚

2017-02-18T18:09:47.000489Z

Well, now I learned something about the Java/Clojure tooling that I have been using for years with other stacks. Feels interesting to be a beginner, again^^

bhagany 2017-02-18T18:10:07.000490Z

maven is full of mysteries πŸ™‚

2017-02-18T18:10:29.000491Z

The dinner I owe you grew today by at least one course!

bhagany 2017-02-18T18:11:05.000492Z

ha! it's been my pleasure

bhagany 2017-02-18T18:11:46.000493Z

although, if you hear about any good clojure jobs out there, passing those along will more than make up for any dinner πŸ™‚

bhagany 2017-02-18T18:12:30.000494Z

(the company I work for is going out of business, so it's been fun around here)

2017-02-18T18:17:52.000495Z

Oh, that's sad to hear. Well.. we are using Clojure and ClojureScript for our startup http://collecture.io and could (of course^^) make good use of another engineer. However, we are completely bootstrapped. Meaning everyone involved has a part-time job or a freelance gig to support himself. We don't want to take funding and build this business properly up. So if you're interested in having a talk on a business opportunity, let's talk. However, I'm a pragmatic non-bullshitter, so I'll be clear and say that it'll take a while before big bucks are rolling in. We already spent some money for freelancers (like 10k), but that was for a designer. If you're more interested in a job that pays immediately, I know a shop that needs good Clojure people. Unfortunately they require engineers to be located in Berlin. But I'll see those guys next week, maybe something could be arranged if I put in a good word. Otherwise I have no Clojure leads at the moment. I'm happy to be using it myself and would be happy to pay more engineers to do the same, but that'll take a little more time(;

bhagany 2017-02-18T18:20:32.000497Z

Thanks! If it were just me, I'd be looking for some higher-risk, lower-pay opportunities, but unfortunately my wife isn't of the same mind. That's probably a good thing while we have young kids πŸ™‚

bhagany 2017-02-18T18:21:56.000498Z

As for Berlin, I'm probably going to look for remote opportunities first, but if we're going to move anyway, Berlin sounds better to me than New York or San Francisco. So I'd be open to it, but probably not immediately.

2017-02-18T18:22:52.000499Z

I understand. Well, if you were interested to locate to Switzerland (there's certainly Clojure jobs that I'm not aware of, because I'm not searching), there's one more thing that I can offer. We do have a huge house in the Swiss mountains with a nice garden and rooms to spare. If you wanted a place to stay to look around and not loose money for having a bed, you're welcome any time!

bhagany 2017-02-18T18:23:20.000500Z

wow! that sounds fantastic

pesterhazy 2017-02-18T18:23:24.000501Z

if you come to Berlin, give us a shout, you could do a talk about Perun at Clojure Berlin πŸ™‚

bhagany 2017-02-18T18:23:41.000502Z

nice πŸ™‚ I'll do that

pesterhazy 2017-02-18T18:24:23.000503Z

@munen out of curiosity, which Berlin company do you mean?

bhagany 2017-02-18T18:24:26.000504Z

everyone in this community is so welcoming, it's great

2017-02-18T18:28:07.000506Z

@pesterhazy I apologize, my brain seems to need to take a break. I'll see the guys next week in Berlin, but they actually are located in Hamburg!

2017-02-18T18:28:25.000507Z

It's the Otto web shop I was referring to.

2017-02-18T18:31:40.000508Z

Regarding Switzerland, especially Zurich, it's not uncommon to work remotely and have the same benefits like a Swiss local worker. However it's beneficial to be here in person to actually get the job if you don't know someone already.

2017-02-18T18:32:42.000510Z

At least that's what I've seen the last years in the Ruby and JS community. Could be that Clojure is different. Maybe depending on whether it's a younger company (then it'll be easy) or a monolith that rebuilds some Cobol into Clojure (then it'll probably be harder/impossible to work remote).

pesterhazy 2017-02-18T18:41:46.000511Z

ah yes, I've heard that Otto has a Clojure team before

pesterhazy 2017-02-18T18:46:21.000512Z

@bhagany do consider Berlin, it's (still) a laid back place with a friendly Clojure community

2017-02-18T18:46:55.000513Z

They do have multiple teams and each team can decide their stack afaik.

pesterhazy 2017-02-18T18:47:10.000514Z

and family friendly - it's a lot easier to find a larger apartment than in SF or NYC I'm sure

bhagany 2017-02-18T18:47:26.000515Z

I'm sure it is!

2017-02-18T18:47:49.000516Z

They also did sponsor EuroClojure where I met them last. They had four people down there, too. I have a good friend from back in the day in one of those Clojure teams.

bhagany 2017-02-18T18:50:43.000517Z

Not to change the subject, but just so you know @jjttjj, I am still working on the windows compatibility. Turns out it is more than just separators, as you said. And @munen your tip about the vm's has come in handy.

2017-02-18T18:51:02.000518Z

You're welcome^^

2017-02-18T18:53:21.000519Z

@bhagany awesome thanks! Sorry, I never got around to submitting anything anywhere since I didn't think anything was worth submitting at my current level of understanding! Basically what all I did was

(def file-separator (System/getProperty "file.separator"))
(def file-separator-regex (re-pattern
                           (java.util.regex.Pattern/quote
                            file-separator)))
and reference those throughout perun.core but that definitely wasn't a complete solution

bhagany 2017-02-18T18:54:37.000520Z

no worries, that was about my level of understanding until last night as well πŸ˜‰ not that it's really advanced much beyond "wtf" yet...

bhagany 2017-02-18T18:55:27.000521Z

I didn't know about java.util.regex.Pattern/quote, that's better than my solution

bhagany 2017-02-18T20:23:33.000522Z

@jjttjj are you able to build a version of Perun locally? I have a branch that passes all tests on Windows