Fork me on GitHub
#boot
<
2015-09-21
>
cigitia02:09:15

Let’s say that, in a Boot task, I want to modify a resource on my classpath for a downstream task, and keep it at the same location. Is it bad to directly the modify the resource directly using ?

cigitia02:09:49

@alandipert: If it’s a specific resource that I want to modify, is there a better way of getting its File object from the input fileset other than using ?

alandipert02:09:59

@cigitia: check out boot.core/tmp-file

alandipert02:09:06

it sounds like the private copy function in boot-template may do close to what you want

alandipert02:09:14

it makes use of tmp-file

cigitia02:09:33

@alandipert: The thing about that, though, is that tmp-file requires that I’ve obtained a temp-file object from the fileset already.

cigitia02:09:54

My problem is that I need to retrieve a specific input file at a specific path from the fileset.

cigitia02:09:59

I’ve been using io/resource for that.

alandipert02:09:47

for the finding part, i think you want boot.core/by-name

alandipert02:09:10

i find better example

alandipert02:09:07

yeah, so to get a list of files from the fileset, you use the 'query' api - https://github.com/boot-clj/boot/wiki/Filesets#fileset-queries

cigitia02:09:08

boot.core/by-name’s design sort of confuses me.

alandipert02:09:30

by-name is expecting the objects returned by a query

alandipert02:09:48

e.g. (by-name ["foo.bar"] (input-files fs))

cigitia02:09:04

Now I understand.

cigitia02:09:26

I might edit the wiki to talk about how to use by-name then later.

cigitia02:09:34

Thank you so much!

alandipert02:09:36

that would be excellent, thanks in advance!

mynomoto03:09:22

Is there a way to create a package on cljsjs with a optional dependency but participate on the dependency graph? Eg. vega optionally depends on d3-cloud (only for word clouds). But when it does vega should be loaded before d3-cloud.

cigitia03:09:56

@alandipert: Is there a particular reason why, given a resource-file-path, (->> fileset boot/input-files (filter (comp #{resource-file-path} :path))) …would successfully get the resource file that I want, at the same time that… (->> fileset boot/input-files (boot/by-name [resource-file-path])) …gives an empty collection? I’m checking the source at https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/core.clj#L877, and it seems like it should have worked.

martinklepsch10:09:45

@cigitia: you can also easily access files by their full path doing something like this (get-in fileset [:tree "public/index.html"]) I'm not 100% sure if this is a ”public“ api feature, maybe @micha can comment on that.

micha14:09:00

@cigitia: it's important that you never write to a file in the fileset directly

micha14:09:24

they're set to be read-only via file permissions, but you could get around that i'm sure

micha14:09:39

the way you can replace a file in the fileset with another file is to create a new file in a temp dir such that the new file has the same relative path as the one you want to replace, and then add the temp dir to the fileset.

nha19:09:53

Hello, is there a clojure & clojurescript boot template somewhere ?

nha19:09:25

I found this https://github.com/Deraen/saapas but it fails on first task for me

nha19:09:32

Or is it not intended to be used like that ?

juhoteperi19:09:01

@nha: What's the problem? It should work and it should be okay to use as a template

nha19:09:43

@juhoteperi: ah hello simple_smile Well I just opened an issue if you want to look at it https://github.com/Deraen/saapas/issues/6

nha19:09:56

Maybe it's me, but I can't figure what I've done wrong

juhoteperi19:09:04

@nha: Aha, that's caused by old Boot binary

juhoteperi19:09:48

boot -u only updates Boot library, you'll have to download new binary yourself

nha19:09:18

oh ? I'm pretty new to boot, sorry. What do I have to update ?

juhoteperi19:09:53

Either dowload http://boot.sh/exe or upgrade boot-clj package with brew

nha19:09:00

ah right ! I skimmed that part !

nha19:09:10

Oh wait, I used brew

nha19:09:18

I unlinked, relinked using brew, ran boot-u again and now it's compiling simple_smile

nha19:09:41

Well thank you, I will close the issue

juhoteperi19:09:59

I think brew update && brew upgrade boot-clj should work also

juhoteperi19:09:14

update updates the package repository and upgrade upgrades the package

nha19:09:37

I see, but I had 2.0 already

nha19:09:46

but thanks for the tip anyway

juhoteperi19:09:05

Latest binary is 2.3 and latest in Brew is 2.2

nha19:09:13

ow 😕 alright then

micha19:09:58

the change to the boot binary in 2.3.0 is very minor

micha19:09:42

only fixes a bug where something like BOOT_JVM_OPTIONS='-Dfoo="something with quotes"' boot ...

micha19:09:07

the quotes weren't being properly preserved

nha19:09:09

@juhoteperi: works perfectly simple_smile

nha19:09:40

Is there a canonical way to include development variables / dependencies ?

nha19:09:22

I guess I have to use set-env!, correct ? does it really set or is it more of a merge ?

micha19:09:54

set-env! is to configure the classpath of your build process

micha19:09:24

there is also merge-env! which will intelligently merge

micha19:09:51

or you can do (set-env! :dependencies #(conj % '[some.new/dependency "1.2.3"]))

micha19:09:57

that will also merge

nha20:09:02

ok so if I want a dev/user.clj repl available, I should add (set-env! :source-paths #{"src" "dev"}) to my task ?

nha20:09:09

ok that's clear thanks

nha20:09:00

so I get that I have to do (1) boot dev (2) cider-connect (3) (start-repl) to get a cljs-repl

nha20:09:43

What are the advantages of doing that ? It means I never have to relaunch a repl ? Or is there a shorter way to get a cljs repl ?

nha20:09:13

does someone here have a boot profile to share ?

micha20:09:08

you are programming now, nha

micha20:09:24

the workflow of your dreams is only a few clojure functions away

nha20:09:32

ahaha right simple_smile

micha20:09:54

if you want to automate things you can: boot tasks compose with each other and with your own tasks

nha20:09:19

yep that's what sold me over (that and my lein file was becoming too big)

micha20:09:23

and you can start developing your task in the repl or an emacs buffer

micha20:09:52

you can reload your build.boot in the repl by doing (load-file "build.boot")

micha20:09:59

you'll probably need that

nha20:09:38

just like emacs ^^

nha20:09:14

so instead of using lein plugins, I should put them in boot.repl, correct ?

nha20:09:49

(I'm thinking of clj-refactor specifically)

micha20:09:57

i'm not familiar with boot.repl, is that something clj-refactor uses?

micha20:09:44

oh right, yeah those are dynamic vars that the repl task will use to load dependencies that are specific to repl stuff

micha20:09:06

the repl is a weird task because it's basically like starting a debugger

micha20:09:59

but yeah those dynamic vars are how you configure the repl with middleware

nha20:09:21

Thanks a lot ! I will play a bit around simple_smile

micha20:09:59

@raywillig: i can't reproduce that

micha20:09:18

can you try again?

micha20:09:22

@raywillig: oh wait, i can reproduce

raywillig20:09:09

@micha any idea how to make it terrific?

nha20:09:04

@raywillig: I get that when running boot in a directory where there is no boot file ?

micha20:09:27

i think i need to push a new release probably

micha21:09:13

man i dunno

micha21:09:25

trying to deploy boot to clojars using leiningen

micha21:09:34

keeps failing

micha21:09:41

intermittently

micha21:09:53

Created /home/micha/git/boot-clj/boot/boot/worker/target/worker-2.3.1.jar
Sending boot/worker/2.3.1/worker-2.3.1.pom (6k)to 
Sending boot/worker/2.3.1/worker-2.3.1.jar (3276k)to 
Retrieving boot/worker/maven-metadata.xml (2k)from 
Checksum validation failed, expected a021f08e23e63bc818ba7ce17ac8af762c642efc but is 3f636e7ba8fd408dff585517a1407f01d227663c
Retrieving boot/worker/maven-metadata.xml (2k)from 
Could not transfer metadata boot:worker/maven-metadata.xml from/to clojars (): Checksum validation failed, expected a021f08e23e63bc818ba7ce17ac8af762c642efc but is 3f636e7ba8fd408dff585517a1407f01d227663c
Failed to retrieve remote metadata boot:worker/maven-metadata.xml: Could not transfer metadata boot:worker/maven-metadata.xml from/to clojars (): Checksum validation failed, expected a021f08e23e63bc818ba7ce17ac8af762c642efc but is 3f636e7ba8fd408dff585517a1407f01d227663c
Makefile:94: recipe for target '.deployed' failed
make: *** [.deployed] Error 1

micha21:09:06

looks like a case of mangled clojars metadata https://github.com/ato/clojars-web/issues/369

tcrawley22:09:42

@micha: I can fix that checksum issue manually, but not right now :( Can you file an issue at ato/clojars and I can fix it first thing in the AM

micha22:09:12

@tcrawley: sure! i was in the middle of checking metadata for the various artifacts when i accidentally typed rm -rf ~ and pressed enter before the rest of that command ... /.m2/repository/boot

micha22:09:25

it's amazing how fast things can be deleted