This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-27
Channels
- # beginners (106)
- # boot (124)
- # cider (11)
- # clojure (105)
- # clojure-poland (2)
- # clojure-russia (28)
- # clojurescript (89)
- # core-async (14)
- # cursive (10)
- # datomic (7)
- # emacs (12)
- # garden (5)
- # hoplon (345)
- # immutant (127)
- # mount (2)
- # off-topic (24)
- # om (24)
- # onyx (8)
- # parinfer (51)
- # proton (2)
- # slack-help (4)
- # spacemacs (1)
so if I have a profile.boot
and I do:
(task-options! environ {:env {:db-port "4334"
:db-host ""
:db-name "dev"}})
should my env see the change?a custom task works, just tried
anyone used boot-template
before? if i put a file under resources folder, say public/index.html
, should i use the path “public/index.html”?
@richiardiandrea: what do u mean by "should my env see the change"?
whether the value for the environ
task set in your profile.boot
is "overwritten" by the on in your build.boot
?
it sounds obvious to try, so i suspect u meant something else
@settinghead: how do you mean "use the path"?
hi folks. i'm trying to figure out how to use the ".cljs.edn" technique in boot-gae, using boot-reload as a guid. i've got the basic logic down, but i'm stuck on idempotency. by that i mean i have a reloader
task that injects some config data (`:reload`) into web.xml.edn
and does add-resource
to the result. other tasks may inject other config data. i want to ensure that invoking reloader
more than once makes no difference. my first try: filter on output files, see if web.xml.edn
is there, and if it already contains the :reload
key do nothing, otherwise add it, or if it is not in output files try the input files. couldn't get it to work. but i see boot-reload uses an atom, prev-pre, with fileset-diff and (reset! prev-pre fileset)
. can somebody explain how that works? does that make the task stateful?
a related question: it just occurred to me that tasks are actually closures rather than functions. if you do (defn f [] ...body...)
, the defn
will intern f with the entire body as its val. but it looks like deftask
pulls out the closure (fn [next-handler] (fn [fileset]...))
. so any local bindings you put before the closure only get evaluated once, at compile time. is that correct? that's the only way i can make sense of using atoms like prev-pre.
@mobileink: the fileset-diff makes the task stateful
and it returns a new immutable fileset that contains files that have been added or changed from before to after
if you pass in nil
as the before fileset the after fileset is returned (i.e. all files are changed, naturally)
ok, i guess my functional programming naivety is showing - i was treating the (let [foo ...
stuff at the beginning of tasks as behaving just the way it would in a fn. but when deftask returns a (fn [x]...
that's a closure, which is ordinary. i knew that. really i did. 😉
so using an atom with fileset-diff, i'll know that anything in the diff has changed since i last set the atom
re: deftask its now on my list to write some doco to alert those who are not really used to programming with higher-order functions. i've been doing it for a while, so i'm a going to have to have a stern talk with myself about this...
but just because i know my web.xml.edn has changed doesn't tell me what to do - i'll still have to examine it to see if the part my task is interested in has changed. Correct? so i'll look for :reloader
and if its there i'll leave it alone, otherwise add it.
another question wrt fileset-diff: file role does not matter? i.e. a file with input role could have changed, correct? iow, just because a file has INPUT only role does not mean it cannot be changed without acquiring the OUTPUT role also?
ok, so if i just copy a file with INPUT to tmp and then to add-asset, it will be in the diff even though it's an identity xform wrt name and content
and by the same token i could in principle just change the timestamp on an INPUT-only file and it would show up in the diff even though its role did not change
ah, right an identity xform would put a different timestamp on the target so it would be in the diff because of that, not because of the role
yeah basically a blob in the blob store is identified by the md5 hash of the contents and the modification time as long int
@onetom just meant to say that my task-options! above in profile.boot did not work, it looks like it does not set the options, which actually makes sense, probably task-options! it local to the file it resides in
@richiardiandrea: task-options! calls alter-var-root on the task functions
https://s-media-cache-ak0.pinimg.com/564x/c1/30/67/c13067da6da379571bc2a0aedb8653b4.jpg
Right, in any case I need to task it up
Loooooool
At the Facebook office really ?
Well very informative interviews :)
Yeah now it is clear why it was not working
So I put task-options! In profile boot, then my pipeline sees the curried task right?
Ok so I was just missing the (curried) call to environ
https://github.com/adzerk-oss/env is what i have been using
If it saves a file like in lein, maybe yes, but I will try..what is sure is that launching the environ task worked for me
I mean without task-options! but a wrapper task calling environ in the pipeline
So I assume it will work
i'm not sure about what happens if you set environ things in the core pod and then expect other pods to see those setings
Yeah, my use case though was to set env vars for the app so mission accomplished for now ;)
Boot rulez
Childish but always effective :)))
I may be asking this question many times. But there's something obvious Im missing from boot. I'm simply trying to get cider to work with bREPL, in a way that I can just do C-x-e or M-x in emacs. If I do boot repl -c and then (start-repl) I get the brepl but its not cider. If I do boot cider repl and then (start-repl) it crashes. If I do cider connect to nrepl started by boot, it wont even load up clojure.core. From leinigen i was able to "live code", but I know Im just missing something in boot.
ok, I've been doing that so far.. just annoying to print the state, sometimes I would like to mutate an atom and just see how the state chaned. My workflow is slow, use the brepl from terminal and/or print to console
makes it pretty easy for me to work that way without needing to get repls working and stuff
for a while everything was changing so much that it was pointless to try to have a working repl at all in cljs
ok, yes, all the documentation seems to suggest this kind of workflow. But Im so used to JVM and miss having this instant feedback. Yes, I guess when you are at a certain level then you dont need this.
ok.. do you have link to some of those macros loggers that you use, or you just made it yourself?
the macros allow me to use those a lot and not have to worry about them being left in when i do a production build
ok, I dont know if I was stupid there or emacs. Shit, but I have the repl working now. Just restarted emacs and did cider-connect and from there (start-repl) everything worked without error. Im glad, I open a beer for this.
hi @chris_johnson, welcome
@micha: correct
i was using this in boot.build like this:
(template :paths ["public/index.html”] :subs {"%BC_SCRIPT%" (str "
i essentially want to sub a variable in my index.html file
boot.user=> (doc template)
-------------------------
adzerk.boot-template/template
([& {:as *opts*, :keys [help paths subs output-type]}])
Perform text substitution on files in the fileset using StringTemplate. For instance, with a file foo/bar.txt in the fileset with this content:
My name is $name$
And this task used like this:
(template :paths ["foo/bar.txt"] :subs {"name" "Barney"})
foo/bar.txt will appear in the target directory with this content:
My name is Barney
Keyword Args:
:help bool Print this help info.
:paths #{str} FileSet root-relative paths of input file(s) to perform substitutions on.
:subs {str str} String substitutions to perform on the file(s).
:output-type kw Optional output type; can be one of :resource or :source. Default is :resource.
@hlolli for a working cljs sample with boot you can look at https://github.com/Lambda-X/cljs-repl-web
It is basically http://clojurescript.io
And I use the conf in the boot wiki (which I enhanced with the .dir-locals.el trick)