Fork me on GitHub
#boot
<
2016-05-05
>
michael.heuberger00:05:54

cool, thanks - will try later

richiardiandrea01:05:12

so...with adzerk-oss/env...can I have one env/dev in profile.boot (with not persisted env vars) and one in build.boot?

richiardiandrea02:05:14

it is weird because I have (env/def SOME_VAR "test) in my build.boot but (`System.getenv "SOME_VAR") returns nil

richiardiandrea02:05:21

but I see it in (env/env)...note, I am in the repl

richiardiandrea02:05:55

ops...`(System/getProperty "SOME_VAR")` returns "test"...

richiardiandrea02:05:12

so system prop are defined first...

richiardiandrea02:05:58

mmm...did not expect that 😕

richiardiandrea02:05:38

the README states: the system property of the same name if it is set, or, but in my case it is not set so maybe there is some issue there

Petrus Theron15:05:20

Should I use boot with Clojure projects (not ClojureScript)?

martinklepsch15:05:14

@petrus: I have the feeling you'll get biased answers here 😄

Petrus Theron15:05:36

OK. All the docs I’ve seen seem to be cljs specific, so I’m not sure if it’s suitable

martinklepsch15:05:49

@petrus: I use it for everything nowadays, it definitely works for clj stuff as well simple_smile

Petrus Theron15:05:28

OK. Would be nice if there was a “How to get started with Boot for Clojure” or “How to port Leiningen projects to Boot” wiki or something somewhere

Petrus Theron15:05:04

Can someone share their build.boot file for a fresh Clojure project that does something basic like show a webpage? Things like dev vs production settings - I don’t know how much of my cljs stuff will translate to clojure land. Template for code reloading would be useful

micha15:05:36

the cljs things are all also doing clj stuff

micha15:05:40

to start webservers etc

micha15:05:49

you can just remove the cljs parts

micha15:05:05

have you seen the modern cljs tutorials?

micha15:05:15

those start with just the backend

micha15:05:19

i believe

micha15:05:02

hm no i was wrong about that

micha15:05:13

ok i make a thing one sec

Petrus Theron15:05:37

I can't find any minimal docs on what to put in build.boot so I can run my project like I was running it with Leiningen. I have my cljs projects, but they are littered with tasks that run (cljs)

micha15:05:20

build.boot is just a clojure program

micha15:05:32

if you remove the (cljs) then those functions won't be called

Petrus Theron15:05:47

ok, but I need to deftask something that I can run like boot run or boot dev, right?

Petrus Theron15:05:50

I tried boot serve, but that demands cljs things. So I can’t run a clj project without including some cljs things?

micha15:05:07

serve doesn't know about cljs, so that's ok

micha15:05:13

it's just a web server

micha15:05:29

it will just serve things from the classpath

micha15:05:50

so if you have an index.html file in your :resource-paths then you can access it from that server

micha15:05:59

for example

micha15:05:30

you definitely don't need to use the cljs task to use boot

micha15:05:45

you can use boot to build a scala project or a java project even

micha15:05:55

so the project doesn't even need to be clojure

micha16:05:02

you'll want to split that up, put the app, cp-dirs, and start-server in a namespace

micha16:05:30

you run that with boot serve wait

micha16:05:05

or alternatively boot watch serve

micha16:05:22

or from the repl: boot repl

micha16:05:33

in a directory with the build.boot in it

micha16:05:44

then (boot (serve) (wait))

micha16:05:59

you can press C-c to stop the server then restart it later

micha16:05:36

or you could do (def f (future (boot (serve) (wait))) in the repl

micha16:05:48

and then when you want to stop the server do @f and C-c

jupl19:05:46

I have a question on sift. When using the :include param what kind of string is the regex testing against? Let’s say I have my src path is src and resources path is resources. In src there is a file called app/something.cljs and in resources there is a file called index.html. What would the strings look like?

index.html
app/something.cljs
resources/index.html
src/app/something.cljs
/home/user/proj/resources/index.html
/home/user/proj/src/app/something.cljs
Or something totally different?

richiardiandrea19:05:13

@jupl it always matches against the path

richiardiandrea19:05:17

so you regex will match against it and you can differentiate between app's and resources's index.html (and :invert true if you want to exclude one)

jupl19:05:37

Right, but do you have an example of what the path looks like? Is it an absolute path? A kind of relative path?

jupl19:05:50

Or is it just the basename?

dimiter19:05:50

Here is a way I use sift:

(deftask styles []
         "Compile Styles"
         (set-env! :source-paths #{"sass"}
                   :resource-paths #{})
        (comp (watch)
              (speak)
              (sass)
              (sift :include #{ #"([^\s]+(\.(?i)(css))$)"})
              (target :dir #{"compiled_css"})))

dimiter20:05:22

In that case I am looking for any file with .css extension.

jupl20:05:54

@dimiter Thanks. I will note that I am familiar with the sift task. However, I was asking what do the paths that are tested against the regexs appear like, specifically the beginning part. In your case you are testing against the end part.

dimiter20:05:49

The paths are relative.

jupl20:05:25

To the directory build.boot is at?

dimiter20:05:06

It is technically a temporary directory.

dimiter20:05:27

In your case, the paths would be [“index.html” "app/something.js”] if that is what your clojurescript compiles to.

jupl20:05:41

Thank you. That answers my question.

dimiter20:05:57

BTW. You can look at the structure in your boot cache.

dimiter20:05:09

That is the temporary directory where boot compiles to before running sift.

dimiter20:05:23

λ: find . -atime -5m | grep -i index.html
./ony/mh5540/font-awesome/fonts/4.4.0/index.html
./ony/mh5540/index.html
/Users/todorovd/.boot/cache/tmp/opt/cljdev/torcaui
λ:

dimiter20:05:51

That is how I figured it out.

dimiter20:05:15

the ony/mh5540 are random and pertinent to that particular build.