Fork me on GitHub
#boot
<
2015-09-04
>
jellea09:09:36

writing a boot task, how can I inspect the contents of a fileset?

jellea09:09:11

is there a function which makes logging of these contents easier?

martinklepsch09:09:28

I think there is an -f option that you can use to log the fileset between tasks

martinklepsch09:09:45

@jellea: what do you want to do? :)

jellea09:09:28

martinklepsch: oh thanks!

jellea09:09:59

I want to add a small task which touches a file

jellea09:09:58

to update the last updated timestamp of a file

martinklepsch09:09:39

Ah cool. Discussed that with jt yesterday

martinklepsch10:09:38

Not 100% sure if this will actually work @jellea. Potentially you need to copy the file, touch it, and create a new fileset from it.

jellea10:09:31

Thanks! 😄 Looks good, will try in a sec

jellea10:09:29

Gave it a try and it works! simple_smile FYI using this to trigger a core.cljs compile on changes in edn files simple_smile

alandipert11:09:48

@jellea: what do you mean by core.cljs compile? sounds intriguing

martinklepsch12:09:59

@alandipert: He has a system that derives much of its functionality from .edn files. So when those edn files change they want to recompile cljs.

martinklepsch12:09:40

not 100% sure on the details but I guess some macro inlines the edn stuff or so.

alandipert12:09:58

interesting. do you know why the normal watch way isn't applicable?

martinklepsch12:09:30

normal watch only triggers cljs recompilation of cljs or macro files have changed, not when .edn files change.

onetom12:09:23

shouldnt u just need to add the dirs containing the edn files to the source-paths?

martinklepsch12:09:18

@onetom: Interesting question, haven’t considered that. let me try.

martinklepsch12:09:44

@onetom: that indeed works. lol. @jellea ^

martinklepsch12:09:16

@alandipert: oh and core.cljs as in their core.cljs not cljs.core

onetom12:09:49

happy to hear simple_smile

alandipert12:09:25

its ok i think any excuse to write a cool task and learn boot APIs is legit 😎

martinklepsch12:09:04

@alandipert: I was actually wondering if using touch like this is “idiomatic” technically this modifies the fileset right?

jellea12:09:58

onetom: we thought about that, but then withdrew it for some reason

alandipert12:09:09

it's on the edge... the fileset doesn't really guarantee any properties of the underlying file other than its name and contents, it would be like touch-ing a blob in .git

alandipert12:09:37

but perhaps permissions and timestamps should contribute to the identity of tmpfiles

alandipert12:09:15

(they don't in git, maybe to avoid platform differences, not sure)

alandipert12:09:48

anyway i think it's idiomatic because it's idiomatic in boot to write code that does what you want simple_smile

alandipert12:09:22

then to share and discuss it with the community, even more idiomatic

martinklepsch12:09:24

@jellea: if the issue was that it wouldn’t end up in a jar you can add the path to both src and resource paths

jellea12:09:33

😐 it works!!

jellea12:09:01

Hmmm it worked for the first try 😞

martinklepsch12:09:31

how do you mean first try?

jellea12:09:30

I thought it worked, but apparently it didnt.

micha12:09:32

@martinklepsch: i don't think touching a file will totally work because the last modified time is one of the things that is included in the immutable fileset object

micha12:09:03

you would need to update both i think, touch the file and then create a new fileset object reflecting the change

martinklepsch12:09:06

@micha: it definitely does work

martinklepsch12:09:27

the tasks I pasted are tested (to some degree)

micha12:09:28

the next time you call commit! it doesn't set the modtime back to what it was?

martinklepsch12:09:20

maybe it does, maybe the interim change is sufficient for boot to pickup that change though

martinklepsch12:09:34

what you’re saying is why I was asking if it’s idiomatic/richtig 😛

micha12:09:51

modtimes were a little tricky i recall

micha12:09:29

i think maybe we removed that functionality from commit! actually

micha12:09:40

so it never sets modtimes in the past

micha12:09:53

because i think that resulted in infinite loops or something

alandipert13:09:03

oh yeah i remember that now

raywillig15:09:23

can anyone here answer a (possibly dumb) question about boot-jetty?

raywillig15:09:10

i'm getting a class not found error. do i need to include the jetty dependencies in my build.boot?

micha15:09:30

you might have dependency conflict with the jetty stuff

micha15:09:45

if you are using ring for example you should exclude some things

micha15:09:54

there is also a little macro you can use

micha15:09:35

i ran into this also the other day, and this is the fix that works for me

raywillig15:09:53

cool. I'll give it a whirl

raywillig15:09:42

in your setup, do you just load-file "geir_tasks.clj" in your build.boot?

micha15:09:59

no, it's a namespace

micha16:09:27

that's just a small part of it

raywillig16:09:03

that sort of made things worse since it wasn't finding the ring and cors stuff I needed. but i was able to make it work w/o with-deps by just specifying rong-core instead of the whole shootin match

micha16:09:37

i mean you needed to put in the with-deps the deps you need

raywillig16:09:51

right, i figured that, but it was getting painstaking to figure out which ones i was missing. and clearly i didn't need the whole ring suite in my deps so that was a good discovery to make

martinklepsch16:09:24

@juhoteperi: should I file an issue for that dependency reloading thing in boot-cljs btw? Just that it doesn’t get lost?

juhoteperi16:09:51

@martinklepsch: Will be fixed when upstream change is merged

martinklepsch16:09:34

@juhoteperi: I’m talking about using set-env! to add a cljs dependency, is that the same thing?

juhoteperi16:09:42

Oh, that one

juhoteperi16:09:23

Should be quite simple change

martinklepsch16:09:30

are notifications for adzerk-oss in this channel?

juhoteperi16:09:43

I don't think so

martinklepsch16:09:23

@micha: can’t do it without admin permissions

micha16:09:03

admin permissions on which?

micha16:09:33

@martinklepsch: you're on the "owners" team, is that not enough?

micha16:09:46

oh maybe we need to enable something in github

martinklepsch16:09:14

Think Ifound it

micha16:09:31

confusing, their interface is

martinklepsch17:09:57

I set it up for a couple of repos now. Should work.

juhoteperi17:09:50

Needs "some" cleaning 😄

juhoteperi17:09:27

fileset "slicing" and merging can be properly implemented with a function

juhoteperi17:09:40

for dependencies it would be best if pom task took :dependencies option

micha17:09:52

yeah +1 for that

micha17:09:13

i've often thought that :dependencies don't belong in the env in the first place

micha17:09:28

complecting those concerns is kind of a confus

juhoteperi17:09:08

I would also like to find some solution on how to define the modules in the files themselves or something

micha17:09:35

do you have a demonstration repo handy?

juhoteperi17:09:43

The one I linked

micha17:09:49

oh ok awesome

micha17:09:11

i need to sit down and see how it works simple_smile

micha17:09:00

seems like a thing that could be useful to have in boot core

micha17:09:56

also i am super excited about clojutre btw

juhoteperi17:09:05

I'll see how general implementation I can create for fileset slicing and merging. That would definitely be useful.

micha17:09:39

if i can ship all the things i need to ship before then it will be extra great simple_smile

juhoteperi17:09:14

Just code on the flight 😄

juhoteperi17:09:19

And deploy from plane

micha17:09:21

splitting and tagging fileset and then merge is a thing i was trying to figure out how to do in the general case

micha17:09:39

not obvious how to do it though

micha17:09:09

i was thinking about maybe having like stacks

micha17:09:19

like registers sort of

micha17:09:25

you can push things on and pop things off

micha17:09:12

i think that's the usual way to approach these kinds of problems

micha17:09:20

git stash sort of

juhoteperi17:09:36

Yeah sounds good

micha17:09:55

i guess what we really want is more of the git model implemented in filesets

micha17:09:22

branches, stashes, maybe something else?

micha17:09:00

rather than inventing a new thing that does the same, try to stick to the git workflow as much as possible

juhoteperi17:09:29

I'm not sure if there is anything there for selecting few files for some task

micha17:09:54

that would be branches maybe?

micha17:09:07

like you make a new branch with a name that you can use later

micha17:09:31

you remove things from the fileset and make the branch

micha17:09:43

then you can checkout the branch for some task

martinklepsch17:09:39

we should do hack something in tampere simple_smile

micha17:09:53

dude that will be awesome

juhoteperi17:09:31

Sure. We can hack at our office.

juhoteperi17:09:13

You both were staying for few days?

micha17:09:27

i'll be staying from 9-15

martinklepsch17:09:19

would be cool to have a boot-friendly task that sets up all sorts of beginner friendly things (thinking of https://github.com/frenchy64/dynalint and similar projects)

kenny17:09:11

Could someone please help me with writing a boot task? simple_smile I am trying to package quill.js as a cljsjs package, however, I am getting the below error:

clojure.lang.ExceptionInfo: java.lang.AssertionError: Assert failed: No .inc.js file found!
                                         regular
I am guessing that somehow the files are not getting moved from the download but unsure why that would be happening. Here is my task. I have already created an externs in the path resources/cljsjs/quill.js/quill.ext.js.
(deftask package []
         (comp
           (download :url ""
                     :unzip true)
           (sift :move {#"quill.js"       "cljsjs/quill.js/development/quill.inc.js"
                        #"quill.min.js"   "cljsjs/quill.js/production/quill.min.inc.js"
                        #"quill.base.css" "cljsjs/quill.js/common/quill.base.css"
                        #"quill.snow.css" "cljsjs/quill.js/common/quill.snow.css"})
           (sift :include #{#"^cljsjs"})
           (deps-cljs :name "cljsjs.quill-js")))

juhoteperi17:09:18

@kenny: (show :fileset true) after sift tasks should be useful to debug if the files are in correct places.

micha17:09:21

can the :name have dashes in it?

juhoteperi17:09:58

Hmh, that can be a problem also but not the one that is causing the error

micha17:09:37

you might need underscore there, and probably instead of cljsjs/quill.js perhaps cljsjs/quill_js or whatever, the same as the :name

kenny17:09:43

I have done one of these before with a name hyphen in the name.

juhoteperi17:09:07

Hmm, yeah namespaces can have dashes. It's the files which can't have them.

kenny17:09:15

Hmm.. the output from the (show :fileset true) is interesting. I think it is creating the folders in the incorrect directory.

micha17:09:29

for comparison

martinklepsch17:09:41

@kenny: omit the js suffix in general

kenny17:09:08

@martinklepsch: From what? All directories?

martinklepsch17:09:57

package name, which subsequently also means directories, yes simple_smile

juhoteperi17:09:27

:move {#"quill.js" "cljsjs/quill.js/development/quill.inc.js"

juhoteperi17:09:55

this would rename e.g. foo/bar/quill.js to foo/bar/cljsjs/quill.js/development/quill.inc.js.

juhoteperi17:09:48

The move works so that it replaces the string matched by the key with the value

martinklepsch17:09:55

Also these are regexes so maybe quill\.js

kenny17:09:22

Ah. So in zip that I am downloading in the task the quill.js file is in the directory dist/quill.js. So maybe: dist\/quill\.js?

juhoteperi17:09:54

Also, you need to take into account that they are inside quill-0.20.0 directory.

martinklepsch17:09:26

@juhoteperi: these regexes should still match as long as they don’t start with ^ no?

juhoteperi17:09:51

martinklepsch: Yes, they will match but afaik only the explicitly matched string will be replaced

juhoteperi17:09:19

#".*/dist/quill\.js" could work

kenny17:09:03

That did it! ^^

kenny17:09:51

@juhoteperi: If you don’t mind explaining, how did that move the files up a directory? simple_smile

juhoteperi17:09:36

string replace replaces just the part which is matched by the regex

kenny17:09:20

Got it. Thanks!

martinklepsch18:09:56

@kenny: looking forward to your PR 😊

esp122:09:20

I'm looking for help on how to attach metadata to files in boot

esp122:09:09

I've read the Task Writer's Guide and it advises to refer to how perun is generating metadata for sitemaps, but I'm finding it hard to follow

esp122:09:41

Looking through the perun source it looks like :filename and :last-modified metadata is present, but when I do (:metadata (meta fileset)) on my fileset in my task it shows up as nil

esp122:09:33

Perhaps this is set in perun, but if so I'm not following how

esp123:09:33

Thanks - It looks like these functions aren't actually used in the perun sitemap task tho. I guess my bigger question is: is all metadata freeform, or are any 'standard' metadata values expected to be provided by boot?

esp123:09:01

Reason I'm asking is I saw this commit and it sounded like it expected metadata to be in a particular form: https://github.com/boot-clj/boot/commit/038d8dde09704e3d22b5cdfdd8be984825f04bf9

esp123:09:01

Hmm on second read it looks like add-meta expects a map with string file paths as keys in order to identify TmpFile objects, but otherwise the metadata is arbitrary. Ok that makes sense now