Fork me on GitHub
#boot
<
2017-01-13
>
richiardiandrea00:01:59

I applied your patch just to be sure and no change

micha00:01:05

exciting ^^

richiardiandrea00:01:53

just fixed a small bug πŸ˜„

bhagany00:01:43

@richiardiandrea I’m taking a closer look at #569 - is there a public repo I can clone to reproduce it?

richiardiandrea00:01:02

@bhagany I am checking as well with my project and boot-figreload so I might find out the truth soon πŸ™‚

richiardiandrea00:01:27

I am actually using your tests as well

michael.heuberger01:01:52

@mynomoto ummm, there is one more problem here copying contents of a jar file to our resource folder

michael.heuberger01:01:28

tried something like boot -BPd cljsjs/async:2.0.0-rc.4-0 sift -R 'cljsjs/async:development/.*\.inc\.js$' show -f

michael.heuberger01:01:38

with the aim to place that file into our resource folder

michael.heuberger01:01:52

but this gives me a NoSuchFileException

richiardiandrea01:01:32

@michael.heuberger there is a : in the regex, is this on purpose?

michael.heuberger01:01:44

aim is to have a specific JS file in our resources folder

michael.heuberger01:01:30

what should i put in after -R ?

richiardiandrea01:01:39

yes sorry not a regex but a path

michael.heuberger01:01:47

boot -BPd cljsjs/async:2.0.0-rc.4-0 sift -R 'resources/js/' show -f … but i dont see any files in there

richiardiandrea01:01:03

I think this one wants a complete path

richiardiandrea01:01:08

-R, --add-resource PATH Conj PATH onto the set of directory paths to add to resources.

richiardiandrea01:01:47

you could try also -r, --to-resource MATCH Conj MATCH onto the set of regexes of paths to move to resources.

michael.heuberger01:01:53

if using -r, then it should be a regex. got it. but i dont find it in the resource folder

michael.heuberger01:01:00

~/c/app ❯❯❯ boot -BPd cljsjs/async:2.0.0-rc.4-0 sift -r 'cljsjs/async:development/.*\.inc\.js$' show -f  
Sifting output files...

michael.heuberger01:01:19

nothing, no output files

michael.heuberger01:01:54

ultimately i want to extract a JS file from a jar dependency and place it under /target/js/something.js

richiardiandrea01:01:34

but is the regex correct? the / i think should be excaped right?

michael.heuberger01:01:46

umm, lets take a step back and start with "ultimately i want to extract a JS file from a jar dependency and place it under /target/js/something.js"

richiardiandrea01:01:07

sift is your friend then

richiardiandrea01:01:06

your approach looks good to me, I am not sure about the regex only, but I might be wrong of course πŸ˜‰

michael.heuberger01:01:06

ok, next, which option places a file in the target folder? i only see options related to asset/resource/source but none for target

richiardiandrea01:01:20

resource is good

richiardiandrea01:01:41

boot has the concept of roles for files

michael.heuberger01:01:12

okay, i ll try again with correct paths

richiardiandrea01:01:51

@michael.heuberger also, if you want to actually dump to target you need to append the target task

michael.heuberger01:01:21

umm, still no luck

michael.heuberger01:01:37

~/c/app ❯❯❯ boot -BPd cljsjs/babel-polyfill sift -r 'js/babel-polyfill' show -f                                                
Sifting output files...

~/c/app ❯❯❯

michael.heuberger01:01:54

i expect the contents to be extracted into our /resources/js/babel-polyfill

michael.heuberger01:01:07

ah, -r expects a regex

michael.heuberger01:01:09

boot -BPd cljsjs/babel-polyfill sift -r 'cljsjs/babel-polyfill:development/.*\.inc\.js$' show -f

michael.heuberger01:01:12

doesnt work either

micha01:01:04

i would try just -r cljsjs/babel-polyfill first

micha01:01:14

you should see all the contents of the jar then

micha01:01:21

if that works you can add a regex

michael.heuberger01:01:09

hmmm, doesnt show anything

michael.heuberger01:01:24

~/c/app ❯❯❯ boot -BPd cljsjs/babel-polyfill sift -r 'cljsjs/babel-polyfill' show -f                                           
Sifting output files...

~/c/app ❯❯❯

richiardiandrea01:01:46

true it does not work

micha01:01:10

whoops you need sift -j no?

michael.heuberger01:01:25

i dont want them to be moved into a jar

micha01:01:39

no, that moves them from a jar

micha01:01:51

it's extracting files from the jar into the fileset

michael.heuberger01:01:54

moves them from a jar to where?

micha01:01:00

into the fileset, yes

michael.heuberger01:01:09

ah, and how can i move that further to the resource folder?

michael.heuberger01:01:34

or better to the target folder

micha01:01:40

that where it will be by default πŸ™‚

micha01:01:54

boot -BPd cljsjs/babel-polyfill sift -j cljsjs/babel-polyfill target

richiardiandrea01:01:00

boot -BPd cljsjs/babel-polyfill sift -j cljsjs/babel-polyfill:"js/babel-polyfill" show -f

richiardiandrea01:01:04

tried too yes πŸ˜„

richiardiandrea01:01:08

sorry about the derailing @michael.heuberger I thought we did not need -j

michael.heuberger01:01:55

thats okay @richiardiandrea πŸ™‚

michael.heuberger01:01:02

but when i use boot -BPd cljsjs/babel-polyfill sift -j cljsjs/babel-polyfill:"js/babel-polyfill" show -f i dont find them in the js folder?

michael.heuberger01:01:08

@micha when using target at the and, can i specify a specific subfolder in it instead?

micha01:01:35

sure, target -d target/js

michael.heuberger01:01:25

i think would be good to add some examples to boot’s README.md like these

micha01:01:50

and to the target task docstring perhaps

michael.heuberger01:01:55

i β€œfunction" better when i see examples πŸ™‚

micha01:01:12

i wish there was a groff formatter written in java

micha01:01:20

or some JVM language

micha01:01:39

it would be awesome if boot tasks generated man pages

micha01:01:44

but windows...

michael.heuberger01:01:39

ok, getting there: boot -BPd cljsjs/babel-polyfill sift -j cljsjs/babel-polyfill target -d target/js/babel-polyfill is good but it extract all contents of the jar, whereas i only want to pick one single file from the jar

richiardiandrea01:01:25

@michael.heuberger see my example you can filter

richiardiandrea01:01:42

with -j "name":"regex"

michael.heuberger01:01:59

thanks guys, you rock πŸ™‚

michael.heuberger01:01:25

now trying to achieve that in clj code in a boot task

micha01:01:48

try (doc sift) etc in the repl

micha01:01:04

you can see the options and their types etc

micha01:01:35

you can also do (boot "sift" "-h") in the repl to see the cli help info

micha01:01:40

in the repl

richiardiandrea01:01:31

@bhagany can I ask you a question on the changed-keys implementation?

bhagany01:01:22

yeah, go ahead

richiardiandrea01:01:07

looking at the third param of clojure.data/diff

richiardiandrea01:01:27

those are values in both data structures

richiardiandrea01:01:40

basically now there is a set/union

richiardiandrea01:01:56

with z, I wonder if that should be there

bhagany01:01:10

if the union should be there?

richiardiandrea01:01:54

yes cause you consider that as :changed right?

richiardiandrea01:01:10

but if it is in both it is not really changed

richiardiandrea01:01:38

(unless I am misreading the code)

bhagany01:01:40

it is, if the key is also in x or y

richiardiandrea01:01:50

just for reference (set/union (set/intersection x y) (set/intersection (set/union x y) z))

bhagany01:01:54

take a look at the example in the ticket: https://github.com/boot-clj/boot/pull/566

bhagany01:01:10

you end up with a value in z

bhagany01:01:23

and that same key is in x

richiardiandrea01:01:51

you end up with a value in z in case they are both present

richiardiandrea01:01:54

[things-only-in-a things-only-in-b things-in-both]

michael.heuberger02:01:16

okay, so far i have this:

(deftask build
  []
  (comp
    (cljs)
    (target)
    ;; now extract and copy one file from babel-polyfill like this command does:
    ;; boot -BPd cljsjs/babel-polyfill sift -j cljsjs/babel-polyfill:"polyfill.inc.js" target -d target/js/babel-polyfill
    (sift :add-jar {'cljsjs/babel-polyfill #"polyfill\.inc\.js"})
    (target :dir #{”target/js/babel-polyfill"})))

michael.heuberger02:01:05

but it does something weird in the target folder, overwrites target/js/babel-polyfill over again with everything else

bhagany02:01:16

okay, let me try explaining this a different way -

bhagany02:01:41

data/diff recursively diffs nested structures

richiardiandrea02:01:11

ops sorry @bhagany I am reading it wrong

bhagany02:01:38

okay πŸ™‚ need more explanation?

richiardiandrea02:01:01

no now it is clear, I though z was inside the first set/union

bhagany02:01:23

ahhhh okay

richiardiandrea02:01:57

still have my problem, but I might be tired for further investigation

bhagany02:01:19

it can wait πŸ™‚

grounded_sage08:01:23

I'm hoping someone else can spot what is going on here. Basically I'm looking to remove the .html from strings that represent a url in my routes. When I do a println it shows but the final output the .html seems to make it back into the file?

(defn remove-html [in-file out-file]
  (println (str/replace (slurp in-file) #".html" "")
    (doto out-file
      io/make-parents
      (spit (str/replace (slurp in-file) #".html" "")))))

(deftask remove-html-task
  "Removes the html from routes"
  []
  (let [tmp (tmp-dir!)]
    (with-pre-wrap [fileset]
      (empty-dir! tmp)
      (let [in-files (input-files fileset)
            file-with-html (by-name ["components.cljc"] in-files)]
        (doseq [in file-with-html]
          (let [in-file (tmp-file in)
                in-path (tmp-path in)
                out-path in-path
                out-file (io/file tmp out-path)]
            (remove-html in-file out-file)))
        (-> fileset
            (add-resource tmp)
            commit!)))))

grounded_sage08:01:32

spotted it. Was in the build boot. I had it after the CLJS compilation and not before. Got confused with the comp function

bhagany19:01:54

Looking for a sanity check - I've been trying to work out the testing situation in boot. I've read and mostly understood the code in boot.test and also in adzerk-oss/boot-test. The former seems to be focused exclusively on testing tasks, while the latter is for clojure.test tests. Am I correct that there isn't any overlap between these two things?

dominicm19:01:57

There isn't.

dominicm19:01:09

You want adzerk/boot-test.

richiardiandrea19:01:41

@bhagany basically boot.test is supposed to test tasks, and in parallel

richiardiandrea19:01:03

it is clojure.test compliant but not required for "normal" testing in an app

dominicm19:01:11

Yeah, I probably should have been clearer. For libs/apps you want boot-test/boot-alt-test

bhagany19:01:31

okay, thank you

richiardiandrea19:01:03

one thing to note is that boot-test executes tests in a pod, which has been disproved by a couple of people here (myself included) to be necessary/fast

richiardiandrea19:01:15

so Juho came up with boot-alt-test

richiardiandrea19:01:36

which does not have feature parity but it is where I would put more effort in

bhagany19:01:44

okay, good to know. thanks

richiardiandrea19:01:10

(and the missing features are trivial to implement actually πŸ˜„ )