@bhagany I think you might be really onto something, I remember having this: https://github.com/pandeiro/boot-http/issues/70
It looks like I misinterpreted the problem and your explanation is probably what's happening
@richiardiandrea indeed, trying to use boot-http is also how I discovered it š
@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 š¤¦ Thanks for digging btw, I did not have time at the time.
Iām hoping to open a PR tonight
@richiardiandrea interesting discovery: (sift :move {#"foo\.txt" "bar.txt"} :to-asset #{#"bar\.txt"})
sticks
oh I never ever use that feature
sift?
no I mean :to-asset
I never have either
but it is a good point, I always assume that sift
does the right thing and uses the output roles...
maybe not?
I don't think it does
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
and now I think it's because boot needs to know if it's a resource or asset or whatever
@bhagany from the code both :move
and :add-*
use boot.core/get-add-dir
digging more
I'll be very glad to have other eyes on it š
I don't see where sift :move
does get-add-dir
, though
sorry actually no, sift-action :move
uses another code branch
cool, we're on the same page
yeah that's tricky because sift-mv
is used there on top in those defmethod
very interesting that :to-*
wrap ... exactly
maybe :move
should use the same code, sift-mv
, with a default role ?
I've been wondering if there's a way to easily determine the role of the src file...
I would default it to one that outputs
I feel like it's hard to pick a default for it
@bhagany uploaded a file: https://clojurians.slack.com/files/U051706GF/F8P81HUSX/image.png
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
that ?? gets me every time
yeaaaaaaaaaaaaa
so I would default to asset
hrm, I was leaning toward resource
at least in the case of Perun, we often want to use files as input as well
after processing them a bit
right
you are right boot
is compositional/transformational...so everything that is more than just one task will need :resource
-like role
notably only the last task has input->output
yeah, that's is how I understand it as well
not that I'd be very surprised to find that I don't actually understand it š
I am trying to use sift-mv in place of the current :move
implementation
I'm not sure we can do that
sift-mv
modifies :dir
, and sift-action :move
modifies :path
my first impulse is to modify sift-action :move
so that it also modifies :dir
yes somehow :dir
needs to be added in there
https://gist.github.com/bhagany/2bfd183d768487cdd2719bddd58a2af6
^ that works for me
... nope, taking that back
I was about to try, but ok, no I am taking back the attempt š
sooo @bhagany also sift
reduces over actions so basically if I understand correctly first :path
is modified then :dir
(maybe you've noticed already :D)
https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/task/built_in.clj#L631
do you mean for something like (sift :move {#"foo\.txt" "bar.txt"} :to-asset #{#"bar\.txt"})
?
yes, so :move
is done before :to-asset
it seems
yes, but I think that might just be luck
I don't think the order of reduction is necessarily defined there
Also, I modified the gist to something that actually works š
if you see the line above there is a reduce-kv
oh cool
another fix would be to compose the two, if this reduction theory is right š
possible, but I didn't really think that we would need both reductions over the same fileset
well yes actually don't want to slow you down if you have another working solution
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
and also, I can now work around it
hrm, probably worth an issue, possibly pinging Misha for some insight
yeah, I'll open an issue, and perhaps a maintainer or two will take the trouble to read this conversation š
š
maybe I'll skip right to the PR and see how it goes
Would be awesome, also to see if the current tests are passing (even if not very many)
yup, tests pass
on os x at least
Anyone comfortable with Java could have a good impact here: https://github.com/boot-clj/boot-bin/issues/6