Fork me on GitHub
#boot
<
2017-01-24
>
qqq06:01:21

Where is the documentation on writing new boot tasks from scratch? Suppose I wanted to wwirte a task whose only job in life was (clojure.java.shell/sh "cp" "foo" "bar")

qqq06:01:25

https://github.com/boot-clj/boot/wiki/Tasks <-- weird, do I need to pass some fileset around?

martinklepsch06:01:28

@qqq

(deftask cp
  []
  (with-pass-through _
    (clojure.java.shell/sh “cp” “foo” “bar”)))
I think that should work

martinklepsch06:01:15

@qqq all tasks get and return filesets by design but there’s the with-pass-through helper to to the kind of thing you want to do (i.e. plain side effects)

martinklepsch06:01:25

@qqq Once you have something working please consider extending that wiki page to include with-pass-through 🙂

qqq06:01:48

@martinklepsch : minor correction: on my version of boot, with-pass-through seens to have been renamed with-pass-thru ; do I need to update my boot?

martinklepsch07:01:37

@qqq ah, no, it’s with-pass-thru, my mistake

qqq07:01:02

as penance, you should update the wiki 🙂

qqq07:01:13

(I'm kidding -- thanks for your help!)

martinklepsch07:01:16

haha, you’re welcome 🙂

alqvist13:01:16

Where should I put load-data-readers If I want to be able to use clojure.edn/read-string?

alqvist13:01:30

Using datomic and #db/id

alqvist13:01:48

java.lang.RuntimeException: No reader function for tag db/id

pesterhazy14:01:11

looks like this is being done done in boot: https://github.com/boot-clj/boot/pull/439/files

pesterhazy14:01:21

@alqvist are you on latest boot?

alqvist14:01:30

@pesterhazy 2.7.1

martinklepsch14:01:56

@alqvist I think you may need to do that for pods individually — try googling I think there should be a few good results

martinklepsch14:01:06

I think the gist is to use something like this but probably there’s a better/simpler solution by now:

(#'clojure.core/load-data-readers)
(set! *data-readers* (.getRawRoot #’*data-readers*))

pesterhazy14:01:17

you could try adding this to your build.boot: (boot.core/load-data-readers!)

martinklepsch14:01:28

boot.core/load-data-readers!

martinklepsch14:01:50

yeah! @pesterhazy was faster ;D

pesterhazy14:01:34

just add it just after set-env! ...

pesterhazy14:01:05

off-topic but I just solved the SICP eight queens problem 🙂

pesterhazy14:01:27

status: feeling good about myself

martinklepsch14:01:25

congrats! (don’t know the problem. reminds me that I should get back to SICP some day)

martinklepsch14:01:33

You doing it in clojure?

pesterhazy14:01:51

debugging with racket is really hard for me

pesterhazy14:01:08

I'm using #lang sicp but that's a very basic language 🙂

pesterhazy14:01:25

so I had this bug slash misunderstanding

martinklepsch14:01:41

Racket is nice and weird at the same time somehow, I just can’t wrap my head around the idea that someone thought it would be a good idea to be able to return multiple values 😄

pesterhazy14:01:43

and you sort of forget how you use pretty-printing and other tools to debug

alandipert14:01:13

@martinklepsch it's a perf thing

pesterhazy14:01:40

I feel like in a foreign and deceptively familiar country, but I don't know what to do when I need help

alandipert14:01:14

> He [Rich] left out multiple value returns exactly on the grounds that the consing cost for a small returned value is so cheap these days, ephemeral GC's being so damned good. Dan Weinreb http://blog.h2o.ai/2008/11/a-brief-conversation-with-david-moon/

alandipert14:01:44

returning multiple values on old lisps was nice because you could put each value in a register and pay no added GC cost

alandipert14:01:00

arguably still nice today.. for that reason

alqvist14:01:05

Thanks to both of you. Seems like I must provide an argument to clojure.edn/read-string something like: (clojure.edn/read-string {:readers *data-readers*} (slurp "schema.edn))

alqvist14:01:19

seems to work

martinklepsch14:01:01

@alandipert cool link, thanks!

alqvist14:01:32

I don't understand why read-string doesn't use it by default, but there is always a reason.

martinklepsch14:01:57

@alqvist did you try the approach @pesterhazy suggested?

alqvist14:01:58

supposedly not deterministic

alqvist14:01:21

Yeah, I was already doing it before

alqvist14:01:37

But it won't work without arguments to read-string

pesterhazy14:01:38

yeah looks like only clojure.core/read-string takes default-data-readers into account

pesterhazy14:01:06

clojure.edn/read-string expects readers to be passed explicitly

pesterhazy14:01:50

probably a good idea because default-data-readers is an "implicit argument", could be confusing

alqvist14:01:14

You are probably right - Thanks for the help

qqq20:01:24

shoud my boot version in build.boot and build.properties match ? Is it okay to have build.boot use 1.9.0-alpha14, and build.properties say 1.7.0, or should they both be 1.9.0-alpha14 ?

micha20:01:20

you mean BOOT_CLOJURE_VERSION?

alandipert20:01:42

since it's usually best if they match

qqq20:01:01

yes, should build.properties/BOOT_CLOJURE_VERSION and build.boot/set-env!/:depenedencies/org.clojure.clojure versions match ?

alandipert20:01:30

yeah it's usually good for them to match

qqq20:01:39

how is ~(clojure.version) resolved ?

alandipert20:01:11

the build.boot file is executed with some version of clj, the one given by BOOT_CLOJURE_VERSION/boot.properties

alandipert20:01:21

calling (clojure-version) is a way to sense what version is running

alandipert20:01:29

it's clojure.core/clojure-version

qqq20:01:07

oh right, because there's nothing magical in boot, it's all literal clojure code

alandipert20:01:46

the semi-magical thing going on there is boot.core/template which is a templating macro like ` except it doesn't try to resolve symbols

qqq20:01:44

you know, slack should add a way people can 'tip' responses

qqq20:01:58

it would allow a way to 'bootstrap consulting'

alandipert20:01:13

maybe a bot?

qqq20:01:18

that is pretty smart, no slack integration required

alandipert20:01:31

i guess a 'hook' is the term

alandipert20:01:09

@micha how do you feel about supporting multline comments in boot files?

alandipert20:01:36

in order to support racket-style multiline shebang https://rosettacode.org/wiki/Multiline_shebang#Racket

micha20:01:11

i feel excellent about it

alandipert20:01:18

i almost got it without, kinda

alandipert20:01:20

#!/usr/bin/env bash
true; echo "hello from bash"
true; exec boot "$0" "[email protected]"

alandipert20:01:33

^^ all valid clj

alandipert20:01:54

problem with it is boot doesn't sense shebang

micha20:01:16

lol copy yourself to a temp file

alandipert20:01:23

yeah that works lol

alandipert20:01:29

but not useful because you want to stay in pwd

micha20:01:43

you can do that

alandipert20:01:44

maybe edit self in place, and un-edit with shutdown hook? lol

micha20:01:56

mktemp -d

alandipert20:01:59

oh, like copy to hidden randomly named file in cwd you mean?

micha20:01:05

i mean -p

alandipert20:01:45

less than ideal, since you can't always creat files in dirs you're exec-ing from

micha20:01:53

mktemp -p $PWD . or something

qqq20:01:31

(not to derail the topic) -- is this the legendary micha we needed to talk to about edit distance / potential optimizations for templates / lists ?

alandipert20:01:49

haha yes but best to do it in #hoplon

alandipert20:01:33

> ruby -x skips every line until the first Ruby shebang. This line must start with "#!" and must contain "ruby". (So "#!ruby" is the shortest shebang to work.)

mattyulrich21:01:50

I’m not sure if this is a fundamental misunderstanding of clojurescript or cljs-repl or boot or emacs (because all are relatively new to me) - but I can’t seem to figure out how to cider-eval-last-sexp against a running cljs-repl… am I misunderstanding cljs-repl ?

richiardiandrea21:01:37

@mattyulrich cider does not have support for cider-jack-in directly landing in a cljs repl

richiardiandrea21:01:57

you have to jack in, then execute start-repl, are you doing that?

alandipert21:01:00

declined by rich, so available for boot!

mattyulrich21:01:57

@richiardiandrea That was it… I think I had tried something like that initially, but thought it didn’t work because the start-repl didn’t put me back on a prompt.. Thanks for the help!

richiardiandrea21:01:46

@mattyulrich no problem, it is a bit annoying, I was planning to work on it a bit, glad it helped

mobileink21:01:53

@alandipert : bad idea to diverge from clojure in this way imho. where does it stop? there's no real problem here, i think. go with rich (TM). 😉

alandipert21:01:34

why's it bad not to stop?

alandipert21:01:58

i guess the further we get from clj, the less about build.boot you know if you already know clj

mobileink21:01:57

exactly. one language at a time, please. 😉

alandipert21:01:13

supporting multiline shebang is really handy tho

alandipert21:01:23

maybe there is another way. research will continue

mobileink21:01:30

strikes me as a shell language issue rather than a boot issue. must be a way without messing with the lang.

alandipert21:01:56

like any meaty problem there are many concerns

alandipert21:01:15

ultimately it's a developer convenience issue, and so is totally subjective

alandipert21:01:26

ie the problem statement begins at taste

alandipert21:01:19

that it's more convenient for me to write a single small boot shebang script instead of 2 scripts, 1 shell and 1 boot, and shell launches the boot one

mobileink21:01:26

well, i'm kinda out of my league here, but wtf. i would not want boot to make a special language thingie to support shellish stuff. otoh, shellish stuff is very useful. what about a micro-language, e.g. bootsh? i prolly should have thoughr about this some more before commenting. simple_smile

alandipert21:01:48

i definitely agree, alignment with clj is a good default

alandipert21:01:54

and this would be our first syntactic departure