Fork me on GitHub
#boot
<
2015-08-24
>
onetom01:08:43

@micha: what do u mean by "modules, not asset-path"?

micha01:08:43

if the reason is to facilitate caching i think that's probably the way to go, rather than arbitrarily configuring :asset-paths etc

micha01:08:11

i think we can compute optimal module boundaries automatically

juhoteperi05:08:19

That's a solution for e.g. having separate js for index.html and admin.html

juhoteperi05:08:28

doesn't solve anything else, and doesn't work with none optimization

juhoteperi05:08:56

Not sure how Hoplon works but if you have separate html files in the app there, could be useful

xificurC08:08:33

I worked on a project at home on an archlinux box and everything worked fine. Now I copied it to my work notebook (win7) and tried running my boot dev task and got presented with this error

Writing main.cljs.edn...
Compiling ClojureScript...
▒ main.js
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: character to be escaped is missing
     java.lang.IllegalArgumentException: character to be escaped is missing
                                  ...
               clojure.string/replace     string.clj:  104
            cljs.closure/lib-rel-path    closure.clj: 1202
         cljs.closure/rel-output-path    closure.clj: 1221
        cljs.closure/write-javascript    closure.clj: 1342
          cljs.closure/source-on-disk    closure.clj: 1375
   cljs.closure/output-unoptimized/fn    closure.clj: 1409
                  clojure.core/map/fn       core.clj: 2624
                                  ...
Any ideas? simple_smile

xificurC09:08:19

here's a bigger stacktrace with my deps https://www.refheap.com/108665

onetom10:08:43

so i tried to collapse our multipage site into a single page and show content based on the (.. js/window -location -path) for that to work i should serve the same target/index.html* under every subpage's path. solution 1: hack the serve task to send back the same index.html{,.js,.out/} stuff for any subdir. this would work for development but not so much for the prerendering task because that uses the temp files directly to load the pages solution 2: link (or at least copy) all these files under every subdirectory where content supposed to be. i tried to use the TmpFileSet/cp function for this but I have no idea how to specify the destination directory (since it have to be a TmpDir)

juhoteperi10:08:02

Hmh, AOT task doesn’t allowing compiling namespaces from dependencies

onetom10:08:47

i could find the relevant files in the fileset:

slash-index-related-files (->> fileset output-files (by-re [#"^index.html.*"]))
so how should i copy them?

micha10:08:01

xifi: that looks like you have a string somewhere that looks like "...\" maybe

onetom10:08:02

i saw there is some hashing going on so the file content doesnt have to be duplicated actually

juhoteperi10:08:44

Ah, I can AOT other code if I run aot after uber task

micha10:08:31

onetom: there is boot.core/cp

onetom10:08:54

yeah, that's the one i was trying to use but not sure how to provide the destination

micha10:08:11

boot.user=> (doc cp)
-------------------------
boot.core/cp
([fileset src-file dest-tmpfile])
  Given a fileset and a dest-tmpfile from that fileset, overwrites the dest
  tmpfile with the contents of the java.io.File src-file.

onetom10:08:11

and whether it works on set of files too or i have to iterate over each file, etc

micha10:08:07

the destination needs to already exist i guess

onetom10:08:38

i was reading the wiki back n forth regarding filesets and also the boot source code but im not very familiar with protocols and records yet 😞

onetom11:08:02

i didn't understand where file comes from in the context of (set (map file dirs)) for example: https://github.com/boot-clj/boot/blob/d8782413a16bfafbc0a069bf2a77ae74c029a5ca/boot/pod/src/boot/tmpdir.clj#L105 i see there is a file function in the interface of TmpFile but i can quite understand how is it resolved within the definition of another record (`TmpFileSet`)

micha11:08:10

it's resolved at runtime

onetom11:08:18

i tried to write similar code but i was just getting errors so i guessed the interpretation is somewhat special within a record definition...

micha11:08:19

wait so what you want to do is copy a file to multiple places inthe fileset, yes?

micha11:08:51

i recommend making a tempdir and copy the file into there as many times as you need

micha11:08:57

then add the tempdir to the fileset

onetom11:08:09

so when i go to /about-us/ i would get the same content as i get for / which is the same as /index.html

micha11:08:23

right yea

onetom11:08:36

i was kinda thinking about that but since there is nothing to change on a file, i thought they could just be added somehow to the fileset again but with a different path...

onetom11:08:06

while this approach is coupling the boot task to the actual pages of the app

onetom11:08:29

It would solve our immediate problems because the initial startup time is 20s and recompilations are 2s which makes the solution bearable again

micha11:08:16

onetom: you can use boot.core/sync! to copy things

micha11:08:21

it's fast

onetom11:08:05

Hmm thats something i saw in boot1 the last time... We really need some more solid docs.

micha11:08:06

sync! is part of the core api, it has a docstring simple_smile

onetom11:08:24

Anyway, im on the move, will try sync! As soon as i got home

onetom11:08:34

Thx for the pointer

micha11:08:48

just joking simple_smile

onetom11:08:51

Otherwise do u think it's a good idea?

micha11:08:10

yeah i'm interested to see how it works out

onetom11:08:13

To hack around the multipage problem like this?

micha11:08:03

i want to switch http://hoplon.io to use ajax crawling instaead of prerendering for SEO

micha11:08:13

and see what google does

micha11:08:33

i'd be surprised if google doesn't index the different uri hashes correctly

micha11:08:45

@onetom: i think your approach will work

xificurC12:08:18

@micha: I didn't use anything that uses regexes (of course deep down something might but no parameter expects a regex compatible string). And the code worked yesterday on a linux pc

xificurC12:08:54

and grep -r "\\" src/ doesn't return anything

onetom13:08:19

@micha: im studying the boot.core, boot.tmpregistry, boot.file namespaces to understand what (sync! ...) would require, but it's just beyond me (without usage examples aka test) 😕

onetom13:08:40

btw, why did u use records for tmpfiles and tmpfileset? for performance reasons?

micha13:08:59

onetom: boot.core/sync! doesn't really have anything to do with filesets

micha13:08:15

it's just a way to do like rsync --delete from one directory to another

micha13:08:24

it will make hard links by default which are fast

micha13:08:40

so you can efficiently copy large directories around without much overhead

micha13:08:06

and it computes a diff before doing anything so it doesn't do any unnecessary work

micha13:08:33

@onetom: i used records so we could have protocols on them

onetom13:08:32

yeah but i need rsync target/index.html target/subpage/ and target doesnt exist yet - i suppose - when the sync! happens

onetom13:08:10

i also dont want --delete because the assets dir already puts .css files under subpage/

onetom13:08:03

i was trying

(deftask copy-index-htmls []
  (with-pre-wrap fileset
    (sync! "target/about-us/index.html.out/" "target/index.html.out/")
    fileset))
...
   (comp  (hoplon)    (reload)    (cljs)    (copy-index-htmls))
...

onetom13:08:43

but ls target/subpage/ only contains the asset-dir's content. maybe it's overwriting it?

onetom13:08:56

imean i have :resource-paths #{"assets"}

onetom13:08:25

but never mind, i can see i understand too little about boot, so i wont be able to fix this myself

onetom13:08:45

is there an official way to pretty print a fileset? im aware of the show -f task but that's too pretty simple_smile i looked at the fileset in sublime and ran a prettify on it and now i understood there is a tmpdir for the file contents with all the files named as their content hashes and the fileset's structure is:

<boot.tmpdir.TmpFileSet{:dirs #{<boot.tmpdir.TmpDir
                                    :dir<java.io.File>
                                    :user<bool>
                                    :input<bool>
                                    :output<bool>
                                ...}
                        :tree {"path/file.ext" <boot.tmpdir.TmpFile
                                                   :dir<java.io.File>
                                                   :path<same-string-as-the-key>
                                                   :id<hash string>
                                                   :time<unixtime>>
                               "other/file.ext" <boot.tmpdir.TmpFile ...>
                               ...}
                        :blob <java.io.File which is a tmpdir but not part of the :dirs set>}>

onetom13:08:05

is this documented anywhere?

onetom13:08:13

disregard my earlier question; (clojure.pprint/pprint fileset) is pretty enough actually

alandipert13:08:28

@onetom: there is https://github.com/boot-clj/boot/issues/250 out there to improve printing also

xificurC14:08:19

any tips on reading stacktraces? Reading this one closely though I don't see any of my namespaces in the error I posted, which would suggest the problem could stem from elsewhere

onetom14:08:17

@xifi: have u tried disabling the cljs-repl or the boot-reload? the topmost lines reference these 2 libs

xificurC14:08:08

@onetom: thanks for the tip. With boot -vvv cljs I still get the same error, with a different stacktrace https://www.refheap.com/108675

onetom14:08:14

u should narrow the issue then. can u create a github repo to demonstrate the issue? or it's reproducible even with an empty src dir?

onetom14:08:09

im trying it on a mac:

> boot -V
BOOT_CLOJURE_VERSION=1.7.0
BOOT_VERSION=2.2.0
#App version: 2.2.0

xificurC14:08:01

same version here on a win7. Yes I'll do that, probably tomorrow as I'm out of time for today. Thanks for your help

onetom14:08:38

i've added this to my build.boot:

(require '[adzerk.boot-cljs :refer [cljs]])
and boot -vvv cljs runs without any errors

xificurC15:08:49

I tried running boot hoplon cljs on the hoplon-minimal github project and it worked. So I'll have to try with my deps and code

ericfode19:08:19

Hello boot people simple_smile, I am working on a little cli tool that uses boot, and i think, that after updating to 2.2.0 I am having truble getting it to run my -main funtion

ericfode19:08:25

Here is the offending code

ericfode19:08:37

#!/usr/bin/env boot
(set-env! :dependencies '[[http-kit "2.1.18"]
                          [amazonica "0.3.28"]
                          [org.clojure/clojure "1.7.0"]
                          [bidi "1.20.0"]
                          [boot/core "2.0.0"]
                          [cheshire "5.5.0"]
                          [midje "1.7.0-beta1"]]
          :source-paths #{"src/" "test/investigator"})


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

(deftask build
  "create a standalone jar file that investigates services"
  []
  (comp (aot) (pom) (uber) (jar)))

(defn -main [& args]
  (require 'investigator.core)
  (apply (resolve 'investigator.core/-main) args))

ericfode19:08:54

Any thoughts?

ericfode19:08:44

./build.boot -a
             clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: No such task (./build.boot)
    data: {:file
           "/var/folders/q7/_rvk3pm567q927xt9f2ps13c0000gp/T/boot.user4481508804275288265.clj",
           :line 25}
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: No such task (./build.boot)
     java.lang.IllegalArgumentException: No such task (./build.boot)
          boot.core/construct-tasks  core.clj:  672
                                ...
                 clojure.core/apply  core.clj:  630
                  boot.core/boot/fn  core.clj:  706
clojure.core/binding-conveyor-fn/fn  core.clj: 1916
                                …

ericfode19:08:51

(is the stack trace i get)

martinklepsch20:08:16

@ericfode: I haven’t used boot for scripting yet, so only general ideas… did you try without the -a?

martinklepsch20:08:10

@ericfode: and a filename other than build.boot?

ericfode20:08:22

I think I have to name it build.boot right?

martinklepsch20:08:57

not necessarily if you want to run it as a script I think (https://github.com/boot-clj/boot/wiki/Scripts)

ericfode20:08:40

I was trying to use the build.boot to define my main function so when i compile it it calls the right main

ericfode20:08:56

Though I am now feeling like I am doing something rather incorrectly

ericfode20:08:36

Figured it out, strangly midje.sweet was breaking it

xificurC21:08:48

for reloading a page that uses e.g. reagent there's :on-jsload in boot-reload. That works fine when I edit a different file than the one containing the initiation function (let's call it init!). When I edit that file though I get everything running twice as I call (init!) at the end of that file in order to render the first time the app starts. What would be the solution to this? Running the initiation twice is not good when it has side-effects. The only thing I can think of is not calling the function at the end and creating another file/namespace that will be the main one and will just render