Fork me on GitHub
#boot
<
2016-12-12
>
hagmonk01:12:42

does anyone have experience with wiring up boot and pedestal for a clojurescript application?

ryancole03:12:10

i feel like an idiot asking this, but how do you just run a clojure application, via boot? i see a ton of examples for clojurescript.

micha03:12:37

@ryancole how do you mean "run a clojure application" exactly?

micha03:12:48

a boot script is a clojure application

micha03:12:57

so you can do like

ryancole03:12:00

(i'm new to clojure) but with lein, i'd just do lein run

ryancole03:12:06

and it runs my main function

micha03:12:12

#!/usr/bin/env boot
(println "hello world")

micha03:12:30

yeah you can do that in boot easily

ryancole03:12:39

oh i see, so i'd make a task just literally just runs my functions?

micha03:12:11

(require '[my.ns :as my])

(defn -main [& args]
  (apply my/-main args))

micha03:12:18

that's the simplest way

ryancole03:12:52

i see, i see. that's cool.

micha03:12:07

oops sorry you want to do this:

micha03:12:46

#!/usr/bin/env boot

(defn -main [& args]
  (apply println args))

micha03:12:56

then you can do ./build.boot asdf qwer

micha03:12:59

for exampel

micha03:12:03

that's the simplest thing

micha03:12:19

if you want you can make a simple task to run the program

micha03:12:55

(require 'my.ns)

(deftask run []
  (my.ns/-main ...))

micha03:12:59

then you do boot run

ryancole03:12:13

i think i'll do it that way

ryancole03:12:59

last question of the night. is the set-env! parameter :source-paths how require, from inside build.boot, knows where to look?

alandipert03:12:22

require looks on the classpath, and set-env adds stuff to the classpath

alandipert03:12:53

although usually for clj code you want to use :resource-paths

alandipert03:12:30

That's for code that you want to ensure the build process and not be 'consumed', like .java

alandipert03:12:12

At this phase in your project tho the distinction is immaterial. Comes into play when you want to produce a standalone jar or war file

ryancole03:12:46

can set-env! be called from within a deftask? i've got a project that uses both clojure and clojurescript, with common stuff in cljc files. my directory structure has parent folders for clj, cljc and cljs. so something like: foo\src\clj\foo\core.clj, foo\src\cljc\foo\common.cljc, foo\src\cljs\foo\ui.cljs.

ryancole03:12:02

my task for running or building the clojure server needs to look in clj and cljc folders

ryancole03:12:14

task for clojurescript will look in cljs and cljc

ryancole03:12:22

i see the clojurescript plugin takes the paths as part of that task config process, but i dont think i need this global source-paths. i need that specific to the clojure task.

ryancole03:12:40

may not matter though if the clojurescript plugin uses it own settings, anyways.

alandipert03:12:34

Yes you can call it in deftask. But it's not scoped to the task, changes are still global. So it can impede task composability

alandipert03:12:46

In your case I'd recommend just adding them all at the top. Maybe consider adding your cljs code as :source-paths

alandipert03:12:03

Assuming this is an application it doesn't matter much what you choose

alandipert03:12:27

Usually you only need to be particularly discerning about what ends up in the jar when making a library

ryancole04:12:01

Hmm. I think I've got my build.boot configured, but I'm getting an error when trying to run my task.

ryancole04:12:31

And below is the error ...

PS C:\Users\Ryan\Projects\league-clj> boot start-server
        clojure.lang.ExceptionInfo: No value supplied for key: boot.core$run_tasks$fn__930@4067a2f2
    data: {:file
           "C:\\Users\\Ryan\\AppData\\Local\\Temp\\boot.user1679637778079149830.clj",
           :line 13}
java.lang.IllegalArgumentException: No value supplied for key: boot.core$run_tasks$fn__930@4067a2f2
                                      ...
org.httpkit.server/run-server/stop-server  server.clj:   51
                                      ...
                      boot.core/run-tasks    core.clj:  938
                        boot.core/boot/fn    core.clj:  948
      clojure.core/binding-conveyor-fn/fn    core.clj: 1916

ryancole04:12:53

I'm not sure if this is coming from httpkit or boot. The httpkit related code seemed to work fine when use via leiningen.

micha05:12:55

what is calling stop-server?

micha05:12:36

i think i see

micha05:12:40

what the problem is

micha05:12:50

(deftask start-server
  "Start the application server."
  []
  (run-server request-handlers {:port 8080})
  @(promise))

micha05:12:43

boot tasks return middleware functions that boot will call

micha05:12:48

this change with the promise will just block the pipeline and prevent boot from calling the stop-server fn that run-server returns

ryancole05:12:11

ooo yea i was confused why i saw the stop server call in there

mitchelkuijpers13:12:26

Hi I have a problem with a library we are using and I think it might be related to boot-pods and requiring namespaces in cljc: I think it might be going wrong wrong somewhere here: https://github.com/ladderlife/om-css/blob/master/src/main/om_css/core.cljc#L181

mitchelkuijpers13:12:45

I already created a issue for this: https://github.com/ladderlife/om-css/issues/39 Is there anyone who has a clue? It seems it creates a require block and then evals it so that might break according to this: https://github.com/boot-clj/boot/wiki/Boot-Troubleshooting#why-isnt-require-working-in-my-pod

pesterhazy13:12:35

FYI I've published boot-fmt, a library to auto-format Clojure project from Boot. The idea is to reduce cognitive load by leaving formatting to the machine (just like gofmt in the golang-universe). https://github.com/pesterhazy/boot-fmt

pesterhazy13:12:27

Feedback much appreciated!

mitchelkuijpers13:12:57

I will definitely try it out this week, my team is longing for something like this. We also do some elm and after a while you get so spoiled by elm-format

pesterhazy14:12:14

yeah, another inspiration!

mitchelkuijpers14:12:11

@pesterhazy Do you by any chance have any idea how you would configure the defui macro from om.next to get some nice output with zprint?

mitchelkuijpers14:12:14

(defui AnimalsList
  static om/IQueryParams
  (params [this]
    {:start 0 :end 10})
  static om/IQuery
  (query [this]
    '[:app/title (:animals/list {:start ?start :end ?end})])
  Object
  (render [this]
    (let [{:keys [app/title animals/list]} (om/props this)]
      (dom/div nil
        (dom/h2 nil title)
        (apply dom/ul nil
          (map
            (fn [[i name]]
              (dom/li nil (str i ". " name)))
            list))))))
I am not sure yet how to tackle this thing 😛

pesterhazy14:12:32

that's a tough one

pesterhazy14:12:15

I'd start with omitting the form (using ;!zprint {:format :skip})

pesterhazy14:12:37

that instructs zprint (or boot-fmt) to leave the next form alone

pesterhazy14:12:15

I 'mean the syntax looks pretty complicated (more complicated than defrecord etc.)

mitchelkuijpers14:12:36

Yeah it is basically the same expect the static keyword @pesterhazy

mitchelkuijpers14:12:19

I’ll play around some more with this, it should be possible

pesterhazy14:12:59

do raise an issue at https://github.com/kkinnear/zprint for better visibility

raywillig20:12:43

hi can someone explain this error i get trying to install boot to a new machine?

raywillig20:12:21

slightly more detailed stack trace if that helps http://prntscr.com/dimcyn

raywillig20:12:15

seems like some issue with ssl handshake but i don't really know what to make of it or how to troubleshoot it

micha20:12:25

looks like you don't have maven central in your repositories somehow

micha20:12:29

or something

micha20:12:37

it's saying that it can't find that jar in clojars

micha20:12:29

which is correct: it's not in clojars

micha20:12:38

does that work?

raywillig20:12:15

same error. did you see all that other ssl stuff in the second screenshot?

micha20:12:43

try doing boot show -e

micha20:12:55

what are the :repositories you see there

micha20:12:09

hm i guess that won't work

pesterhazy20:12:17

Old Java version?

pesterhazy20:12:18

Try Java 1.8

raywillig20:12:37

openjdk version "1.8.0_111" OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.10.2-b14) OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

raywillig20:12:32

i don't think it's a java issue. I run a standalone jar that I made on my own machine on this server

micha20:12:39

clojure 1.7.0 is not in clojars

micha20:12:52

it should be getting that jar from maven central

raywillig20:12:36

doesn't boot usually quietly fail clojars and then try maven central?

raywillig21:12:32

i think the issue may be that i created a keystore so i could run jetty with a self signed certificate and maybe the jvm is somehow using that info?

micha21:12:00

that sounds like it definitely could be related

raywillig21:12:16

any idea how i can instruct boot to ignore it?

raywillig21:12:24

or boot's jvm i guess

micha21:12:26

that's a jvm thing i think

micha21:12:10

have you seen the aws certificate manager thing?

micha21:12:30

might be a good alternative to the self-signed cert

raywillig21:12:08

i think i can only use that on AWS tho right?

hlship21:12:58

A very general question about Boot: why can tasks not accept positional parameters at all? What problems would binding, say *parameters*, to any unclaimed arguments cause?

micha21:12:52

that's in master btw

hlship21:12:12

I think I’m answering my own question … it allows the separator between tasks to be omitted, is that the case?

micha21:12:25

the -- can always be omitted

micha22:12:06

this scheme uses [ and ] to delimit the tasks+arguments

micha22:12:41

like boot [ run hello world ]

hlship22:12:07

is that in 2.6.0 or only in master?

hlship22:12:33

So is really for the user, not for Boot?

micha22:12:39

in master

micha22:12:42

there will be a release very soon

micha22:12:15

yeah the -- is not really seen by boot, the fact that you can use it between tasks is just a consequence of the way boot parses comand line arguments

micha22:12:31

boot stops parsing arguments when it reaches an unknown option

micha22:12:42

i mean for a given task

micha22:12:10

the -- is eaten in that process

micha22:12:24

but like if you did boot repl -- -c you'd have an error

micha22:12:37

because -- still works the way you'd expect

hlship22:12:38

because -c is not a task name.

micha22:12:56

but boot repl -c -- should be fine

richiardiandrea23:12:42

I wanted to do this for a long time, and it indeed someone did implement a dependency resolve in clojurescript 😉 https://github.com/eginez/huckleberry

richiardiandrea23:12:38

I wanted to ask here if there is some kind of "test matrix" somewhere in order to be sure that it follows the same rules as aether

richiardiandrea23:12:22

actually more maven...talking about deps