Fork me on GitHub
#boot
<
2016-10-19
>
olegakbarov10:10:44

what might cause this beahaviour?

clojure.lang.ExceptionInfo: Failed to collect dependencies for [#object[org.sonatype.aether.graph.Dependency 0x479cbee5 "adzerk:boot-cljs:jar:1.7.228-1 (test)"] #object[org.sonatype.aether.graph.Dependency 0x59e2d8e3 "adzerk:boot-cljs-repl:jar:0.3.0 (test)"] #object[org.sonatype.aether.graph.Dependency 0x2b72cb8a "adzerk:boot-reload:jar:0.4.8 (test)"] #object[org.sonatype.aether.graph.Dependency 0x7f8a9499 "pandeiro:boot-http:jar:0.7.2 (test)"] #object[org.sonatype.aether.graph.Dependency 0x5d43661b "com.cemerick:piggieback:jar:0.2.1 (test)"] #object[org.sonatype.aether.graph.Dependency 0x12299890 "org.clojure:tools.nrepl:jar:0.2.12 (test)"] #object[org.sonatype.aether.graph.Dependency 0x2fba3fc4 "weasel:weasel:jar:0.7.0 (test)"] #object[org.sonatype.aether.graph.Dependency 0x4bf48f6 "danielsz:boot-autoprefixer:jar:0.0.8 (test)"] #object[org.sonatype.aether.graph.Dependency 0x420a85c4 "org.clojure:clojurescript:jar:1.7.228 (compile)"] #object[org.sonatype.aether.graph.Dependency 0x1c39680d "org.clojure:core.async:jar:0.1.346.0-17112a-alpha (compile)"] #object[org.sonatype.aether.graph.Dependency 0x62833051 "cljs-http:cljs-http:jar:0.1.39 (compile)"] #object[org.sonatype.aether.graph.Dependency 0x1c852c0f "org.webjars.npm:react-dnd-html5-backend:jar:2.0.0 (compile)"] #object[org.sonatype.aether.graph.Dependency 0xa37aefe "org.webjars.npm:react-dnd:jar:2.1.4 (compile)"] #object[org.sonatype.aether.graph.Dependency 0x5d99c6b5 "cuid:cuid:jar:0.1.1 (compile)"] #object[org.sonatype.aether.graph.Dependency 0x266374ef "bidi:bidi:jar:2.0.10 (compile)"] #object[org.sonatype.aether.graph.Dependency 0x13b3d178 "kibu:pushy:jar:0.3.6 (compile)"] #object[org.sonatype.aether.graph.Dependency 0x24c4ddae "binaryage:devtools:jar:0.6.1 (compile)"] #object[org.sonatype.aether.graph.Dependency 0x37fb0bed "re-frame:re-frame:jar:0.8.0 (compile)"] #object[org.sonatype.aether.graph.Dependency 0xa82c5f1 "re-com:re-com:jar:0.8.3 (compile)"] #object[org.sonatype.aether.graph.Dependency 0x7b7fdc8 "reagent:reagent:jar:0.6.0-rc (compile)"] #object[org.sonatype.aether.graph.Dependency 0x51c693d "reagent-utils:reagent-utils:jar:0.2.0 (compile)"] #object[org.sonatype.aether.graph.Dependency 0x6a57ae10 "deraen:boot-less:jar:0.2.1 (test)"]]
im trying to add some js externals for my project as follows:
[org.webjars.npm/react-dnd-html5-backend "2.0.0"]
                 [org.webjars.npm/react-dnd "2.1.4"]

micha13:10:45

@olegakbarov looks like a dependency wasn't found

micha13:10:11

i don't see a "1.7.228-1 (test)" version of boot-cljs in clojars

micha13:10:33

oh nm i'm confused

micha13:10:37

disregard 🙂

juhoteperi13:10:47

That log is quite confusing

micha13:10:57

the (test) is the scope

micha13:10:00

very confusing

olegakbarov14:10:32

hmm.. i have one more question: how can i enable client-side routing during development with boot-http? i just want ring to do this:

(ANY "*" [] (resource-response "index.html")))

juhoteperi14:10:15

olegakbarov (serve :resource-root "")

kingoftheknoll14:10:28

Starting a new project for cljs and its been a while since I’ve looked at boot. Very excited that boot-reload now has a HUD like figwheel. But one thing I can’t find is whether it will maintain the state of the application when reloading. Looking to use re-frame for this particular app.

juhoteperi14:10:16

@kingoftheknoll Boot-reload nor Figwheel is not related to maintaining app state. Your application will need to take care of that.

juhoteperi14:10:00

Usually it is enough that you keep your app state on atom and use defonce to store that atom.

juhoteperi14:10:08

Or just use re-frame, which does this.

olegakbarov14:10:26

@juhoteperi so there’s not such option?

juhoteperi14:10:49

@olegakbarov That message/image doesn't tell me anything

olegakbarov14:10:49

i mean this sounds trivial to me just to pass all routs down to client

olegakbarov14:10:31

i’d like to pass all requests to clientside routing while developing with boot-http

olegakbarov14:10:58

at the moment when i reload with F5 — i get a 404 from dev server

juhoteperi14:10:13

You can define custom not-found handler

olegakbarov14:10:30

like a wildcard?

olegakbarov14:10:18

(deftask run []
  (comp (serve :not-found "/")
        (watch)
        (cljs-repl)
        (reload)
        (build)))

juhoteperi14:10:29

No, a function

juhoteperi14:10:44

Check boot serve --help

kingoftheknoll14:10:28

@juhoteperi of course that makes sense. So rather the fact that state was maintained when reloading was either the namespace wasn’t reloaded or that it was using defonce

olegakbarov14:10:41

i do not understand how cli flags map to config opts

olegakbarov14:10:48

this part is pretty confusing

micha15:10:28

@olegakbarov the long cli option maps to the keyword like this: --foop-barp => :foop-barp

micha15:10:56

the type of the optarg is in the docstring

micha15:10:58

for example

olegakbarov15:10:08

yeah, some experiments led me to same conclusion

olegakbarov15:10:00

tho can’t figure out how to solve my problem :not-found “/“ doesn’t work 😞

micha15:10:36

@olegakbarov if you do (doc thetask) in your repl you will be able to see the types

micha15:10:56

the expected type of the optarg

micha15:10:15

like in the above example the wait task expects an integer for the :time option

micha15:10:23

and a boolean for the :help option

olegakbarov15:10:42

thanks, this makes cli opts more clear

olegakbarov15:10:21

but nevertheless i can’t figure out how to redirect all routes to client

olegakbarov15:10:34

got this for example: serve: unknown option(s): :not-found

micha15:10:55

if you do (doc serve) in the repl what do you get?

olegakbarov16:10:27

boot.user=> (doc serve)
-------------------------
pandeiro.boot-http/serve
([& {:as *opts*, :keys [help dir handler init cleanup resource-root port httpkit silent reload nrepl]}])
  Start a web server on localhost, serving resources and optionally a directory.
  Listens on port 3000 by default.

  Keyword Args:
    :help           bool  Print this help info.
    :dir            str   The directory to serve; created if doesn't exist.
    :handler        sym   The ring handler to serve.
    :init           sym   A function to run prior to starting the server.
    :cleanup        sym   A function to run after the server stops.
    :resource-root  str   The root prefix when serving resources from classpath
    :port           int   The port to listen on. (Default: 3000)
    :httpkit        bool  Use Http-kit server instead of Jetty
    :silent         bool  Silent-mode (don't output anything)
    :reload         bool  Reload modified namespaces on each request.
    :nrepl          edn   nREPL server parameters e.g. "{:port 3001, :bind "0.0.0.0"}"
nil

olegakbarov16:10:53

seems, like boot as well as boot-http set up fine

pandeiro16:10:25

Looks like old version maybe?

pandeiro16:10:48

The :not-found arg is recent

olegakbarov16:10:50

[pandeiro/boot-http         "0.7.2"      :scope "test"]

olegakbarov16:10:29

lemme bump to 0.7.3

olegakbarov16:10:28

clojure.lang.ExceptionInfo: option :not-found must be of type sym
    data: {:file
           "/var/folders/9q/pc2svvn90m59swn642ll51br0000gn/T/boot.user8213406251709384518.clj",
           :line 21}
java.lang.IllegalArgumentException: option :not-found must be of type sym

olegakbarov16:10:46

sorry guys for all these … im new to boot

olegakbarov16:10:03

what should i pass to not found et al?

pandeiro16:10:14

needs to be a fully qualified symbol representing a handler function to call when a route is not found

olegakbarov16:10:13

no idea what it would be in my case

pandeiro16:10:05

Just like handler

olegakbarov16:10:24

(serve :not-found (resource-response "index.html"))

olegakbarov16:10:35

not working tho

pandeiro16:10:48

That needs to be in a function in a source file

pandeiro16:10:07

And referenced via its namespace

pandeiro16:10:49

eg (serve :not-found 'myapp.handlers/not-found)

olegakbarov16:10:09

in case of re-frame app

olegakbarov16:10:19

i dont have a route handler or smth

pandeiro16:10:54

this is the server side, re-frame is a client-side library

olegakbarov16:10:55

yes, and the question is how to pass all serverside routes to client

olegakbarov16:10:11

i think this is pretty common usecase developing SPAs

pandeiro16:10:31

so what logic do you currently have on the server side?

olegakbarov16:10:57

no logic at all, i just want to send index.html and statics

olegakbarov16:10:06

all the business done clientside

pandeiro16:10:11

So you need this logic because if the person requests /some/file/that/doesnt/exist.html, how should it know to serve index.html (ie, your SPA)?

pandeiro16:10:49

so you need a ring request handler in a clojure (clj) file, which boot-http will use to handle requests for things that don't exist

olegakbarov16:10:10

boot-http is the jetty/ring server itself, right?

olegakbarov16:10:17

i mean under the hood

olegakbarov16:10:54

i felt it works much like webpack-dev-server

olegakbarov16:10:20

(which allows to pass all routes to client via single line of config 😓)

micha16:10:36

that sounds like an application concern to me

micha16:10:42

not a dev tooling concern

micha16:10:55

otherwise how are you going to do things in production

micha16:10:09

your application needs to know about its routes on its own

micha16:10:16

boot-http is just a webserver

olegakbarov16:10:05

i guess i can launch my own server with boot, right?

micha16:10:27

the :handler option of boot-http

micha16:10:41

or use jetty/httpkit/whatever

aristarchus20:10:12

Hello, booters(?)...

aristarchus20:10:18

If my project's version is encoded in the build.boot

(task-options!
  pom {:project 'myproject
       :version "0.1.0"}
  jar {:main 'myproject.core :file "myproject.jar" }
  aot {:all true})

aristarchus20:10:35

Is there a way for my app to read this info from runtime? You know, to print the version? 😉

aristarchus21:10:33

Well it seems I can do the opposite. That is, put (def version "1.0.0") into myproject/src/core.clj and then change the build.boot to:

micha21:10:05

that's how i'd do it

aristarchus21:10:19

(require `[myproject.core]) ; for version info
(task-options!
  pom {:project 'myproject
       :version myproject.core/version}
  jar {:main 'myproject.core :file "myproject.jar" }
  aot {:all true})

micha21:10:21

we're just programming now

aristarchus21:10:12

Is it obvious I'm new to Clojure, not just boot? 🙃

micha21:10:22

consider like "if i call a function with argument 123 like (func 123) how can i read that info at runtime"

flyboarder21:10:18

@aristarchus there is also boot-semver for managing the version in a boot task, future version of that will generate a namespace like myapp.version which will contain all the version info for your project, finishing that is on my list