Fork me on GitHub
#boot
<
2015-12-24
>
seancorfield04:12:17

Switched several of our key build script steps from Leiningen to Boot today. We now have a top-level build.boot file, which is the first step toward retiring seven project.clj files (and ultimately retiring most of our Ant script, I hope!). We're running our Clojure unit tests via Boot now, with both 1.8.0-RC4 and master SNAPSHOT. All our DB teardown/setup/migration tasks are running via Boot as well now. Very hapy with the way this is all coming along. Thank you!!

juhoteperi09:12:00

Here is my solution to building multiple artifacts using one build.boot: https://github.com/Deraen/less4clj/blob/master/build.boot

juhoteperi10:12:39

Hmm, is it possible to run tests using different clojure versions with one boot process? that is, can I replace clojure version used by a pod with set-env?

onetom10:12:31

Is there an IntelliJ expert here who would be willing to help setting up Cursive with Boot? Is there a video explaining it?

onetom10:12:51

I have a lot of small questions and so far I was not able to achieve a setup where I can see both my hoplon repo and my castra api repo within the same window, properly recognizing all symbols, etc etc

onetom10:12:18

Im quite confused about the concepts of Projects, Modules, Content roots and whatnot

onetom10:12:31

and of course everything is about lein....

onetom10:12:13

I ran lein-generate of course and somehow I got my dependencies appearing in some dependency browser, but 1, adi was still not recognized as an existing lib 2, the deps contained clojure 1.6.0 only, but not 1.7.0

juhoteperi10:12:51

@onetom: Maybe you should add clojure 1.7.0 as direct dependency to Boot env? The lein-generate task uses the env to create project.clj deps and I think clojure dependency is not automatically added to env.

onetom10:12:59

We tried to use LightTable in the past ~3days for work but it just doesn't cut it really

juhoteperi10:12:14

And if there is no direct dep to clojure in env, it's possible that transitive dep is used.

onetom10:12:09

deraen: we tried to add it to the project.clj manually, but then what's next? when will that change be picked up? should the project.clj be version controlled too? because if it's not, then the repo dir is not really recognized as a "lein" project

juhoteperi10:12:38

I wouldn't add project.clj to VC, I would make sure the lein-generate generates the correct project.clj

genRaiy10:12:21

just trying to run the hoplon demos and it’s messing with my boot version (castra simple has a BOOT_VERSION=2.2.0). Should I update that to 2.5.2 and make a PR (I’ll check the others too!)

genRaiy10:12:18

oh, actually they all ask for 2.2.0

genRaiy10:12:09

I’ll fix and make a PR as it forces a DL of 2.2.0, which does not make for a good experience

genRaiy12:12:27

does anybody have an example boot file that uses credentials to access a repo (like datomic pro, in fact exactly datomic pro!)

genRaiy12:12:48

the examples on the WIKI seem over complex

genRaiy12:12:37

This seems a little complex to get a user name and password from the env

genRaiy12:12:42

;; Get credentials for Clojars from the environment.
(configure-repositories!
  (fn [{:keys [url] :as repo-map}]
    (->> (condp re-find url
           #"^\.org/repo"
           {:username (get-sys-env "CLOJARS_USER" :required)
            :password (get-sys-env "CLOJARS_PASS" :required)}
           #".*" nil)
         (merge repo-map))))

genRaiy12:12:20

I’ll do it to get over the hump, but just saying

juhoteperi12:12:40

An alternative would be to read the creds from Leiningen credentials.clj.gpg, it's not simple either but it's few lines less and it's not repo specific

genRaiy12:12:27

the GPG thing is a bit of a mare to grok and then to manage IMHO, at least on OS/X … I tried that and gave up … way too many moving parts

genRaiy12:12:50

lein actually supports this in a quite simple way, so maybe I have to think about whether I can add that to boot or find a less fiddly way that the code snippet

juhoteperi12:12:25

Hmm does Lein have some way to automatically read creds from env vars?

genRaiy12:12:55

but actually I’m misreading the docs

genRaiy12:12:01

(set-env! :repositories [["clojars" {:url ""
                                     :username (System/getenv "CLOJARS_USER")
                                     :password (System/getenv "CLOJARS_PASS")}]])

genRaiy12:12:07

is what I need

juhoteperi12:12:19

Yeah you can do that

genRaiy12:12:24

and that’s quite easy! Doh simple_smile

genRaiy12:12:05

with lein its like this

genRaiy12:12:10

:repositories {"" {:url      ""
                                   :username :env
                                   :password :env}}

juhoteperi12:12:43

The idea with configure-repositories is that different people in project might want to define the creds if different ways. So users can set their configure function on ~/.boot/profile.boot and project doesn't need to specify where the creds are retrieved from.

genRaiy12:12:47

so not much in it and a little less magic on boot

juhoteperi12:12:01

There's lots more magic on Lein impelementation simple_smile

juhoteperi12:12:40

I did implement the same for Boot but we decided to go with little different implementation

genRaiy12:12:00

nice, @juhoteperi thanks for your help

juhoteperi12:12:32

And I have creds for clojars and datomic in the gpg encrypted file

juhoteperi12:12:47

But yeah, I helped a friend to configure gpg in OS X and it was quite bad

juhoteperi12:12:51

Much easier in Linux

juhoteperi12:12:31

It should also be possible to implement a function which would read the creds from env, for example based on url hostname

juhoteperi12:12:02

IIRC Leiningen uses repo alias/name for the env variable name, but our configure function doesn't see that info

genRaiy12:12:15

got it (sorta) working just with the env

genRaiy12:12:26

so I’m happy with that but...

juhoteperi12:12:33

;; Reads creds from env. Uses URL hostname to build env variable name:
;;  -> MYDATOMICCOM_USER & MYDATOMICCOM_PASS
(configure-repositories!
 (fn [m]
   (let [n (-> (:url m)
               (.getHost (java.net.URL.))
               (clojure.string/upper-case)
               (string/replace #"\." ""))
         user (System/getenv (str n "_USER"))
         pass (System/getenv (str n "_PASS"))]
     (merge m (if (and user pass) {:username user :password pass})))))

juhoteperi12:12:45

Something like this could try to read the creds from env

genRaiy12:12:55

now it wants to download everything from datomic repo

juhoteperi12:12:20

Maybe we'll provide few of these functions in a library or in Boot core in future

genRaiy12:12:34

that’s much more straightforward

juhoteperi12:12:08

@raymcdermott: you should update :repositories value in env: (set-env! :respositories #(conj % ["datomic" {...}]))

juhoteperi12:12:19

Else you lose the default clojars entry

genRaiy12:12:50

where do I get the defaults from?

genRaiy12:12:08

the {…} 😉

juhoteperi12:12:29

That's the repo map for datomic

juhoteperi12:12:46

% is the current repositories list and that function just appends datomic to it

juhoteperi12:12:21

When a function is provided to set-env value, it works like update and call the function with current value to create the new value

genRaiy12:12:28

sorry I still don’t get it

genRaiy12:12:21

ah ok, I see now the current list is fed into the fn

juhoteperi12:12:57

It's a bit unfortunate that repositories are defined as a vector as it makes it quite hard to replace existing repos, but maybe there was a some reason for that...

genRaiy12:12:45

adding the fact that you need to use the function would be a good addition to the docs

mbertheau13:12:41

The documentation of so many clojure things reference stuff from the java world that I have no idea about. A bit frustrating!

mbertheau13:12:30

Task "aot", help: "Perform AOT compilation of Clojure namespaces."

mbertheau13:12:03

My simple task is to run some clojure code and have math.combinatorics available.

onetom13:12:32

@mbertheau: we were in the same situation a year ago. don't give up! this ecosystem is by far the best despite all of its warts (compared to perl, python, ruby, node, etc...)

juhoteperi13:12:31

I don't think AOT is a Java term

mbertheau13:12:00

@juhoteperi, yeah, AOT was not meant as an example of that.

juhoteperi13:12:16

But yeah I guess it's true

onetom13:12:22

Have u got this far: boot -d org.clojure/math.combinatorics:0.1.1 repl ?

mbertheau13:12:36

It's just that if I know what aot is I don't need the help text, and if I don't know what it is, then the help text doesn't help simple_smile

mbertheau13:12:32

@onetom: I have math.comp in :dependencies, currently I'm struggling with loading/requiring/useing my code in the repl.

onetom13:12:39

then: boot.user=> (use 'clojure.math.combinatorics) (tho use is discouraged if i understood well)

onetom13:12:24

good point, i had the same question when i was learning node and coffee, just as well clojure simple_smile

onetom13:12:20

boot.user=> (require '[my.code :refer :all] :reload-all) is ur friend for reloading stuff from the repl

onetom13:12:30

assuming u have a src/my/code.clj

mbertheau13:12:12

I have src/advent/night.cljs with (ns night). Ah. I need (ns advent.night).

onetom13:12:35

we've learnt the basics from http://www.braveclojure.com

onetom13:12:03

wait a sec, cljs?

onetom13:12:17

r u using planck?

mbertheau13:12:19

clj, sorry, doing mostly cljs, but right now it's clj simple_smile

onetom13:12:43

how come u r already doing cljs but u still have clj issues?

mbertheau13:12:11

Found enough templates to get me started so that I can concentrate on reagent

onetom13:12:27

i guess u r not using a repl for that, right? just reload the browser or boot-reload or figwheel does the reloading for u

mbertheau13:12:53

the boot repl also works as advertised

onetom13:12:17

we also started with cljs 1st and i got everyone to practice on https://github.com/swannodette/lt-cljs-tutorial

mbertheau13:12:18

We do use it although emacs cider integration is flaky.

mbertheau13:12:40

Yeah, I started with that too simple_smile

mbertheau13:12:01

Right now I can't load my code from boot repl, it says boot.user=> (require '[advent.night :refer :all]) java.io.FileNotFoundException: Could not locate advent/night__init.class or advent/night.clj on classpath

onetom13:12:25

show ur build.boot

mbertheau13:12:32

And I have (ns advent.night) in src/advent/night.clj now

mbertheau13:12:53

(set-env!
 :source-path #{"src"}
 :dependencies '[[org.clojure/math.combinatorics "0.1.1"]])

onetom13:12:57

do u have src specified as (set-env! :source-paths #{"src"})?

mbertheau13:12:07

Ah, did I miss an s

onetom13:12:39

maybe we should add a little sanitization there, no, @micha?

mbertheau13:12:07

So a number of small errors and oversights on my part led to all that. It works now simple_smile

onetom13:12:31

i've seen this issue hit several times by ppl asking for help on #C053K90BR

onetom13:12:56

i had the exact same type of issues at the beginning...

onetom13:12:12

we - as in the clojure community - need some good tutorials... 😕

mbertheau13:12:53

Also with boot documentation for the default tasks is a bit hard to find, afaik they are available only through boot help

onetom13:12:34

what do u mean? if u say boot it will show the built in tasks

onetom13:12:08

though i have to admit i rarely looked into those. not sure why... maybe the it's too much or the info is in the wrong order?...

mbertheau13:12:15

I was looking for that kind of info in the README or the wiki or the webpage.

onetom13:12:45

or maybe it was not so nicely formatted in the past?

onetom13:12:42

i think the problem w having such info in the README or the wiki is that needs maintenance and these tasks were in flux this year

onetom13:12:11

maybe they are solidified enough to be duplicated elsewhere than the only the source code

mbertheau13:12:39

Or they could be in a readme in the repo as well that can be kept in sync with the code

onetom13:12:06

on that note if u have an idea where would u expect to see the list of tasks in the wiki, just copy it there pls. it's a wiki after all; no permission necessary to edit it i guess

mbertheau13:12:37

Alright, thanks for the info simple_smile

onetom13:12:18

the edits are also mentioned here on slack automatically (hopefully) so we are very aware of them and we can quite immediately discuss it right here

magomimmo17:12:45

from @martinklepsch to any booter: boot -d boot/greet:2015 greet

juhoteperi17:12:15

Hmh, I wonder where we should mention this boot.properties problem.

juhoteperi17:12:22

Should be pinned to top of readme probably.

micha17:12:28

@juhoteperi: i was thinking of pushing a new version of boot-bin that fixes this

juhoteperi17:12:36

Ah, even better.

micha17:12:53

i hardcoded in the unsupported versions and it warns the user then updates them to latest

micha17:12:10

since those versions are enumerable why not, right?

micha17:12:48

i'm going to try to get a windows 10 machine in the cloud today

micha17:12:56

any recommendations?

micha17:12:59

for testing boot

micha17:12:18

ms has vms on their site but i can't download them on my home internet

micha17:12:30

it would take all day at the speed i get

juhoteperi17:12:55

In addition to saying that version is no longer supported, I think it would be good to mention how to remove boot.properties to fix the problem

juhoteperi17:12:27

Or are old versions ignored?

micha17:12:34

@juhoteperi: when it updates it should fix their boot.properties automatically

micha17:12:56

i guess if they have a boot.properties in the cwd though

micha17:12:47

i'll test that

micha17:12:27

ok it works, but maybe not ideally

micha17:12:55

if i have a boot.properties in the cwd with say 2.0.0-rc12, it prints the warning but runs a supported version

micha17:12:31

i guess that's ok

micha18:12:31

@martinklepsch: new version of boot-bin released today, 2.5.2

micha18:12:36

also happy holidays!

martinklepsch18:12:53

@micha happy holidays! Not sure if I'll get to updating homebrew in the next two weeks just fyi :)

micha18:12:10

haha i figured as much

flyboarder22:12:45

@micha: I’d be willing to donate an azure VM to the boot core devs

micha22:12:02

@flyboarder: that would be awesome!

flyboarder22:12:05

np, i’ll set something up

micha22:12:41

thanks a lot! simple_smile

flyboarder22:12:26

@micha: <mailto:[email protected]|[email protected]> can you shoot me an email and i’ll send over the credentials

flyboarder23:12:48

details away