Fork me on GitHub
#perun
<
2017-02-18
>
martinklepsch06:02:29

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

martinklepsch06:02:42

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)

martinklepsch06:02:35

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

martinklepsch06:02:25

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

bhagany15:02:22

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

bhagany16:02:55

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.

bhagany16:02:48

So a simple example would be something like:

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

bhagany16:02:28

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.

bhagany17:02:24

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

munen17:02:32

@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(:

munen17:02:19

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.

munen17:02:14

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(;

munen17:02:57

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?

bhagany17:02:29

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 🙂

munen17:02:35

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

bhagany17:02:16

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

munen17:02:53

I'll keep searching in parallel.

bhagany17:02:26

@munen okay, I think I got it

bhagany17:02:04

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)

munen17:02:32

That was quick and looks perfect!

munen17:02:04

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.

munen17:02:13

I'll read up to understand^^

bhagany17:02:49

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.

munen17:02:08

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.

bhagany17:02:52

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

munen17:02:13

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

munen17:02:18

I'll try.

bhagany17:02:27

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

munen17:02:36

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

bhagany17:02:48

huh, how did you find the timestamp?

munen18:02:03

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

bhagany18:02:16

ah, that makes sense

munen18:02:53

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

munen18:02:36

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.

bhagany18:02:23

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

bhagany18:02:08

have you built perun locally?

munen18:02:28

Your version works! Magic(;

munen18:02:34

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

bhagany18:02:46

that was the last non-local build I had

munen18:02:50

Thank you very much for your help, Sir!

bhagany18:02:22

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

munen18:02:39

Ah, let me try doing that.

bhagany18:02:49

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

munen18:02:12

I confirm. This works!

bhagany18:02:25

excellent 🙂

munen18:02:47

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

bhagany18:02:07

maven is full of mysteries 🙂

munen18:02:29

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

bhagany18:02:05

ha! it's been my pleasure

bhagany18:02:46

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

bhagany18:02:30

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

munen18:02:52

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(;

bhagany18:02:32

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 🙂

bhagany18:02:56

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.

munen18:02:52

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!

bhagany18:02:20

wow! that sounds fantastic

pesterhazy18:02:24

if you come to Berlin, give us a shout, you could do a talk about Perun at Clojure Berlin 🙂

bhagany18:02:41

nice 🙂 I'll do that

pesterhazy18:02:23

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

bhagany18:02:26

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

munen18:02:07

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

munen18:02:25

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

munen18:02:40

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.

munen18:02:42

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

pesterhazy18:02:46

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

pesterhazy18:02:21

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

munen18:02:55

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

pesterhazy18:02:10

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

bhagany18:02:26

I'm sure it is!

munen18:02:49

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.

bhagany18:02:43

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.

munen18:02:02

You're welcome^^

jjttjj18:02:21

@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

bhagany18:02:37

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

bhagany18:02:27

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

bhagany20:02:33

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