Fork me on GitHub
#boot
<
2016-01-18
>
richiardiandrea00:01:50

so if I want to use when or do in a pod, I need to include clojure.core of course right?

richiardiandrea00:01:54

and every single symbol will need fully qualified namespace (e.g.: clojure.core/when) ?

micha00:01:27

@richiardiandrea: clojure.core is referred into all namespaces, in pods too

micha00:01:46

and the default namespace when you evaluate expressions in a pod is pod

micha00:01:44

that function prepares a newly constructed pod

micha00:01:54

it's called when you make a new pod, before the pod is returned

richiardiandrea00:01:42

maybe I will have a pod-util if it grows too much

richiardiandrea00:01:14

the doc string of my util functions states what deps they need

richiardiandrea00:01:53

this can evolve in having metadata, :pod-deps for instance, for documentation purposes

micha00:01:35

those functions that will run in a pod

micha00:01:42

you can make a separate namespace for them

micha00:01:48

then just load that namespace, no?

micha00:01:18

(with-eval-in pod
  (require '[pod-namespace :refer :all])
  ...

richiardiandrea00:01:20

yeah, better, I would need to require them in the pod ๐Ÿ˜„

richiardiandrea00:01:30

right, I had not thought about it

micha00:01:39

that's what i usually do

richiardiandrea00:01:15

it is definitely a better solution, and you don't need to fully qualify symbols

micha00:01:48

also you can do things like this

micha00:01:09

(with-eval-in pod
  (defn f [x] (+ x 100)))

micha00:01:12

and then later you can do

micha00:01:25

(with-eval-in pod
  (f 42))

micha00:01:31

and you get 142

richiardiandrea00:01:51

isn't there an implicit do in with-eval-in?

micha00:01:57

yes there is

micha00:01:20

yeah you could define f and also call it in the same eval-in

micha00:01:42

when you do def or defn that persists in the pod

micha00:01:01

like that defines #'pod/f

richiardiandrea00:01:13

understand, great

richiardiandrea00:01:21

tnx for the hint

richiardiandrea00:01:48

i am going to try in the test too, where I guess it is a bit different there

richiardiandrea01:01:17

@seancorfield: good job, boot new works nicely ๐Ÿ˜„

richiardiandrea01:01:23

a question is: does it support + options like: boot -d seancorfield/boot-new new -o . -t tenzing +reagent +divshot +test ?

jethroksy01:01:29

i'm trying to get my friend's machine to run boot

jethroksy01:01:36

its a windows machine, but he's using cygwin

jethroksy01:01:56

there's an error : unable to access jarfile: /usr/local/bin/boot

seancorfield01:01:11

@richiardiandrea I don't know what those options would do. Feel free to open an issue on GitHub outlining what you'd like to see supported. I'm open to adding any features that folks find useful.

seancorfield02:01:41

@jethroksy: not sure if Boot supports Cygwin? It's a funky environment. I use Boot on Windows with the plain command prompt and with Git Bash (although the REPL doesn't work in the latter).

jethroksy02:01:37

yeah he downloaded boot.exe and it just worked

jethroksy02:01:54

the boot.sh didn't work for him

seancorfield02:01:25

Ah, yes, that doesn't surprise me. Cygwin isn't really UNIX enough for a lot of things.

jethroksy02:01:44

a pity ๐Ÿ˜•

seancorfield02:01:20

I think it's the worst of both worlds. I recommend GOW - Gnu On Windows - which adds common UNIX utilities to the regular command prompt.

seancorfield02:01:54

It's not perfect but it's s lot less intrusive than Cygwin.

jethroksy02:01:39

have you heard of babun?

seancorfield03:01:53

@richiardiandrea: now I see what you're asking, Boot new already supports that.

seancorfield03:01:55

I thought you were asking for multiple templates (which would also be supported by using new multiple times in the pipeline with the --force option).

seancorfield03:01:06

@martinklepsch: am I right that with Tenzing you'd say lein new tenzing myapp -- +divshot +test etc? If so @richiardiandrea should be able to do boot new -t tenzing -n myapp -a +divshot -a +test yes?

richiardiandrea04:01:47

@seancorfield: good! sorry I did not know let me try

richiardiandrea04:01:23

@seancorfield: I tried and replied, still something off I guess, I will check if my setup is good

seancorfield04:01:39

The extra args worked when I tried the Frege template. Will take a look at Tenzing tomorrow.

richiardiandrea04:01:14

yes tomorrow for me as well ๐Ÿ˜„

onetom05:01:30

I was just setting up our environment on a clean machine and surprisingly I saw many clojure versions being downloaded:

onetom05:01:43

> boot dev
Starting reload server on 
Writing boot_reload.cljs...
2016-01-18 13:24:49.601:INFO::clojure-agent-send-off-pool-0: Logging initialized @6435ms
2016-01-18 13:24:49.646:INFO:oejs.Server:clojure-agent-send-off-pool-0: jetty-9.2.10.v20150310
2016-01-18 13:24:49.679:INFO:oejs.ServerConnector:clojure-agent-send-off-pool-0: Started ServerConnector@34b7309c{HTTP/1.1}{0.0.0.0:3104}
2016-01-18 13:24:49.680:INFO:oejs.Server:clojure-agent-send-off-pool-0: Started @6514ms
Started Jetty on 
Retrieving clojure-1.3.0.jar from 
Retrieving clojure-1.6.0.jar from 
Retrieving clojure-1.6.0.jar from 
Retrieving clojure-1.2.1.jar from 
Retrieving clojure-1.4.0.jar from 
Retrieving clojure-1.5.1.jar from 
Retrieving commons-codec-1.8.jar from 
Retrieving clojure-1.5.1.jar from 
...

onetom05:01:27

i suspect different pods require different versions of clojure, but still it's too many versions, no?

onetom05:01:09

i have [org.clojure/clojure "1.7.0" :scope "provided"] in build.boot though but since it's not a library, i guess shouldn't say :scope "provided"? though technically it's provided by boot, no? it provides the version from boot.properties, no?

seancorfield05:01:17

@richiardiandrea: I just tried the Tenzing template (we ended up watching TV longer than I expected) and it works fine for me locally so whatever I'm doing with the leiningen-core library in Boot new is breaking on something you have in your ~/.lein/profiles.clj ๐Ÿ˜ž

richiardiandrea05:01:23

Oh thanks! no access to my pc now but I will share the file tomorrow, or if there is a way, i will enable debug mode and report

seancorfield05:01:41

I had a feeling there would be a number of edge cases in Leiningen's behavior that I'd end up having to debug, figure out, and then support somehow simple_smile

jethroksy09:01:49

@seancorfield: i'm using boot-expectations, and a single test takes 12s to run on my computer

jethroksy09:01:52

is this normal?

martinklepsch09:01:57

@jethroksy using watch task I assume?

jethroksy09:01:59

the assertion itself was 20msec

martinklepsch09:01:19

Do you have any slow to require namespaces in the test namespace?

jethroksy09:01:47

how do I profile that

martinklepsch09:01:43

Boot-test uses a fresh pod (Clojure runtime) for every test run and I believe boot-expectations does the same - because of that you might pay for that kind of thing for every run

martinklepsch09:01:56

(There are ways to avoid that)

martinklepsch09:01:29

@jethroksy: in a fresh repl that has not required anything require the namespace and see how look it takes

martinklepsch09:01:40

Maybe time helps

martinklepsch09:01:07

Datomic has been a culprit in that regard previously

jethroksy09:01:44

my namespace requires were super fast

martinklepsch09:01:08

Can you paste the complete test ns?

martinklepsch09:01:58

And are you 100% certain that those namespaces haven't been required previously in the repl session? (E.g. Via your init-ns)

jethroksy09:01:25

yeah functions i defined are inaccessible until my require

jethroksy09:01:37

I'm not sure what you mean by my test ns

jethroksy09:01:46

the ones required for my tests to run?

jethroksy09:01:00

(ns edubot.test-slack-util
  (:require [edubot.slack-util :as sut]
            [expectations :refer [expect]]))

jethroksy09:01:29

(time (require 'edubot.slack-util))
"Elapsed time: 0.17587 msecs"

(time (require 'seancorfield.boot-expectations) )
"Elapsed time: 0.144637 msecs"


martinklepsch09:01:57

No more like the actual test namespace

martinklepsch10:01:09

Including the tests in it

jethroksy10:01:14

how would i get that

jethroksy10:01:23

a little confused ><

pesterhazy10:01:47

Is there a migration guide for the explicit target directory change in the latest boot?

pesterhazy10:01:33

https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-03.md explains the target task, but I don't see it mentioned in the official docs

pesterhazy10:01:00

Also I'd be interested in an explanation how using comp in build.boot affects the order of execution. Does it matter if target (or other tasks) go at the beginning or end (or middle) of the comp chain?

pesterhazy10:01:59

@jaen, I disagree. If people upgrade to latest boot and see a deprecation warning, they should not be required to browse the source to find out what's going on.

pesterhazy10:01:49

I guess what I'm saying is, any reason not to add a note to the wiki about this? (easy to google!)

jaen10:01:17

Well, boot target --help is not source, but other than that I agree - note could say something about doing boot target --help to get an explanation.

pesterhazy10:01:16

actually, I'd strongly prefer a web site somewhere that explains the core tasks

pesterhazy10:01:56

the only place boot tasks are documented right now is in the --help cli, but sometime you can't access that

pesterhazy10:01:14

(e.g. you may have a borken build.boot and boot doesn't start)

jaen10:01:34

That is a good idea, think. It's certainly more handy than navigating to built_in.clj, it usually takes me a while before I remember where the file is in the sources.

jaen11:01:32

I imagine it shouldn't be that hard to write a markdown help generator (so it's always up to date) from the task description and add some preface.

pesterhazy11:01:54

should be automatically generated for sure

magomimmo11:01:46

@jaen: I also agree with @pesterhazy about an explanation on the tasks order. modern-cljs is for beginners and boot is used only as a build tool, even when it has to explain something more than the official guide to make the things clearer. I remember that while writing the tutorials I had the feeling of adding something on the tasks order more excplicit, but I should have introduce the different behaviour of comp when used with transducersโ€ฆ.I could eventually add it, if you think itโ€™s useful. Or you can help in doing that with a PR as well.

pesterhazy11:01:28

also I think it'd be awesome to have a boot guide for the new clojure site

pesterhazy11:01:36

they're accepting PRs now

pesterhazy11:01:55

there's a section for tools (still empty), so boot might be a great candidate

jaen11:01:00

I'm pretty sure it is on the site

pesterhazy11:01:45

@jaen, there's a "tools" section in the "guides" menu: http://clojure.org/guides/getting_started

jaen11:01:06

Oh, here.

jaen11:01:12

Yeah, it would be neat to get it there then

jaen11:01:13

@magomimmo: my remark wasn't about the task composition though. I was talking about boot tasks description and yes, I agree, a website that syncs to the current built-in task description would be neat.

magomimmo11:01:50

@jaen: ok. agree as well

jaen11:01:01

@pesterhazy: how about this for a simple example of how boot tasks work?

(defn task-one [next]
  (fn [value]
    (println "before one - " value)
    (let [result (next value)]
      (println "after one - " result)
      result)))

(defn task-two [next]
  (fn [value]
    (println "before two - " value)
    (let [result (next value)]
      (println "after two - " result)
      result)))

(defn task-one-builder []
  task-one)

(defn task-two-builder []
  task-two)

(def task-stack
  (comp (task-one-builder)
        (task-two-builder)))

(defn write-to-disk-or-something [value]
  (println "just doing muh job on - " value)
  {:result value})

(let [pipeline (task-stack write-to-disk-or-something)]
  (pipeline {:some "thing"}))

jaen11:01:23

That is, at least how I understand they work, someone please correct me if that's wrong - it's basically like Ring request cycle - go through all the middlewares and then back again.

martinklepsch11:01:53

@jethroksy: sorry for not replying earlier. I was referring to your test namespace as the file that has the test which is taking a long time to run

jethroksy11:01:21

@martinklepsch: that would be just the two namespaces i pasted

jethroksy11:01:31

profiled to total 0.35msec

magomimmo11:01:41

@pesterhazy: yep. someone should add boot to the clojure getting started guide. I would leave this task to the boot maintainers, because that section is very sensitive

jethroksy11:01:11

let me try and see if i can replicate that in a small project

martinklepsch11:01:19

@jethroksy: not just the namespace form but the whole file please (if possible)

jethroksy11:01:44

(ns edubot.test-slack-util
  (:require [edubot.slack-util :as sut]
            [expectations :refer [expect]]))

(expect 1 1)

martinklepsch11:01:12

Oh ok. Have you tried rerunning with the edubot.slack-util dependency removed?

jethroksy11:01:07

(ns edubot.test-slack-util
  (:require #_[edubot.slack-util :as sut]
            [expectations :refer [expect]]))

(expect 1 1)

jethroksy11:01:18

Elapsed time: 12sec

martinklepsch11:01:48

@jethroksy: just to double check: you said you're using watch task โ€” is 12s for the first run or every run after a file change?

jethroksy11:01:00

I tried changing the test to fail

jethroksy11:01:21

the copies are instant I have verbose on true for watch

jethroksy11:01:50

@martinklepsch: its definitely my project

jethroksy11:01:02

just created a test project

jethroksy11:01:24

Starting file watcher (CTRL-C to quit)...

Retrieving tools.reader-0.9.1.jar from 

Ran 1 tests containing 1 assertions in 8 msecs
0 failures, 0 errors.
Implicit target dir is deprecated, please use the target task instead.
Set BOOT_EMIT_TARGET=no to disable implicit target dir.
Elapsed time: 7.488 sec


failure in (test_bar.clj:4) : foo.test-bar
(expect 1 2)

           expected: 1 
                was: 2

Ran 1 tests containing 1 assertions in 16 msecs
1 failures, 0 errors.
clojure.lang.ExceptionInfo: Some tests failed or errored
    data: {:test 1,
           :pass 0,
           :fail 1,
           :error 0,
           :run-time 16,
           :ignored-expectations 0,
           :type :summary}
                          clojure.core/ex-info               core.clj: 4593
seancorfield.boot-expectations/eval90/fn/fn/fn  boot_expectations.clj:   64
          boot.task.built-in/fn/fn/fn/fn/fn/fn           built_in.clj:  264
             boot.task.built-in/fn/fn/fn/fn/fn           built_in.clj:  264
                boot.task.built-in/fn/fn/fn/fn           built_in.clj:  261
                           boot.core/run-tasks               core.clj:  794
                             boot.core/boot/fn               core.clj:  804
           clojure.core/binding-conveyor-fn/fn               core.clj: 1916
                                           ...                             
Elapsed time: 2.437 sec

jethroksy11:01:45

nvm i'll figure it out. thanks!

malesch14:01:48

How is an easy way to add a TmpDir to a fileset without overwriting already existing entries?

micha14:01:23

@malesch: you can do it by specifying a :mergers` option you pass to the add-... function

micha14:01:28

(-> fileset (add-resource tmpdir :mergers [[#".*" boot.pod/first-wins-merger]]))

juhoteperi15:01:50

@micha: Do you have example Dockerfiles for use with boot-beanstalk?

micha15:01:20

@juhoteperi: i can look for one

micha15:01:31

i've been using the eb tool lately

juhoteperi15:01:06

Do you copy the repo contents to container and run boot inside container, or copy the artifacts into container?

micha15:01:44

i usually just run boot in the container as the ENTRYPOINT

micha15:01:57

so far it's been reliable

juhoteperi15:01:08

But it means that it has to compile Cljs when it starts?

micha15:01:31

oh, we separate frontend and backend

micha15:01:44

frontend is static, deployed to s3

micha15:01:29

the containers are a bit slow to start though

micha15:01:39

not sure if that's just a general beanstalk thing though

micha15:01:15

@jaen, @pesterhazy there are autogenerated api docs, inluding the built-in tasks here: https://github.com/boot-clj/boot/tree/master/doc

pesterhazy16:01:28

@micha, thanks for adding the link to modern-cljs!

martinklepsch16:01:38

@pesterhazy: see you at ClojureBridge this weekend?

pesterhazy16:01:43

those API docs are terribly useful, @micha, it'd be great if they was a more prominent link, e.g. in the "Tasks" section of the wiki

martinklepsch16:01:47

I'm in the process of writing a guide for perun, maybe you'd like to give it a try at some point

pesterhazy16:01:48

it's not obvious that "api docs" include "task descriptions"

micha16:01:41

@pesterhazy: feel free to edit as you wish simple_smile

micha16:01:14

those generated docs will be created for each tagged release, btw

micha16:01:32

so you can go to any tag and get the docs for that tag in github

pesterhazy16:01:53

yup, I've submitted a few PRs already

martinklepsch16:01:20

https://github.com/mjmeintjes/boot-react-native/issues/13 โ€” "without building a new jar for every change" with boot watch build-jar you can build the jar when things change without needing to do anything

micha16:01:51

the checkouts situation in 2.6.0-SNAPSHOT is better than what is available in 2.5.5 btw

micha16:01:39

it is (i think) almost identical behavior as when you have the dependency as a jar

micha16:01:11

(eg, all tasks, even uber and jar work the same, etc)

micha16:01:57

the contents of the checkout dep jar are not in the fileset with 2.6.0-SNAPSHOT --checkouts option

micha16:01:10

they're just on the classpath, like with a normal jar

pesterhazy16:01:52

@micha, added a note about API docs here: https://github.com/boot-clj/boot/wiki/Tasks (grey "note" at the top)

martinklepsch16:01:52

added a which can be shown via boot taskname --help bit

micha16:01:49

๐Ÿ‘

malesch17:01:23

@micha Thanks a lot. I will give it a try!

jaredly18:01:14

I have a js file that I want to be able to require using :foreign-libs โ€” Iโ€™m sure I just have the configuration off a bit, it keeps not working. does anyone have an example project that does this?

micha18:01:12

is your js file a google closure namespace? like it can be compiled with advanced optimizations right?

micha18:01:36

oh wait disregard that

jaredly18:01:22

ohh was changing the wrong task facepalm

jaredly18:01:35

woot it works. btw was pretty confusing to have this issue https://github.com/adzerk-oss/boot-cljs/issues/35 closed as โ€œwontfixโ€ โ€” I thought at first there was no way to do it

raywillig19:01:01

@jaredly: I think you can also accomplish that with a deps.cljs file in your boot classpath

samflores19:01:35

is Boot expected to load a file named user.clj when I run boot repl?

micha19:01:44

@samflores: i think that's built into the repl, yes

micha19:01:54

i mean not boot-related, a general clojure repl thing

micha19:01:11

user.clj needs to be on the classpath though

micha19:01:16

when the repl is started

samflores19:01:35

I'm declaring :source-paths #{"src" "dev"} and putting the file in the dev directory. I thought that would be enough.

micha19:01:46

yes that shold work

micha19:01:54

can you do (in-ns 'user) in the repl?

micha19:01:08

or boot repl -n user

micha19:01:15

that works for me...

samflores19:01:45

the second approach worked, but starting with boot repl and changing to (in-ns 'user) did not

micha19:01:56

you need to do (require 'user) too

micha19:01:02

before in-ns

samflores19:01:14

oh, that makes sense ๐Ÿ˜„

micha19:01:20

to compile the namespace, yeah

micha19:01:50

you can do this, too

micha19:01:22

(task-options!
  repl {:init-ns 'user})

micha19:01:39

then that will be the default namespace for repl task

seancorfield23:01:10

Boot new now has support for Boot templates and has app, default, template built-in (`task` is there too but has not yet been worked on so it is broken a.t.m.): boot -d seancorfield/boot-new:0.2.0-SNAPSHOT new -t app -n myapp produces myapp Boot-based project that you can boot run, boot test, and boot build to produce a standalone JAR.

seancorfield23:01:01

Iโ€™ll get task "working" and then cut an 0.2.0 release and gather feedback on what the ideal Boot task template should look like.

seancorfield23:01:37

Then Iโ€™m going to look at https://github.com/weavejester/lein-generate and do something similar for Boot generators and cut an 0.3.0 release.

richiardiandrea23:01:14

is util/dbug working generally within with-eval-in ?

yenda23:01:48

I like what you are doing with boot new seancorfield