Fork me on GitHub
#boot
<
2016-10-15
>
gtrak00:10:28

I'm having a hard time with boot's read-only permissions, is there a way to tell sift or another way to change target to read-write?

gtrak00:10:32

basically I want to include the target files in a npm/broccoli build and it throws up

gtrak01:10:17

actually updating to v2.6.0 fixed my problem 🙂

pvinis11:10:56

how can i do a dev task for yada?

pvinis11:10:17

im so confused with boot and lein and how to start a webserver actually

pvinis11:10:48

i cannot even run the aleph example with boot..

pvinis11:10:17

so in the repl, i can run the start-server from aleph, and it starts the server. how do i do that in a boot task?

micha13:10:13

@pvinis you can make a boot task like this:

micha13:10:35

(deftask aleph
  []
  (let [start (delay (aleph/start-the-server))]
    (with-pass-thru fs @start)))

pvinis13:10:11

aha thanks. so complicated

micha16:10:39

@pvinis you can just use the repl if that's easier for you

micha16:10:02

it doesn't necessarily have to be a task

micha16:10:26

the only advantage of a task is that you can compose it with other tasks

mathpunk21:10:31

This is maybe more of a ring problem than a boot problem but I'm using boot-http and everyone's asleep in the ring channel---

mathpunk21:10:42

How come this doesn't work to server the static page in my SPA?

mathpunk21:10:15

(Important note: I barely know what 'static resources' means)

mathpunk21:10:40

(All I know is, I used to be able to see a reagent page I was making and now localhost:3000/ is a Not Found)

richiardiandrea21:10:01

@thomas boot-http uses its own (ring) server and serves from the classpath the files. So it needs some sort of configuration in order to extract your static assets and serve them

mathpunk21:10:16

What else needs configuring?

richiardiandrea21:10:53

@thomas ok I did not see the code sorry

geoffs22:10:31

I think, more specifically, the issue is that the default for that compojure helper is to expect things to be inside of a public folder. But looking at your resources directory, everything is in the root. So, @mathpunk you can either move all the folders in your resources directory into resources/public or you can set the option on route/resources like so:

(route/resources "/" {:root "."})

geoffs22:10:33

I'm not 100% sure that second suggestion will work. And I'd recommend moving your website files into resources/public anyway since it's a common convention

geoffs22:10:17

hmmm. appears I'm totally wrong. Also, the code that's on github works just fine for me. I can load your reagent app on localhost:3000 after running boot dev @mathpunk

mathpunk22:10:47

are you on the server branch or the master branch, @geoffs?

mathpunk22:10:00

yeah these changes aren't in master yet

mathpunk22:10:22

i'm looking for the behavior in master for /, and new behavior from other routes

mathpunk22:10:32

i did try moving things into public, but no luck yet

geoffs22:10:54

ah. I see. 🙂

geoffs22:10:22

So, I got rid of your other routes besides (route/resources "/") and the server started showing something different:

Problem accessing /index.html. Reason:

    java.io.FileNotFoundException: Could not locate garden/def__init.class or garden/def.clj on classpath., compiling:(anansi/styles.clj:1:1)

geoffs22:10:01

So it looks like there's an issue with your garden styles.clj that's borking things

mathpunk22:10:49

@geoffs There's an :output-to in build.boot.... maybe that's gotta be "public/css" to match?

mathpunk22:10:32

having only been web-devving for 6 months it's hard to know what older conventions these things are emulating...

mathpunk22:10:22

there's also the :resource-paths

mathpunk22:10:01

but if it's set to 'resources' i'd imagine that it sees public inside resources as well

geoffs22:10:46

yes. that's correct

geoffs22:10:33

Yeah, I think setting :output-to to be public/css/garden.css is part of it

geoffs22:10:45

I got it working by also adding an explicit dependency on garden like so:

;; prod
                 [ring/ring-core "1.5.0"]
                 [compojure "1.5.1"]
                 [com.cognitect/transit-cljs "0.8.239"]
                 [reagent-material-ui "0.2.1"]
                 [datascript "0.15.4"]
                 [garden "1.3.2"]            ;; <=========== add this
                 ])

geoffs22:10:57

and then going to localhost:3000/index.html

mathpunk23:10:33

Here's a new question, which I think is more boot-related or at least classpath-related: now I want to use transit on the server, so I add [com.cognitect/transit-clj...] to the build.boot dependencies. But, if I require it with (:require [cognitect.transit :as transit]), I get no such var

mathpunk23:10:57

I imagine this is because it's ambiguous which cognitect.transit I'm referring to?

mathpunk23:10:18

and yet it seems like you just chuck all the deps, cljs and clj, into the same spot in the build.boot

micha23:10:44

@mathpunk when you do (require '[foo.bar :as bar]) it will not create a var named bar, is that what you mean?

mathpunk23:10:57

@micha hm, well i'm in a file rather than the repl but when I run my boot dev I get,

mathpunk23:10:20

oops, that's from me guessing it was transit-clj instead of transit

micha23:10:26

right, namespaces are not themselves vars

mathpunk23:10:27

but, i got an equivalent error, I do believe

micha23:10:36

namespaces contain vars

micha23:10:30

so in the repl you should be able to do like cognitect.transit/write

micha23:10:06

if you just do cognitect.transit you will get a "no such var" exception, because the namespace isn't a var

mathpunk23:10:59

i don't really understand what vars are, but i think you're saying that i can't include this dependency in my source file like i require other dependencies

mathpunk23:10:08

because of the naming collision?

micha23:10:26

no, i don't think it's a dependency issue

micha23:10:48

it looks like an issue with what youre trying to do with clojure

micha23:10:55

to clarify:

micha23:10:36

(ns foop
  (:require [cognitect.transit :as tarnsit]))

(def x cognitect.transit)

micha23:10:43

that will throw an exception

micha23:10:56

in clojure

micha23:10:15

vars are named variables, in clojure

micha23:10:32

namespaces are groups of vars

micha23:10:58

that snippet above creates the foop namespace

micha23:10:06

which would contain an x var

mathpunk23:10:31

i'm not doing anything differently than i'm doing in the namespace where this works

mathpunk23:10:50

They look equivalent except that one's a cljs file and the other's a clj file.

mathpunk23:10:57

to me, anyway

micha23:10:48

is that really the full contents of the anansi/data.clj file?

micha23:10:27

can you paste the build.boot file please?

micha23:10:07

there is some place where you're using cognitect.transit-clj as a var when it should be quoted

micha23:10:17

maybe in your :dependencies in the build.boot

mathpunk23:10:17

lines 20 and 21

micha23:10:53

hm yeah that all looks fine to me

micha23:10:37

maybe do find . |xargs grep -s "cognitect\.transit-clj"

micha23:10:28

something somewhere must be trying to use cognitect.transit-clj as a variable