Clojurians
#boot-dev
<
2018-01-08
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

richiardiandrea01:01:50

@bhagany I think you might be really onto something, I remember having this: https://github.com/pandeiro/boot-http/issues/70

richiardiandrea01:01:11

It looks like I misinterpreted the problem and your explanation is probably what's happening

bhagany01:01:54

@richiardiandrea indeed, trying to use boot-http is also how I discovered it :slightly_smiling_face:

richiardiandrea01:01:08

@bhagany so I will need to fix it too very soon cause now I remember why I ran into that perun "misunderstanding" that you fixed. I tried to move the files back in resources and puff...now boot-http is broken because of the above :facepalm: Thanks for digging btw, I did not have time at the time.

bhagany01:01:48

I’m hoping to open a PR tonight

bhagany03:01:44

@richiardiandrea interesting discovery: (sift :move {#"foo\.txt" "bar.txt"} :to-asset #{#"bar\.txt"}) sticks

richiardiandrea03:01:34

oh I never ever use that feature

richiardiandrea03:01:51

no I mean :to-asset

bhagany03:01:55

I never have either

richiardiandrea03:01:37

but it is a good point, I always assume that sift does the right thing and uses the output roles...

bhagany03:01:14

I don't think it does

bhagany03:01:04

I was wondering why when I do something like (-> fileset (boot/add-resource tmp) boot/commit!) it'll stick, but sift or mv won't

bhagany03:01:25

and now I think it's because boot needs to know if it's a resource or asset or whatever

richiardiandrea03:01:52

@bhagany from the code both :move and :add-* use boot.core/get-add-dir

bhagany03:01:37

I'll be very glad to have other eyes on it :slightly_smiling_face:

bhagany03:01:20

I don't see where sift :move does get-add-dir, though

richiardiandrea03:01:23

sorry actually no, sift-action :move uses another code branch

bhagany03:01:33

cool, we're on the same page

richiardiandrea03:01:04

yeah that's tricky because sift-mv is used there on top in those defmethod

bhagany03:01:09

very interesting that :to-* wrap ... exactly

richiardiandrea03:01:41

maybe :move should use the same code, sift-mv, with a default role ?

bhagany03:01:07

I've been wondering if there's a way to easily determine the role of the src file...

richiardiandrea03:01:29

I would default it to one that outputs

bhagany03:01:07

I feel like it's hard to pick a default for it

richiardiandrea03:01:05

well 80% of the times you want to transform from an input role to an output role, or from a resource (which is output atm) to output

bhagany03:01:06

that ?? gets me every time

richiardiandrea03:01:26

so I would default to asset

bhagany03:01:44

hrm, I was leaning toward resource

bhagany03:01:00

at least in the case of Perun, we often want to use files as input as well

bhagany03:01:15

after processing them a bit

richiardiandrea03:01:43

you are right boot is compositional/transformational...so everything that is more than just one task will need :resource-like role

richiardiandrea03:01:34

notably only the last task has input->output

bhagany03:01:03

yeah, that's is how I understand it as well

bhagany03:01:23

not that I'd be very surprised to find that I don't actually understand it :slightly_smiling_face:

richiardiandrea03:01:13

I am trying to use sift-mv in place of the current :move implementation

bhagany03:01:31

I'm not sure we can do that

bhagany03:01:51

sift-mv modifies :dir, and sift-action :move modifies :path

bhagany03:01:34

my first impulse is to modify sift-action :move so that it also modifies :dir

richiardiandrea03:01:16

yes somehow :dir needs to be added in there

bhagany03:01:51

^ that works for me

bhagany03:01:32

... nope, taking that back

richiardiandrea03:01:17

I was about to try, but ok, no I am taking back the attempt :smile:

richiardiandrea03:01:32

sooo @bhagany also sift reduces over actions so basically if I understand correctly first :path is modified then :dir

richiardiandrea03:01:03

(maybe you've noticed already :D)

bhagany03:01:49

do you mean for something like (sift :move {#"foo\.txt" "bar.txt"} :to-asset #{#"bar\.txt"})?

richiardiandrea03:01:13

yes, so :move is done before :to-asset

bhagany03:01:23

yes, but I think that might just be luck

bhagany03:01:39

I don't think the order of reduction is necessarily defined there

bhagany03:01:51

Also, I modified the gist to something that actually works :slightly_smiling_face:

richiardiandrea03:01:51

if you see the line above there is a reduce-kv

richiardiandrea03:01:20

another fix would be to compose the two, if this reduction theory is right :smile:

bhagany03:01:21

possible, but I didn't really think that we would need both reductions over the same fileset

richiardiandrea03:01:55

well yes actually don't want to slow you down if you have another working solution

bhagany03:01:53

well, fwiw, I am not terribly confident that this is the right thing to do. I feel like there might be some reason for the current behavior that I'm not seeing

bhagany03:01:10

and also, I can now work around it

richiardiandrea03:01:56

hrm, probably worth an issue, possibly pinging Misha for some insight

bhagany03:01:42

yeah, I'll open an issue, and perhaps a maintainer or two will take the trouble to read this conversation :slightly_smiling_face:

bhagany03:01:48

maybe I'll skip right to the PR and see how it goes

richiardiandrea03:01:37

Would be awesome, also to see if the current tests are passing (even if not very many)

bhagany03:01:23

yup, tests pass

bhagany03:01:29

on os x at least

martinklepsch11:01:53

Anyone comfortable with Java could have a good impact here: https://github.com/boot-clj/boot-bin/issues/6