Fork me on GitHub
#boot
<
2017-02-14
>
onetom03:02:49

How come a downgrade is recommended in this case?

pair@fox /p/tmp> boot -d philoskim/debux:0.2.1 show -u
Retrieving maven-metadata.xml from  (1k)
[philoskim/debux "0.2.0"]

onetom03:02:03

also

> boot -d environ:1.1.0 show -u
Classpath conflict: org.clojure/clojure version 1.9.0-alpha14 already loaded, NOT loading version 1.5.1
Retrieving maven-metadata.xml from  (1k)
[environ "1.0.2"]

onetom03:02:12

wow, i found significant boot-up time contributor:

boot.user=> (time (require 'buddy.auth.middleware :reload-all))
"Elapsed time: 856.008374 msecs"

onetom03:02:58

because it's loading instaparse (i can see it w the :verbose option)

onetom03:02:38

(an that's on a 3.2GHz i5 Skylake, 24GB RAM, 6MB L3 cache)

alandipert03:02:57

what if you run it again?

alandipert03:02:43

boot.user=> (dotimes [_ 10] (time (require 'buddy.auth.middleware :reload-all)))
"Elapsed time: 1734.089318 msecs"
"Elapsed time: 1428.841853 msecs"
"Elapsed time: 1645.468317 msecs"
"Elapsed time: 1390.314959 msecs"
"Elapsed time: 1302.180635 msecs"
"Elapsed time: 1256.454168 msecs"
"Elapsed time: 1184.596769 msecs"
"Elapsed time: 1134.395214 msecs"
"Elapsed time: 1159.823145 msecs"
"Elapsed time: 1113.830371 msecs"

onetom07:02:53

(dotimes [_ 10] (time (require 'buddy.auth.middleware :reload-all)))
"Elapsed time: 784.197751 msecs"
"Elapsed time: 748.213749 msecs"
"Elapsed time: 701.835304 msecs"
"Elapsed time: 709.553609 msecs"
"Elapsed time: 715.873056 msecs"
"Elapsed time: 729.215705 msecs"
"Elapsed time: 723.07217 msecs"
"Elapsed time: 743.959333 msecs"
"Elapsed time: 765.506379 msecs"
"Elapsed time: 738.188335 msecs"

Niclas09:02:46

Let's say I have two separate tasks, one for building a project and one for serving the compiled resources:

(deftask build
  ...)

(deftask serve
  ...)
Is there a way to combine both these tasks to run in parallell within a single task, like:
(deftask build-and-serve
  ...)
... so that one doesn't have to run them in separate shell instances?

onetom10:02:34

@looveh what is the result of "building a project"? i suspect you are using the target task to output some files at the end, right?

Niclas10:02:09

@onetom It is, in this case the serve task is a task that wraps a cli command, without any regards to the fileset concept

onetom10:02:46

i see... that goes a bit against the boot fileset concept, so im not sure how to handle that case easily.

bhagany12:02:33

@looveh The first thing I would try is something like (comp (serve) (watch) (build) (target))

bhagany12:02:21

That would start your server once, and then rerun your build process on file changes, while your original server keeps running.

ska16:02:33

Hi. I wonder if there is an approved or built-in way for creating an output file based upon an input file with some templating applied (replace variables in the input file with build-time values). Like the filtering in Maven.

alandipert16:02:59

i made a task like this recently,

(require '[boot.core :as core]
         '[boot.util :as util]
         '[ :as io])

(core/deftask string-template
  "Does the thing"
  [f template-file VALUE str "Name of the template file to use"
   t target-file VALUE str "Name of the output file to produce"
   p placeholder VALUE str "The placeholder to recognize and replace"
   c content VALUE str "Content to replace placeholder with"]
  (core/with-pre-wrap [fs]
    (let [tmpd (core/tmp-dir!)]
      (if-let [template-file (some->> (core/input-files fs)
                                      (core/by-name [template-file])
                                      first
                                      core/tmp-file)]
        (let [template-content   (slurp template-file)
              output-file        (doto (io/file tmpd target-file) io/make-parents)
              quoted-placeholder (java.util.regex.Pattern/quote placeholder)]
          (spit output-file (.replaceAll template-content quoted-placeholder content))
          (-> fs
              (core/add-resource tmpd)
              commit!))
        (throw (ex-info "No template file found" {:opts *opts*}))))))

alandipert16:02:19

used like

(string-template :template-file (or template-file "template.html")
                   :target-file (str (name route) ".html")
                   :placeholder "{{CONTENT}}"
                   :content (route-content route))

alandipert16:02:05

oh yeah, i need to disavow that thing

alandipert16:02:20

stringtemplate, way more complicated than necessary

juhoteperi17:02:00

the snippet also creates new tmp-dir each call, as it is inside with-pre-wrap

vinnyataide19:02:20

Hello how can I make this task

(deftask dev []
  (comp
    (environ :env {:http-port "3000"
                   :db-uri "datomic:"})
    (watch)
    (notify :visual true :title "CLJS")
    (system :sys #'dev-system :auto true :files ["handler.clj"])
    (reload :ids #{"js/app"})
    (cljs-repl :ids #{"js/app"})
    (cljs :source-map true
          :ids #{"js/app"}
          :compiler-options {:parallel-build true
                             :compiler-stats true})))
work the same as in terminal command, the terminal command works fine but when I do boot repl and run the (dev) fn it just returns an object[clojure.core$comp...

vinnyataide19:02:41

I think it does have something to do with the comp fn but I don't know how to make it keep watching files and running

geoffs19:02:32

not sure how you’re calling it from the repl, but my guess is you’re just doing (dev) you just need to wrap it in a call to the boot function like this: (boot (dev))

geoffs19:02:02

tho that’s the second time that’s come up in a few days 🙂 maybe the README needs to mention it more prominently or in more places :thinking_face:

vinnyataide19:02:17

there's this part

You can start a REPL in the context of the boot script (compiled as the boot.user namespace), and build interactively too:
boot.user=> (boot (pom) (jar) (install))
that explains, I was not paying attention

vinnyataide19:02:02

that remains a question, why it says repl when there's no repl task in the boot command?

richiardiandrea19:02:10

have you guys ever encountered:

java.lang.Exception: Multiple jar entries match: .*/pom.xml
clojure.lang.ExceptionInfo: Multiple jar entries match: .*/pom.xml

richiardiandrea19:02:20

when installing an uberjar?

geoffs19:02:10

hmm, installing or creating @richiardiandrea? I’ve seen something like it when building an uberjar recently. I forget if it was that exact error

richiardiandrea19:02:36

If I dump it to target no problem, when I use install this happens

geoffs19:02:02

@vinnyataide I think the implication there is that you start a repl from the command line with boot repl and then run whatever boot commands you want

richiardiandrea19:02:10

I see there is a --pom param

geoffs19:02:18

interesting...

richiardiandrea19:02:07

my META-INF/ indeed contains more than one pom.xml so I might need to specify that, or sift them away

richiardiandrea19:02:24

I am just having doubts, should the uberjar contain the META-INF info of your project only?

richiardiandrea20:02:25

it looks like there is services folder that is necessary for jackson for instance

richiardiandrea20:02:17

indeed using --pom succeeds

qqq20:02:42

I know how to use (doc ...); I know how to configure existing boot tasks. I sorta get how boot works. However, I really need to read a "boot from the ground up" or "design and implementation of boot"

qqq20:02:46

where can I pick up this knowledge?

donaldball20:02:36

The boot cognicast was pretty interesting, albeit from a broad perspective

qqq20:02:38

are there transcripts / slides somewhere? I like randoma ccess / ability to skim, whereas audiocast forces me to get info linearly, in the order / rate interviewer decides

angusiguess20:02:46

cognicast does have transcription, but it doesn't appear caught up to that episode yet.

qqq21:02:12

is anyone here using boot for auto completion? I have a problem where (1) I need ot parse some clj code, (2) I don't want to parse the code in elisp -- so my ideal solution is -- when a file gets recompiledby boot (due to watc), it also runs my persona "tag extractor" which then outputs a file emacs picks up for auto completion

richiardiandrea22:02:51

sounds like a good idea and not too complicated too achieve, either shalling out or using some kind of tag generator for clojure (does it exist?)

mobileink22:02:13

@qqq separate boot task to analyze the compiled code? https://clojuredocs.org/clojure.repl/source-fn

qqq22:02:39

@richiardiandrea @mobileink : so the ideal use case is: I put my mouse over a spec -- and another window displays the definition of that spec

qqq22:02:51

[except not quite spec, as I'm using something similar but not exactly spec]

richiardiandrea22:02:33

I use ctags in emacs for that kind of go to but it is not always reliable

richiardiandrea22:02:44

source in the repl works better for me

mobileink22:02:59

i have a similar situation (i think) where i need to examine fn definitions and reject those that do not fit the profile, and i cannot use a macro.

mobileink22:02:22

@qqq: how does watch correspond to hovering in the browser? i must be missing sth.

mobileink22:02:54

@richiardiandrea : i use global. i have tried several times to figger out the pros and cons of various "tags" tools and always ended up with a headache.

richiardiandrea22:02:02

@mobileink I copied a function from prelude for emacs that uses imenu but I don't know where it takes tags from 😞

mobileink22:02:41

been there done that. Is BTDT an acronym?