perun

Discuss perun static site generator
martinklepsch 2017-02-28T05:18:26.000662Z

@podviaznikov idea basically stems from having one track of each kind/artist, not sure how practical that will be but ¯\(ツ)

podviaznikov 2017-02-28T19:03:27.000739Z

martinklepsch: interesting. I once built for myself kinda radio based on soundcloud. So everyone who is on the page would listen to the same songs as everyone else. Different from your idea though

martinklepsch 2017-02-28T19:07:56.000741Z

Yeah, more thinking of this as some kind of library. I’ve always starred/favorited lots of tracks on SoundCloud/Spotify and I want that information to be preserved no matter the platform that I’m using

martinklepsch 2017-02-28T07:44:07.000663Z

Can’t figure out how to use content-task properly It’s not clear to me what the individual functions need to return — some schema type checks would go a long way. Maybe add some truss assertions https://github.com/ptaoussanis/truss ?

bhagany 2017-02-28T13:11:33.000665Z

@martinklepsch unfortunately the returns for most of the functions that content-task takes are too open for an assertion to help you out very much. The docstring for content-task is a bit terse though, and I can expand it. Briefly though, for your use-case, :render-form-fn returns a form that will be called in a pod (via boot/with-call-in), and :paths-fn should probably be the same one you used for render-task.

bhagany 2017-02-28T13:14:29.000666Z

The namespace-qualified function that render-form-fn returns is responsible for rendering a single file. It should return a map of metadata that will get set on the file, and the :rendered key of that map should be a string that contains the rendering result.

bhagany 2017-02-28T13:15:40.000667Z

You can ignore :passthru-fn for your use-case

bhagany 2017-02-28T13:17:40.000668Z

If an example would be easier to follow, there are several in perun.clj. I think atom-feed is the closest to your use-case: https://github.com/hashobject/perun/blob/master/src/io/perun.clj#L1090

martinklepsch 2017-02-28T13:29:42.000670Z

@bhagany they might be open but still at some point some other piece expects something at :rendered etc

bhagany 2017-02-28T13:31:42.000671Z

:rendered isn't expected really, it's just handled specially

bhagany 2017-02-28T13:32:36.000672Z

there are tasks that don't use it

martinklepsch 2017-02-28T13:33:01.000673Z

(perun/content-task {:task-name "contentful"
                       :render-form-fn (fn [data] `(ofe.static/render-track-page* ~data))
                       :paths-fn ofe/contentful-paths
                       :tracer :ofe.contentful/contentful
                       :pod perun/render-pod})
does this look about right to you?

martinklepsch 2017-02-28T13:33:34.000674Z

render-track-page* assocs the rendererd html (as string) to the :rendered key

bhagany 2017-02-28T13:34:01.000675Z

yeah, that looks like what I'd expect

martinklepsch 2017-02-28T13:36:47.000676Z

When I run this and then print-meta there are no entries for the pages that I just rendered

bhagany 2017-02-28T13:38:37.000677Z

I'd have to do some print debugging to get to the bottom of that... would it work if I run it locally, or would I need contentful credentials of some sort?

martinklepsch 2017-02-28T13:39:12.000678Z

It’s early in the morning where you are — maybe bring your kids to school and ping later if/when you find time?

martinklepsch 2017-02-28T13:39:45.000679Z

@bhagany it should work, creds are public and hardcoded: https://github.com/martinklepsch/one-of-each/tree/atom

bhagany 2017-02-28T13:40:18.000681Z

yeah, I'm about to leave 🙂 finding time will be easy though, as my employment situation is currently complicated, in a way that gives me a lot of free time 🙂

martinklepsch 2017-02-28T13:41:03.000682Z

haha, that’s both good and bad I guess

martinklepsch 2017-02-28T13:41:06.000683Z

talk soon

bhagany 2017-02-28T15:42:10.000686Z

:rendererd -> :rendered

martinklepsch 2017-02-28T15:42:31.000687Z

oh my!

bhagany 2017-02-28T15:42:44.000688Z

took me a while!

martinklepsch 2017-02-28T15:44:32.000689Z

hm. but then I still get this:

java.lang.ClassNotFoundException: ofe.contentful.Track
which is weird because that namespace should be required transitively

bhagany 2017-02-28T15:44:57.000690Z

ah, that's the same issue as the bug we discussed last week

bhagany 2017-02-28T15:45:13.000691Z

I'll try to get a final fix in for that today

martinklepsch 2017-02-28T15:45:58.000692Z

it is but I’m explicitly requiring that ns in the pod in build.boot

bhagany 2017-02-28T15:46:06.000693Z

oh... hrm

martinklepsch 2017-02-28T15:46:09.000694Z

(see right after the contentful task)

bhagany 2017-02-28T15:46:16.000695Z

okay, I see it

bhagany 2017-02-28T15:46:22.000696Z

odd, investigating

bhagany 2017-02-28T15:53:23.000697Z

... I can't seem to reproduce that error, but I did modify things a bit to make it run, maybe I'm not hitting the right code path?

bhagany 2017-02-28T15:54:46.000698Z

contentful is writing 4 files, and then atom-feed is erroring because of missing authors

martinklepsch 2017-02-28T15:55:32.000699Z

@bhagany are you running master?

bhagany 2017-02-28T15:55:43.000700Z

no, the atom branch

martinklepsch 2017-02-28T15:56:36.000701Z

@bhagany I mean of perun itself, sorry

bhagany 2017-02-28T15:56:48.000702Z

oh, sorry, yes

bhagany 2017-02-28T15:56:56.000703Z

double checking that

bhagany 2017-02-28T15:58:37.000704Z

I was behind a commit or two, but I'm up to date now, and getting the same result on one-of-each

martinklepsch 2017-02-28T15:59:02.000705Z

the only change you made is fix the :rendered typo I guess?

bhagany 2017-02-28T15:59:28.000706Z

I also changed some stuff in build.boot, just to get the contentful task to run

martinklepsch 2017-02-28T15:59:42.000707Z

what’s the exact CLI invocation you use? I do boot contentful perun/print-meta target

bhagany 2017-02-28T16:00:14.000708Z

ah, I was running boot dev, I'll try yours

bhagany 2017-02-28T16:01:14.000709Z

okay, getting that error now...

bhagany 2017-02-28T16:01:19.000710Z

ah, I see

bhagany 2017-02-28T16:01:26.000711Z

print-meta is the source of the error

bhagany 2017-02-28T16:01:54.000712Z

I think it's trying to print a Track, but it's not loaded in the print-meta pod

bhagany 2017-02-28T16:02:17.000713Z

boot contentful target works

martinklepsch 2017-02-28T16:08:02.000714Z

ok, that’s some progress 🙂

bhagany 2017-02-28T16:11:16.000715Z

that's probably fixable in the same manner as the bug from last week

martinklepsch 2017-02-28T16:11:47.000716Z

for print meta I did the same thing as for render, just require it in the pod

martinklepsch 2017-02-28T16:11:58.000717Z

for the atom task that doesn’t work because pod isn’t globally defined

martinklepsch 2017-02-28T16:12:14.000718Z

Really the simplest thing at this point is just turning them into ordinary maps 🙂

martinklepsch 2017-02-28T16:12:33.000719Z

wohoo I generated a feed!

bhagany 2017-02-28T16:12:39.000720Z

the fix I'm working on might work for atom-feed as well... but maybe maps aren't a bad idea either 🙂

martinklepsch 2017-02-28T16:13:14.000721Z

one bug report: when I set :out-dir in for the atom-feed task to an empty string it ends up being an absolute path

bhagany 2017-02-28T16:13:25.000722Z

ah, noted

bhagany 2017-02-28T16:14:11.000723Z

I bet it's more general than that

martinklepsch 2017-02-28T16:14:23.000724Z

this does the trick but I guess empty string should be fine too? ”.”

bhagany 2017-02-28T16:14:38.000725Z

yes, I think so

martinklepsch 2017-02-28T16:23:01.000726Z

Ok think with my weird setup I might have to implement the rss feed markup seperately

bhagany 2017-02-28T16:25:55.000727Z

Because of the atom requirements like uuids and such?

martinklepsch 2017-02-28T16:26:36.000728Z

that + the fact that the :content keys are already full html pages

martinklepsch 2017-02-28T16:27:35.000729Z

shouldn’t be too hard with another content-task though I guess

bhagany 2017-02-28T16:29:49.000730Z

full html pages should be okay - are they being picked up by a later render task or something?

bhagany 2017-02-28T16:31:43.000731Z

for atom, I think the biggest difficulty is in having a unique, stable id for each entry. It doesn't technically have to be a uuid, though. For instance, if you know the content won't change, you could md5 it or something, and use that.

bhagany 2017-02-28T16:32:06.000732Z

or md5 the url

bhagany 2017-02-28T16:32:20.000733Z

just something that's unique and repeatable

bhagany 2017-02-28T16:32:42.000734Z

(this is assuming you can't just set some metadata field in contentful that you can access, which would be easiest)

bhagany 2017-02-28T16:44:40.000735Z

oh, it looks like you already get a "uuid" back... I don't think I understand where the difficulty is

martinklepsch 2017-02-28T16:58:14.000737Z

Oh yeah, I was using a validator, maybe most RSS readers don’t care to much about what it says

martinklepsch 2017-02-28T16:59:02.000738Z

will try what the feed looks like in a reader with the default impl