Fork me on GitHub
#boot
<
2016-01-14
>
richiardiandrea01:01:37

I get a weird error whenever I call something inside a pod:

java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag object
             java.lang.RuntimeException: No reader function for tag object
                                    ...                                        
               clojure.core/read-string                          core.clj: 3497
                      boot.pod/call-in*                           pod.clj:  313

micha01:01:43

that's because either the expression you're passing to the pod, or the value returned by the pod, is not printable by clojure's pr-str

micha01:01:06

what is the expression you're passing to the pod?

richiardiandrea01:01:34

(pod/with-call-in @pod (clj-jgit.porcelain/git-clone-full uri tmp remote branch)) ... Maybe the params?

micha01:01:13

i recommend debuggin like this

micha01:01:33

(println
  (pod/with-call-in @pod
    (pr-str (clj-jgit.porcelain/git-clone-full ~uri ~tmp ~remote ~branch))))

micha01:01:44

*debugging

richiardiandrea01:01:19

will do, thanks @micha

micha01:01:45

that's assuming that url, tmp, remote, etc are all plain EDN forms

richiardiandrea01:01:17

yes they are, I am printing all of them

richiardiandrea01:01:11

actually the return of (core/tmp-dir!) might be not

micha01:01:35

oh no, that's a java.io.File

micha01:01:46

(.getPath tmp)

richiardiandrea01:01:51

found the problem ๐Ÿ˜„

micha01:01:02

๐Ÿ’ฅ

micha01:01:27

i'm hoping to have a pretty good solution to this issue soon

micha01:01:46

to allow most types of things to pass from one pod to the next

micha01:01:01

the only problematic things are mutable clojure types

micha01:01:19

but java types, records, etc will be ok

richiardiandrea01:01:49

mutable is always a problem ๐Ÿ˜„

richiardiandrea01:01:44

but the pod idea is very cool, and indeed boot is faster on this machine then lein

richiardiandrea01:01:14

while working on Counterclockwise I wished I had this kind of isolation

micha01:01:24

that's good to hear!

micha01:01:34

we haven't been optimizing for speed till recently

micha01:01:48

you wrote ccw?

richiardiandrea01:01:39

no, but contributed big chunks

micha01:01:42

i always introduce people to clojure via ccw, it's awesome

richiardiandrea01:01:38

Laurent Petit is the current maintainer, unfortunately things got a bit slow there, but it was my first clojure project

richiardiandrea01:01:45

to learn learn learn ๐Ÿ˜„

micha01:01:41

it used to be a real mission just to get a clojure environment going where you could start learning

micha01:01:55

and ccw was a full environment, pretty great

richiardiandrea02:01:22

yes true that, and I remember Laurent had troubles setting the classpath when building, it kind of added part of the lein api in order to do that if I am not wrong

richiardiandrea02:01:36

with boot, it would be a breeze, create a pod and you are done ๐Ÿ˜„

richiardiandrea03:01:58

So add-source can just add dirs right? what about adding individual java.io.File?

richiardiandrea03:01:04

oh I can use cp maybe

asolovyov13:01:22

how do I see in boot which directories are added to classpath?

asolovyov13:01:28

in repl I mean

micha14:01:13

@asolovyov: hi! good to see you again!

micha14:01:28

(get-env :directories)

micha14:01:43

that's the actual directories on the classpath

asolovyov14:01:50

ok, that helps a bit

micha14:01:58

which will all be temp dirs created and managed by boot

asolovyov14:01:03

I wonder maybe you'll know an answer to my question simple_smile

micha14:01:05

what are you wanting to do?

asolovyov14:01:14

I have updated clojurescript to 1.7.228 and my riemann died

asolovyov14:01:29

before that they had conflicting protobufs

asolovyov14:01:42

so I have clojurescript with :exclusions [com.google.protobuf/protobuf-java]

asolovyov14:01:05

but now this doesn't help, when I add clojurescript, riemann/send-event dies with Class com.google.protobuf.UnmodifiableLazyStringList does not implement the requested interface com.google.protobuf.ProtocolStringList

asolovyov14:01:21

even in case of dependencies like this:

[[riemann-clojure-client "0.4.1"]
                          [org.clojure/clojurescript "1.7.228"
                           :exclusions [com.google.protobuf/protobuf-java]]
                          [com.google.protobuf/protobuf-java "2.6.1"]]

asolovyov14:01:42

that's really weird and I can't comprehend what's going on ๐Ÿ˜ž

micha14:01:46

and you're sure that's the right version of protobuf for riemann?

asolovyov14:01:02

it seems like 2.6.1 is loaded

micha14:01:03

i guess what i would do is remove the :exclusions temporrarily

asolovyov14:01:08

but what really is loaded - I have no idea

micha14:01:09

and do boot show -p

micha14:01:26

that will show you all dependency conflicts and where they're coming from

asolovyov14:01:37

>ย boot show -p
[!] org.clojure/clojure
    :heavy_check_mark: 1.7.0
      org.clojure/clojurescript
    โœ˜ 1.3.0-beta1
      riemann-clojure-client

micha14:01:53

that's it?

micha14:01:01

hi @leontalbot !

asolovyov14:01:34

but that's clojure version, and it chooses 1.7.0, which is fine?

micha14:01:34

@asolovyov: you should see protobuf there

asolovyov14:01:40

I don't... ๐Ÿ˜ฎ

micha14:01:51

can you paste your build.boot file please?

micha14:01:05

are you making a pod htere?

asolovyov14:01:53

#!/usr/bin/env boot

(set-env! :dependencies '[[riemann-clojure-client "0.4.1"]
                          [org.clojure/clojurescript "1.7.228"]])
simple_smile

micha14:01:53

if you don't see protobuf in the show -p output then that must mean that there is no conflict

micha14:01:05

try boot show -d

asolovyov14:01:28

there is no conflict and it never shows that protobuf is a dep of clojurescript

asolovyov14:01:40

but when I include clojurescript, riemann stops working... ๐Ÿ˜ž

asolovyov14:01:08

>ย boot show -d
[org.clojure/clojurescript "1.7.228"]
โ”œโ”€โ”€ [com.google.javascript/closure-compiler "v20151216"]
โ”œโ”€โ”€ [org.clojure/clojure "1.7.0"]
โ”œโ”€โ”€ [org.clojure/data.json "0.2.6"]
โ”œโ”€โ”€ [org.clojure/google-closure-library "0.0-20151016-61277aea"]
โ”‚   โ””โ”€โ”€ [org.clojure/google-closure-library-third-party "0.0-20151016-61277aea"]
โ”œโ”€โ”€ [org.clojure/tools.reader "1.0.0-alpha1"]
โ””โ”€โ”€ [org.mozilla/rhino "1.7R5"]
[riemann-clojure-client "0.4.1"]
โ”œโ”€โ”€ [com.aphyr/riemann-java-client "0.4.0"]
โ”‚   โ”œโ”€โ”€ [com.google.protobuf/protobuf-java "2.6.1"]
โ”‚   โ”œโ”€โ”€ [io.netty/netty "3.6.1.Final"]
โ”‚   โ””โ”€โ”€ [org.slf4j/slf4j-api "1.6.4"]
โ”œโ”€โ”€ [less-awful-ssl "1.0.0"]
โ””โ”€โ”€ [org.clojure/tools.logging "0.2.3"]

asolovyov14:01:44

it feels like it needs a therapist, not a developer

asolovyov14:01:28

I wonder if I need to ask David what did he do to clojurescript ๐Ÿ˜ฎ

micha14:01:57

it works ok with the previous release of cljs?

leontalbot14:01:08

^^^Hello folks. I'm running my make-war task it does all the steps, and then stops to Writing project.war... The file is not created. Here is the task ^^^ Do you guys have an idea what to do?

asolovyov14:01:17

@micha: yep... with :exclusions simple_smile

micha14:01:47

@asolovyov: ok how about this, just for kicks

micha14:01:03

remove the riemann dependency leaving only cljs

micha14:01:14

and then do boot uber show -f

asolovyov14:01:41

oops, no task cljs

micha14:01:43

and look for suspicious protobuf classes that were accidentally packaged in the cljs jar

asolovyov14:01:49

maybe just uber show -f?

micha14:01:56

yeah that

micha14:01:04

it's possible that there was a packaging mixup

micha14:01:16

and they included a version of protobuf in the jar by mistake

asolovyov14:01:27

damn it's long

asolovyov14:01:30

there is protobuf there!

alandipert14:01:36

@leontalbot: do you have BOOT_EMIT_TARGET set to no? if so you might need the target task at the end of your pipeline

micha14:01:39

๐Ÿ’ฅ

asolovyov14:01:51

but... how do I proceed? :-))

asolovyov14:01:02

maybe there is protobuf which is not com.google.protobuf/?

asolovyov14:01:07

like, some.other/protobuf?

micha14:01:18

you will see it in the path, no?

asolovyov14:01:29

ETA-INF
โ””โ”€โ”€ maven
    โ”œโ”€โ”€ args4j
    โ”‚   โ””โ”€โ”€ args4j
    โ”‚       โ”œโ”€โ”€ pom.properties
    โ”‚       โ””โ”€โ”€ pom.xml
    โ”œโ”€โ”€ com.google.guava
    โ”‚   โ””โ”€โ”€ guava
    โ”‚       โ”œโ”€โ”€ pom.properties
    โ”‚       โ””โ”€โ”€ pom.xml
    โ”œโ”€โ”€ com.google.javascript
    โ”‚   โ”œโ”€โ”€ closure-compiler
    โ”‚   โ”‚   โ”œโ”€โ”€ pom.properties
    โ”‚   โ”‚   โ””โ”€โ”€ pom.xml
    โ”‚   โ””โ”€โ”€ closure-compiler-externs
    โ”‚       โ”œโ”€โ”€ pom.properties
    โ”‚       โ””โ”€โ”€ pom.xml
    โ”œโ”€โ”€ com.google.protobuf
    โ”‚   โ””โ”€โ”€ protobuf-java
    โ”‚       โ”œโ”€โ”€ pom.properties
    โ”‚       โ””โ”€โ”€ pom.xml
    โ””โ”€โ”€ org.clojure
        โ”œโ”€โ”€ clojure
        โ”‚   โ”œโ”€โ”€ pom.properties
        โ”‚   โ””โ”€โ”€ pom.xml
        โ”œโ”€โ”€ clojurescript
        โ”‚   โ”œโ”€โ”€ pom.properties
        โ”‚   โ””โ”€โ”€ pom.xml
        โ”œโ”€โ”€ data.json
        โ”‚   โ”œโ”€โ”€ pom.properties
        โ”‚   โ””โ”€โ”€ pom.xml
        โ”œโ”€โ”€ google-closure-library
        โ”‚   โ”œโ”€โ”€ pom.properties
        โ”‚   โ””โ”€โ”€ pom.xml
        โ”œโ”€โ”€ google-closure-library-third-party
        โ”‚   โ”œโ”€โ”€ pom.properties
        โ”‚   โ””โ”€โ”€ pom.xml
        โ””โ”€โ”€ tools.reader
            โ”œโ”€โ”€ pom.properties
            โ””โ”€โ”€ pom.xml

asolovyov14:01:44

so it's com.google.protobuf/protobuf-java?...

asolovyov14:01:04

which is the same I'm trying to exclude...

micha14:01:10

yeah that's weird

micha14:01:14

but what about the class files?

micha14:01:24

do you see the class it was complaining about?

micha14:01:58

although it's possible that the protobuf library looks on the classpath for its own pom

asolovyov14:01:01

right inside the protobuf directory

micha14:01:08

yeah so that's a problem i think

micha14:01:28

i would maybe create an issue or ask in #C03S1L9DN?

asolovyov14:01:40

I guess I'll do that

micha14:01:54

maybe double check with jar tf ~/.m2/repository/org/clojure/clojurescript...jar

micha14:01:09

and grep for that stuff

asolovyov14:01:30

riiiiiiiiiiiight

asolovyov14:01:42

now I get what's going on

micha14:01:55

what is it?

asolovyov14:01:29

well, about jar tf simple_smile

asolovyov14:01:34

but hm, there is no protobuf there

leontalbot14:01:36

@alandipert right! Thanks! Would you mind pointing out a target task example? (what to add to the pipeline?)

micha14:01:41

@asolovyov: i suppose it could be in google closure too

micha14:01:20

so you can work around it @asolovyov

micha14:01:25

if you need to

alandipert14:01:45

@leontalbot:

(deftask make-war
  "Build a war for deployment"
  []
  (comp (hoplon)
        (cljs :optimizations :advanced)
        (uber :as-jars true)
        (web :serve 'vpc-hoplon.handler/app)
        (war)
        (target :dirs #{"target"})))

asolovyov14:01:45

it's in closure-compiler!

asolovyov14:01:55

@micha: hm, how do I work around? :-))

micha14:01:06

so the sift task is your friend there

micha14:01:22

there is sift --add-jar /path/to/goog.closure

micha14:01:35

that unzips the jar into the fileset

micha14:01:17

then you can use sift --invert --include '^com/google/protobuf...'

asolovyov14:01:24

but I wonder if I need to report this to closure-compiler team or maybe to @dnolen so that it's fixed...

micha14:01:41

yeah i think it's almost certainly just a mistake

micha14:01:53

but it could take a while to correct

asolovyov14:01:02

indeed, so I need a way to live simple_smile

micha14:01:16

yeah you can make your own version of the jar is maybe the sanest way?

leontalbot14:01:47

@alandipert: Thanks! I get a warning when launching the task target: unknown option(s): :dirs

micha14:01:58

@asolovyov: actually wait!

micha14:01:17

really you don't need cljs on the classpath at all!

asolovyov14:01:30

I don't I guess

micha14:01:32

you only need to add it to your deps to disambiguate

micha14:01:42

like to make sure that the version you want is the one that's resolved

micha14:01:50

how about trying this:

micha14:01:05

(set-env! :exclusions [org.clojure/clojurescript])

micha14:01:12

and remove the cljs dep

micha14:01:38

then if you use boot-cljs to compile it will load its own version of cljs in its pod

micha14:01:43

which will be isolated from your project

asolovyov14:01:03

oh wait, I actually build a bit of stuff by hand in my sources and require clojurescript, because I really wanted figwheel ๐Ÿ˜„

asolovyov14:01:11

so I'll have to restructure sources somewhat

asolovyov14:01:15

to make this work simple_smile

micha14:01:35

if you can run figwheel in a pod it could still work the way you want

asolovyov14:01:53

yeah, I guess

micha14:01:54

the main thing is to load cljs and gcl in a pod that's isolated from riemann

asolovyov14:01:22

what I did is downgraded cljs, and then tomorrow I'll try to restructure stuff nicely simple_smile

asolovyov14:01:37

also I pinged this issue, maybe closure-compiler will fix itself

micha14:01:22

yeah it's very strange that tye do that

alandipert14:01:49

@leontalbot: oops that should be :dir

leontalbot15:01:47

Other question, I've retarted my terminal then hit boot dev again and then get

{HTTP/1.1}{0.0.0.0:5000}
             clojure.lang.ExceptionInfo: java.net.BindException: Address already in use, compiling:(NO_SOURCE_FILE:0:0)
    data: {:file
           "/var/folders/gg/531kld4x2hq3lf_zl94gqfch0000gn/T/boot.user1954107233247231132.clj",
           :line 17}

micha15:01:18

@leontalbot: you may have another instance of boot already running

leontalbot15:01:33

no terminal relaunched

micha15:01:42

ps auxwww |grep java

micha15:01:06

or sudo netstat -tlpn

leontalbot15:01:11

leontalbot       4065 172,4  1,9  4865880 159196   ??  R    Lun02   1643:32.27 /usr/bin/java -Dboot.app.path=/usr/local/bin/boot -jar /usr/local/bin/boot dev
leontalbot      17036   0,0  5,9  4873896 492420   ??  S    10:05     2:06.92 /usr/bin/java -Dboot.app.path=/usr/local/bin/boot -jar /usr/local/bin/boot dev
leontalbot      17197   0,0  0,0  2432784    596 s000  S+   10:21     0:00.00 grep java

micha15:01:46

that looks like there are 2 boots already running

micha15:01:51

you probably want to kill those

leontalbot15:01:08

how I do it?

micha15:01:26

kill 4065 17036

leontalbot15:01:56

Great! Thanks!! Anything I could add to build.boot to prevent this?

micha15:01:11

i think maybe you're suspending boot instead of exiting?

micha15:01:25

like are you pressing ctrl-z to get out of boot dev?

cursork15:01:44

Should boot.core/reset-fileset strip metadata? It does in 2.5.5 but not in 2.4.2 - the change seems to be at the 2.4.2 -> 2.5.0 transition.

cursork15:01:27

Checked by changing BOOT_VERSION with a task along the lines of:

(defn x
  []
  (fn [nt]
    (fn [fs]
      (prn :x (meta fs))
      (prn :y (meta (boot.core/reset-fileset fs)))
      (nt fs))))

micha15:01:29

@cursork: thanks, that looks like a bug to me

micha15:01:11

can you please create a ticket to track this?

cursork15:01:22

No problem

micha15:01:43

if you need a workaround you can use alter-var-root for now

cursork15:01:19

So the issue was noticed in the core watch task

micha15:01:42

(alter-var-root #'boot.core/reset-fileset
  (fn [orig]
    (fn [fs]
      (with-meta (orig fs) (meta fs)))))

micha15:01:56

in your build.boot

cursork15:01:03

Ah I see what you mean. Yep. Thanks.

micha15:01:19

thanks @cursork !

micha15:01:01

@cursork: if you don't want to have that in the build.boot you can put it in a profile.boot file in the project dir

micha15:01:20

the workaround i mean

cursork15:01:05

Thanks. I think weโ€™ll be OK in the build.boot. Itโ€™s got a nice explaining comment next to it, so weโ€™ll be fine.

cursork15:01:36

N.B. reset-fileset actually has an args definition of [& [fs]] - I had to tweak the above alter-var-root slightly to accommodate (for anyone else who might stumble on the above)

micha15:01:07

could you add your workaround as a coment on the ticket?

seancorfield19:01:14

I donโ€™t know when theyโ€™ll re-gen http://clojure.org from the repo, but Boot will be on the Getting Started page when they do!

richiardiandrea19:01:55

Guys what sound format do speak accept?

juhoteperi19:01:59

@richiardiandrea: It's using Javazoom JLayer which seems to support just MP3

juhoteperi19:01:28

Is your test task in build.boot or in some namespace? If it's in namespace, you can define (:refer-clojure :exclude [test]) in ns form

richiardiandrea19:01:18

in build.boot, nothing important, just wanted to understand if you can in some way :refer-clojure in there

juhoteperi19:01:28

Hmm, I don't think so

juhoteperi19:01:48

I think the usual workaround is to name test task something different, I've been using run-tests

richiardiandrea19:01:56

yes in my own ns it would have been easier

juhoteperi19:01:10

Though even if it is in it's own ns, you get warning when you refer it in build.boot

richiardiandrea19:01:33

yes np will change the name because it clashed with the help when you call -h

richiardiandrea19:01:23

a way would be to suppress this warnings from the compiler options, I do it in replumb

richiardiandrea19:01:53

but I guess it is not worth it, let's keep it in mind if somebody else really cannot stand it

richiardiandrea19:01:58

even in its own ns btw it would clash with boot-test (if you have gloabl require), I do this at the moment tho:

(deftask auto-test
  "Start auto testing mode (dev profile)"
  []
  (set-dev!)
  (require 'adzerk.boot-test)
  (comp (watch)
        (speak)
        ((eval 'adzerk.boot-test/test))))

juhoteperi19:01:28

@richiardiandrea: You could probably use (ns-unmap 'boot.user test) to remove clojure.core/test: https://github.com/boot-clj/boot/issues/307

richiardiandrea19:01:21

lemme try ๐Ÿ˜„

richiardiandrea19:01:03

so (ns-unmap 'boot.user 'test) works whereas (ns-unmap 'clojure.core 'test) does not, why?

richiardiandrea19:01:55

I am removing the test symbol and ok, but I expected quite the other way around ๐Ÿ˜„

richiardiandrea19:01:33

(I am pretty unskilled on ns-unmap and I should probably look into it)

juhoteperi19:01:19

hmm, not sure about this but: in this case the boot.user ns already exist and the referred vars already exist in it, so removing the var from clojure.core will leave the var in boot.user ns

richiardiandrea19:01:08

oh my, I don't want a snippet!

micha19:01:19

that's awesome!

richiardiandrea19:01:21

when I require in build.boot I am requiring in boot.user

donmullen19:01:44

Great - thanks @seancorfield

jballanc19:01:05

Letโ€™s say I want to use the value of a var in my dependencies. I canโ€™t do (set-env! :dependencies โ€˜[[foo โ€œ1.2.3โ€] [bar bar-ver]]) obviously, but I also canโ€™t do

(set-env! :dependencies `[[foo โ€œ1.2.3โ€] [bar ~bar-ver]])
because Clojure helpfully translates all the bare symbols to their namespaced versions ๐Ÿ˜ž

jballanc19:01:21

โ€ฆany thoughts on a better way? Using (vec โ€˜[foo โ€œ1.2.3โ€] [โ€˜bar bar-ver]) could work, but is annoying to have to quote each item independently.

micha19:01:57

brandon bloom's backtick library is what you want, perhaps?

juhoteperi19:01:16

with syntax quote you can create bare symbols with ~'foo ~'bar

micha19:01:22

decouples syntax quote from symbol resolution

micha19:01:05

yes but then you might as well just not quote at all and do ['foo "2.3.4"] [bar "4.5.6'] simple_smile

jballanc19:01:33

Yeah, having to go through all my deps and add ~โ€™ would suck

micha19:01:53

boot uses backtick for the with-eval-in body

micha19:01:56

for example

richiardiandrea19:01:01

backtick is exactly for this use case I think

jballanc19:01:13

@micha: hmmโ€ฆok, sounds interesting

jballanc19:01:31

what are the chances boot could add that to boot.user ns?

micha19:01:03

you can use this: (not part of public api, but also probably not going anywhere anytime soon)

micha19:01:08

(require '[boot.from.backtick :refer [template]])

...

(set-env! :dependencies (template [[foo "1.2.3"] [bar ~bar-version]]))

micha19:01:01

i think we could map that into boot.util, which is referred in boot.user

micha19:01:21

but we'd have to come up with a less common name probably

micha19:01:44

because template is too juicy to use, people probably have tasks named that

jballanc19:01:19

yeahโ€ฆbut would be nice to have

jballanc19:01:29

itโ€™s the one thing Iโ€™m missing from Leinโ€™s defproject

micha19:01:14

if you put that require at the top of your build.boot you'll be good to go

jballanc19:01:01

works like a charm simple_smile

micha19:01:24

๐Ÿป

richiardiandrea20:01:22

another newbie question, I am trying to use boot.core/tmp-dir! in clojure tests but it fails with:

java.lang.IllegalArgumentException: No implementation of method: :-mk! of protocol: #'boot.tmpregistry/ITmpRegistry found for class: nil

richiardiandrea20:01:45

it is wrapped in a fixture and the next in the stack trace is:

boot.tmpregistry/mkdir!         tmpregistry.clj:   61
                                          ...                              
                           boot.core/tmp-dir*                core.clj:   77
                          boot.core/tmp-dir**                core.clj:   90
                                          ...                              
                           boot.core/tmp-dir!                core.clj:  285
        replumb.boot-cljs-src-test/clone-repo  boot_cljs_src_test.clj:   12 <- my fixture

micha20:01:58

ah, yeah the tests run in a pod

micha20:01:07

pods don't have access to that function

micha20:01:55

pods don't have access to the boot.core namespace

richiardiandrea20:01:00

so basically I have to include the boot.core dep in my pod

micha20:01:03

because that's where all the stateful mutable things are

micha20:01:10

no, that won't help

micha20:01:33

the temp dirs are managed as part of the big bucket of mutable state that boot needs

micha20:01:47

like managing the classpath and the filesystem and all that stuff

micha20:01:54

those functions aren't thread-safe

micha20:01:18

and there are singletons in boot.core that are maintaining state

micha20:01:56

you can use the java nio interface, if you like

micha20:01:18

(java.nio.file.Files/createTempDirectory prefix suffix)

richiardiandrea20:01:23

ok, I basically have to manage that part myself, yes

richiardiandrea20:01:44

no problem, it is just to create a tempory dir and emptying it in the tests

richiardiandrea20:01:01

thanks for the ready-to-paste line ๐Ÿ˜„

micha20:01:02

hm one thing you can do is smuggle it in the env

micha20:01:10

if you want boot to clean it up for you

micha20:01:32

(set-env! :my/temp-dir (.getPath (tmp-dir!)))

micha20:01:46

then in your test you can do

micha20:01:48

(require
  '[boot.pod :as pod]
  '[ :as io])

... (io/file (:my/temp-dir pod/env)) ...

micha20:01:36

i dunno, that's kind of hackish

richiardiandrea20:01:40

ok kind of clear ๐Ÿ˜„

richiardiandrea20:01:10

I will just use nio and the (core/empty-dir! tmp)

richiardiandrea20:01:14

that's all I need

richiardiandrea20:01:36

thanks for your help as usual ๐Ÿ˜„

richiardiandrea20:01:08

bleah, Java is so ugly:

(defn tmp-dir!
  "Create a temp folder and returns its java.nio.file.Path."
  []
  (doto
      (.toFile (java.nio.file.Files/createTempDirectory nil
                                                        (make-array java.nio.file.attribute.FileAttribute 0)))
    (.deleteOnExit)))

micha20:01:44

@richiardiandrea: does .deleteOnExit work for directories?

micha20:01:59

i think you may need to use a shutdown hook ๐Ÿ˜•

richiardiandrea20:01:47

let me check first

richiardiandrea20:01:37

yep it does not remove it

richiardiandrea20:01:42

uglier and uglier

richiardiandrea20:01:41

I will delete it in the fixture, no time for hooks and peter pans

richiardiandrea20:01:55

tnx for the pointer

micha21:01:13

seems like putting the temp dir in the env might actually be a good solution when all's said and done

richiardiandrea21:01:30

so any dir in set-env! is cleaned and deleted?

richiardiandrea21:01:45

because at the moment I have control in my fixture :once

(defn clone-repo [f]
  (let [tmp (tmp-dir!)
        pod (pod-future (boot/get-env) pod-new-env)]
    (println "Cloning the repo in" tmp)
    (git-clone-in-pod @pod uri (.getAbsolutePath tmp) remote branch)
    (f)
    (purge-dir! tmp)))

micha21:01:17

well i was thinking you could use tmp-dir! to create a scratch space for yourself

micha21:01:26

that directory will be deleted the next time boot runs

micha21:01:38

so if boot crashes for isntance you can still see what files are in the temp dir

micha21:01:59

in your test namespace you can create and delete subdirectories of that one

micha21:01:20

the purpose is to let boot create a sandbox directory that will be cleaned up by boot

micha21:01:33

and you can then freely create your own subdirectories of that

richiardiandrea21:01:39

understand, loud and clear ๐Ÿ˜„

micha21:01:43

is the code you pasted running in a pod?

richiardiandrea21:01:02

no, it is a fixture (use-fixtures :once clone-repo)

richiardiandrea21:01:22

only git-clone-in-pod

richiardiandrea21:01:29

runs stuff in a pod

micha21:01:46

this function is run by boot-test, though?

richiardiandrea21:01:52

because is the function under test

richiardiandrea21:01:19

it works smoothly right now but as usual any feedback/improvement is welcome

richiardiandrea21:01:54

still WIP ๐Ÿ˜„

martinklepsch21:01:38

@richiardiandrea: link 404s for me simple_smile

richiardiandrea22:01:13

oh wait a sec ๐Ÿ˜„

richiardiandrea22:01:38

so that means that inside boot-test I don't actually have an env unless I create my pod

richiardiandrea22:01:47

ok it makes sense

micha22:01:44

you don't have access to boot.core namespace

micha22:01:06

but you do have an env, you can see it at boot.pod/env

micha22:01:26

so instead of (core/get-env) you can do boot.pod/env

richiardiandrea22:01:09

can I dump pod deps/classpath?

micha22:01:19

all the things you have in get-env are there

micha22:01:38

read-only though, naturally

micha22:01:56

@richiardiandrea: ^^