Fork me on GitHub
#boot
<
2017-03-21
>
ag00:03:06

@mobileink sadly it seems it does… try running boot repl watch

micha00:03:51

@ag you need to do boot repl -s watch

micha00:03:05

then connect from another terminal with boot repl -c

ag00:03:42

but I want to do everything in one repl session

micha00:03:46

watch only works with tasks that don't block

micha00:03:51

it is one repl session

micha00:03:57

the client is just a client

micha00:03:14

you can also just do boot repl

micha00:03:40

then once you're in the repl you can do boot.user=> (def p (future (boot (watch) (doit))))

micha00:03:56

and it will be building in the background

micha00:03:24

then to stop the build you can either do @p and ctrl-c or (future-cancel p)

ag00:03:39

I guess my mistake was to try to run everything in one repl process, thought of making it easier for others

ag00:03:15

btw, I think I asked this before, but now I don’t remember the correct answer: what’s the difference between (comp (watch) (dev)) and (comp (watch) (boot (dev)))?

ag00:03:05

for some reason if I don’t wrap it in boot like this:

(deftask start []
  (comp
   (repl :server true)
   (watch :verbose true)
   (boot (dev))))
I would end up having 4 repls in CIDER

micha00:03:19

whoa yeah that's crazy

micha00:03:36

i don't recommend doing that 🙂

micha00:03:51

you should only call the boot function in the repl

ag00:03:28

yeah, sometimes I end up with 4 repls (instead of 2 in CIDER). I’m gonna try to throw wait with -t in front of dev

ag00:03:31

nope, still getting 4 repls in CIDER when I do cider-jack-in-clojurescript with cider-boot-parameters set to “start"

ag00:03:45

unless I wrap it in boot

ag00:03:07

something strange is happening here

ag00:03:52

removing (repl) did the trick:

(deftask start []
  (comp
   (watch :verbose true)
   (dev)))
but now for some reason it does things twice - compiles cljs two times, two times notifies, etc.

grounded_sage04:03:35

What is the equivalent of this in Boot? (.exists (io/file <filename>))

micha04:03:54

you mean like for a fileset?

grounded_sage04:03:43

I'm just trying to check to see if file exists. To give full context I am bootifying this Gist. https://gist.github.com/rauhs/ac6349dd20f1799982a1906f9a59e7d6

micha04:03:23

you can do (.exists (io/file <...>)) in boot

grounded_sage04:03:22

ok. I probably just have the file in the wrong area in the file structure then.

grounded_sage04:03:20

Does it need to be inside a task to check?

micha04:03:13

you're just programming in clojure

micha04:03:24

so there are no limitations imposed by boot per se

grounded_sage05:03:19

How do I get to the filest inside the repl?

grounded_sage05:03:57

(show :fileset) is what the only thing I can think of. but it's also asking for a value to be supplied.

grounded_sage05:03:13

I'm trying to use the repl so I can fish around the fileset or whatever I need to be looking at to find where the file is.

micha05:03:31

you can make a task that puts it in an atom

micha05:03:59

actually it would be cool if the show task did that

grounded_sage05:03:39

So I did a boot dev show -f in one terminal. Then I booted up another terminal and ran boot repl doing (.exists ( "index.html")) which was clearly at the top level of the fileset. It says false. I'm not quite sure how I can just reach into the fileset normally for basic reads without doing some tricky stuff with a task to dump the fileset in an atom. But then if I did that the referenced fileset for reading wouldn't stay in sync??

micha05:03:17

the classpath and the filesystem are not the same

micha05:03:27

you need to do (io/resource "index.html")

micha05:03:05

but of course whenever you call commit! on a fileset in a task the underlying files change

grounded_sage05:03:20

Yea I've basically wrapped my head around doing tasks. Just modifying this Gist is seeming a bit more complicated than I expected.

micha05:03:22

the fileset is an immutable snapshot of the classpath, or part of it

micha05:03:18

you can copy the files from the fileset into a temp dir and run the gist on that dir

grounded_sage05:03:26

Perhaps that was a bad example with the index.html. It seems to be a clj file that he used as a dump for an atom with all teh styles.

micha05:03:36

then add the temp dir back to the fieset and commit

grounded_sage05:03:52

Ah yes that's probably the way for me to go.

micha05:03:53

you'd do that in a task of course

grounded_sage05:03:02

The main part I am looking at is

(def db-file
  "The db will receive e a dump of the styles-atom below. This is needed
  since otherwise the styler would lose previously generated styles when figwheel
  restarts.
  Give it the special name \"false\" to disable dumping the db."
  (or (System/getProperty "styler.db") "vbn/cache/styler-db.clj"))
and then.
(def styles-atom (atom
                   (if (and (not mem-only?) (.exists (io/file db-file)))
                     (do
                       (println "Loading db-file: " db-file)
                       (read-string (slurp db-file)))
                     (do
                       (println "Couldn't find file (or mem-only): " db-file)
                       {}))))
The rest of the file spitting throughout the code I think I can manage myself. I'm also not sure what is happening with the System/getProperty without there being anyway for it to be set. But for the moment I just want to get the new Gist working in Boot as it should stop me having to restart boot almost every style change due to the munging the class names.

grounded_sage05:03:10

Having trouble seeing how to pick apart the atom with tasks.

micha05:03:33

you don't want to use relative paths of course

micha05:03:39

at least not relative to .

micha05:03:50

you will need to make a temp dir and resolve files relative to that

grounded_sage05:03:08

Ok. I think I will hit the hammock for my poor head a little bit and come back to this in half an hour. Then start picking it apart with some tasks and see how I go 🙂

hit02309:03:17

Doubt 1: Can someone explain the use of :asset-paths in the boot environment? boot.user=> (get-env :asset-paths "none") gives "#{}"

dominicm10:03:39

https://github.com/boot-clj/boot/wiki/Filesets explains the different filesets & their purposes

hit02310:03:46

Doubt 2: What tasks are typically performed in pre-processing and post-processing in a user-defined task?

michal11:03:05

hey guys, is there any way to compile java sources using boot? I have a mix of clojure & java stuff in the same project and I'm wondering how to build it all.

martinklepsch11:03:16

@michal there’s a javac task that should help with that 🙂

michal11:03:36

@martinklepsch thanks, I just found Alan's sample repository which makes use of this task.

hit02312:03:58

Hey folks, does anyone know about a sub-reddit for boot? If there isn't any, how about starting one?

dominicm15:03:58

It wouldn't be active enough. /r/clojure is pretty quiet overall anyway.

alandipert17:03:19

there is http://hoplon.discoursehosting.net/ but it's pretty low traffic

alandipert17:03:37

and... not specific to boot

alandipert17:03:16

i think github broke our readme with their new markdown parser 😦

dominicm18:03:36

D: "move fast and break things"

esp119:03:00

is there an easy way to determine the type of a tmpfile? i.e. source/resource? i’m building some boot tasks that transform files in the fileset which may be of different types, and i don’t want to change the type of the files. i don’t see how to find the type of a tmpfile tho. i also don’t see how to get a list of just resource or source files, only input files.

micha19:03:21

@esp1 you can use set operations, like this: resource_files = intersection(input_files, output_files)

micha19:03:57

source_files = difference(input_files, resource_files)

juhoteperi19:03:51

And this is necessary because tmp-files don't know their types, only if they have input/output role

esp119:03:04

ok, thanks. it’s a bit indirect, but it’ll work.

esp119:03:37

actually tmp files don’t even know what role they are in, which is the problem. only tmp dirs know their roles

esp119:03:02

would it be possible to put input/output role metadata on the tmpfiles themselves?

micha19:03:24

you can add any metadata

micha19:03:47

you can add fields to the map if you want

micha19:03:15

but then if they are moved around you'd need to update the metadata

esp119:03:22

i’m thinking it’d be useful to have a source-files fn to list just the source files, or a resource-files fn to list just the resource files. i could make one using the set ops like you said, but it seems like it’d be nicer and more performant to have dedicated methods for these that use get-files under the covers, or if the get-files fn were exposed so i could make them myself

micha19:03:26

@esp1 it's just manipulating a clojure map

mobileink19:03:42

@esp1 you mean like transform an xml file into another xml file? if you're translating an input file to an output file, you're creating a new file, "changing the type" is not meaningful, because of inmutability. you want to preserve the type thru the xform?

juhoteperi19:03:43

@esp1 get-dirs + get-files is ~8 lines of code, you can copy them to your codebase and modify so that it supports selecting source and resource files

juhoteperi19:03:05

probably the performance difference between this and set operations is quite small

esp119:03:09

yup ok, i’ll give that a shot thx

mobileink20:03:31

howsabout a new core fn, exclusive filter? e.g. (filter-fs :in fileset) returns source-path stuff, (filter-fs :inout fileset) returns resource-path stuff. etc.

juhoteperi20:03:51

Perhaps, I've been thinking about similar tasks which would preserve the role. But this won't happen right away so if one needs this now, they way is to copy functions or use set operations.

mobileink20:03:34

sure, just thinkin out loud. it's easy to improve other people's stuff. 😉