This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-26
Channels
- # aatree (6)
- # admin-announcements (2)
- # aws (1)
- # beginners (46)
- # boot (341)
- # braid-chat (3)
- # cider (20)
- # clara (1)
- # cljs-dev (3)
- # cljsjs (7)
- # cljsrn (73)
- # clojure (63)
- # clojure-art (4)
- # clojure-dev (3)
- # clojure-russia (83)
- # clojurescript (77)
- # core-async (12)
- # core-matrix (2)
- # cursive (9)
- # data-science (1)
- # datomic (14)
- # dirac (3)
- # emacs (9)
- # hoplon (3)
- # immutant (8)
- # ldnclj (80)
- # luminus (13)
- # mount (7)
- # off-topic (4)
- # om (288)
- # onyx (20)
- # overtone (5)
- # pedestal (10)
- # perun (3)
- # proton (103)
- # quil (1)
- # re-frame (3)
- # reagent (13)
- # ring-swagger (7)
- # yada (43)
also @micha, is adding meta
to TmpFile as simple as with-meta
?
beacuse it's not really metadata to the program, it's metadata from the user's perspective
yes I was actually checking that in boot.core
you also dissoc
[:dir :path :id and :time]
yes, I might actually just call boot.core/add-meta
that does the right thing š
last thing @micha, how can I explode a fileset
in its java.io.Files
?
because add-meta
needs filepaths
can I just take :tree
?
i don't think anything cares about the file paths, only the relative paths in the fileset
but about the file inside the fileset...is :tree
what is needed for the TmpFiles ?
(I need this to work asap ahahah!)
@bensu: donāt know of one - but with boot new
coming from @seancorfield - perhaps we can get one put together. What stack would you start with? Same as saapas?
@donmullen: thanks. saapas would be nice
Iād be thrilled to see a something/boot-template
up on Clojars as something to point to for others!
Soooo @micha sorry to bother again, but is the following correct:
:tree
{"replumb/boot_cljs_src.clj"
{:dir
#object[java.io.File 0x5dff50b "~/mylongdir/boot-cljs-src/cwn/-x24pa9"],
:bdir
#object[java.io.File 0x73faa25d "~/mylongdir/boot-cljs-src/cwn/-7kd6cy"],
:path "replumb/boot_cljs_src.clj",
:id "13a18d07a582fd99407bf48fa488f89b.1453772310000",
:hash "13a18d07a582fd99407bf48fa488f89b",
:time 1453772310000,
:boot-cljs-src-tag true}, <- added metadata
....
yes......but with-meta
returns nil
because it looks like it checks (meta x)
(in https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/task_helpers.clj#L63)
I can fix that, it should be a normal get
, I will try, but I will break things š
sooo, I investigated what is passed inside sift-meta
and it looks like it is just a string, which is the file path, no TmpFile instance...
that should remove all paths (and associated TmpFiles) from the fileset that don't have the following condition:
Look in here, https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/task_helpers.clj#L90
the reducer
is passing just k
not the rest (`:dir ...`)
to match?
you can confirm it by printing inside sift-meta
(defn- sift-meta
[invert? kws]
(->> (map #(fn [x] (do (clojure.pprint/pprint x)
(contains? (meta x) %))) kws)
(apply some-fn)
(comp (if invert? not identity))))
so I will change sift-filter
and the other fns...shouldn't be that hard to keep the same behavior
sift-match
can accept k
and v
where v
is a TmpFile
sorry match?
but ok it should work
@jaen: are you using the ecs-cli? I'm trying to follow your panda5 example, but ecs-cli is actually so limited... it doesn't support build
@jethroksy: I've used AWS before, but not from the CLI. And that university project was only deployed on Heroku, then Openshift and then Digital Ocean, though I don't think deployment on EC2 would be all that different from DO.
Or you can create a docker image, put it in a repo and then create a scaling group with run configurations pulling that image and running that.
The downside is your app has to be stateless, so you should do things like uploading files to S3 and such.
If I've linked you to this - https://gitlab.com/jaen/panda5 - instead of the github repo (I don't remember) then this has docker image creation, so the only part left would be to figure out the scaling groups thing.
This sounds sensible for example - http://www.ybrikman.com/writing/2015/11/11/running-docker-aws-ground-up/
Let's say boot-http wants to expose the port it choose randomly to other tasks in the pipeline: what is the best way to do this? I'm thinking of adding a file to the fileset but also technically it's possible to just (assoc fileset :http-port p)
- other options?
This is a discussion on tasks and meta data: http://hoplon.discoursehosting.net/t/best-practices-for-creating-extensible-tasks/358/5
I found the following quote there: > It's also possible to assoc directly onto the fileset object itself for project-level metadata, if desired.
As the boot-http
task will also serve files that are created downstream, I see no real relation to TmpFiles here.
I haven't seen code doing this before but given the discussion there probably its fine. Sorry for the confusion then I guess :) @codebeige
One problem I could see is in the context of a watch task that creates new filesets which might drop this data (there is some merging done there not sure if outside of :tree as well)
In any case probably good for now :)
One thing I noticed: when using a threading macro non-forms will automatically wrapped in parens so you don't have to do that.
Yes, this is true. I tend to keep them around, if there also a form that takes options and has parens. I like the alignment better. But this is purely personal taste.
anyone using boot to do electron stuff w/ cljs?
i'm curious in general to know what the state of boot/node/cljs is
@alandipert: I did some electron stuff ā anything in particular you'd like to know?
fairly straightforward really
@juhoteperi: just stumbled upon this: https://github.com/jafingerhut/dolly ā might be handy for the namespace importing in boot
I'm doing some housecleaning with boot-http PR's and I'm wondering if anyone has any opinions re: these - https://github.com/pandeiro/boot-http/pull/32 & https://github.com/pandeiro/boot-http/pull/35
Both use-cases are things that I had previously considered solvable by just writing a custom handler, which has always been supported by boot-http
BTW @codebeige thanks for your PR's; I'll merge those as soon as I decide what to do with these two ^
@pandeiro: maybe instead of adding options the README could list these scenarios with fitting handlers? They both seem useful but also add bloat that might be better solved with documentation.
The README is also getting bloated @martinklepsch ! š
Then a "Recipes" wiki page or so?
I think what I'm saying is just adding more and more options will exponentially increase the number of combinations and people might expect them to all work seamlessly when they don't necessarily do. Helping people understand how they can write their own simple ring handlers to accomodate their needs might better for everyone
also testing that all things on their own work becomes a lot more work
Yes for sure. Already supporting Jetty and HTTPKit means testing almost every PR in two variations at least
At the same time, this lib has always tried to be somewhat of a Swiss Army Knife, solving lots of different HTTP serving use cases
It would be nice if there were some way to poll the community of users in situations like this, affecting the API
i would say PRs are votes in that case
your Vision
like the 404 thing... i would probably veto, because that's application behavior i'd rather have in application code than in my build.boot
but otoh, it seems like something a Swiss Army Chainsaw would do
@alandipert: not necessarily if they're writing a frontend that uses pushState?
well they shouldn't do that either
(assuming that is out of question )
but again there's plenty of room for there to be lots of libraries that do what different people want
or for one library to do everything, if the maintainer is up for it
@pandeiro: maybe instead of adding options to the task the lib could come with some sort of contrib namespace where people can contribute more general handlers
and then people could use these for the :handler
option
Wow @martinklepsch I think that is a very cool idea, pre-fab handlers one can drop in
this way the option explosion wouldn't be there at least :))
plus there is a clear path for future contributions in similar directions
@alandipert: @martinklepsch : tell me more about NOT using pushState for SPA front-end (static site).
@donmullen: I think the general point is that it muddies the water between the correct "entry point" into an application from an HTTP perspective. I draw most of that observation from conversations with @micha btw
So weāre considering using the technique here : https://stackoverflow.com/questions/16267339/s3-static-website-hosting-route-all-paths-to-index-html
if you handle all requests through a generic handler that serves the app and place the routing logic inside the app itself (but parsing URL paths instead of hash fragments), there's no need for pushState, is there?
As I understand it, the main objective here is just getting rid of the leading #/
portion of the app's routes?
Ah so what pushState accomplishes is hijacking the browser refresh to not load the index.html
etc again?
@pandeiro: thatās my understanding - but I know only enough to be dangerous š.
@donmullen: re: hoplon yeah, but the redirects looks workable too (just more complicated)
@pandeiro: why not introduce a namespace to boot-http providing a bunch of more common handlers?
@donmullen: if you're using S3 I might just do a little plug here: https://github.com/confetti-clj/confetti
one problem with hosting things on S3 is how they do redirects, like from http://example.com/foo --> http://example.com/foo/
@martinklepsch: hmmm, yeah I suppose that could be done; but is there any reason to do that instead of a wiki page linking to separate projects with handlers? is it easier this way?
they use 302s and not 301s, which is apparently confusing to google's webcrawler and you supposedly get penalized
@pandeiro: just thinking bundling things up might be easier for users ā mostly "discoverability" concern I guess
@micha: if you have a foo
file they will redirect to /foo/
?
Another thing I just realized @martinklepsch is that the :handler
option takes a function, but that function is not really parameterizable
:handler (forward {:opts ..})
returning a handler?
@martinklepsch: if you have a foo
file then no, it won't redirect, but if you have a foo/index.html
then it will
I see. Not something I've had a problem with
Oh right
was planning on capturing the result edn as files and then having another report
task to format and print to stdout/write html into a file
ok, so I managed to write into the file using the (let [t (core/tmp-dir!), f (io/file t "x")] (spit f content) (core/add-resources fs t))
(-> fileset (add-resource tmp) (add-meta {"some/path.sh" {:foo 100 :bar 200} "some/other/path.sh" {:foo 666 :bar 777}) ...)
none of the functions that involve filesets ever use the actual path to the real file for any purpose whatsoever
that just returns an anonymous, boot-managed temporary directory you can use to store files
Iāve been playing around with Boot, and I have a quick question about dependencies...
hi @weavejester ! fire away
Well, typically I want a set of dependencies for development, and a subset of those for production (such as generating an uberjar). In Leiningen Iād use the :dev profile. Iām not certain what the most idiomatic way of doing it in Boot is.
I can make a ādevā task, but it feels clunky, and doesnāt work well with require
Scopes are fixed, arenāt they? I canāt create my own scopes? Or can I?
ātestā just doesnāt seem right if Iām not testing.
Maybe put your dependencies in a map in an EDN file, read that file, merge the dependencies you want, and then use that to set-env!
?
but since you're not going to be pushing your uberjar to maven as a dependency you can invent your own scopes, no problem
By ādoesnāt seem rightā I mean that it feels messy, even if it works!
Bonus points for being able to easily load new dependencies without killing boot (conflicts notwithstanding) in that way.
jaen: I could also put the base dependencies in their own def
@weavejester: true, but then you lose the bonus points (the ability to add dependencies on the fly, to be clear).
micha: I generally donāt want them in the pom, though.
I guess maybe what I do is (def base-dependencies ā[[ā¦]])
then
Well, I didnāt just mean uberjars. Jars too.
yeah the only thing to watch out for is if you perform the dependency resolution in two steps you are not guaranteed to get the same dependency graph as if you resolved all dependencies together in one step
Well, I thought that for production Iād perhaps use a pod.
So maybe Iād (def base-dependencies ā[[ā¦]])
and then (def dev-dependencies ā[[ā¦]])
And (set-env! :dependencies (into base-dependencies dev-dependencies))
Then for production Iād just use base-dependencies
Yes, though the problem with that is require.
(deftask dev
[]
(set-env! :dependencies (into base-dependencies dev-dependencies))
identity)
(require ā[adzerk.boot-test :refer :all]) needs to be at the top level otherwise it wonāt resolve symbols at compile time.
So requiring tasks is a little problematic.
See the problem? A lot of tasks are dev dependencies.
But then all my development deps find their way into my pom file.
Regardless of whether theyāre actually used...
and the :scope "test"
will work with the uber task to make sure those deps aren't included in it
But I could also just use the base-dependencies
in the uberjar task as well, right?
well you'd do (set-env! (into base-dependencies dev-dependencies)
at the top level of your build.boot there
(set-env!
:dependencies (into base-dependencies dev-dependencies))
(task-options!
pom {:dependencies base-dependencies}
uberjar {:dependencies base-dependencies})
That would work too, right?
@micha In the role of squeaky wheel, I'm even having problems with watch on windows when using a library that contains .cljc files.
What repository should I write up the issue on???
It doesnāt? Hm.
Perhaps a pod, then?
@laforge49: if you could open a ticket on boot-clj/boot repo that would be awesome
@weavejester: is there anything that breaks if you add :scope "test"
to your dev dependencies, which won't end up in the pom?
Hm, maybe not. It just feels a little messy compared to Leiningenās profiles.
A tricky thing?
(def alldeps (into basedeps devdeps)
(set-env! :dependencies alldeps)
(set-env! :dependencies (vec (set/difference (set alldeps) (set devdeps))))
removing dependencies from the env won't actually remove the jars from the classpath, that's impossible
the scope is intended to be a way to discriminate between dependencies that are needed at runtime from dependencies needed when compiling or using the artifact as a consumer
so scope test here, without any pom :dependencies shenanigans is i think the correct way to configure it
That does make sense, but to my mind the way that Leiningenās profiles work is better, because each set of dependencies and options is strictly isolated.
I guess profiles are the current best option in Boot, but Iāll give this some more thought.
I feel like there should be a better way
Has anyone experimented with running a REPL in a pod before? Or using nREPL middleware to āenter" a pod?
@weavejester: you can use boot.core/launch-nrepl to start repl servers inside pods
show --list-pods will give you a list of all the pods
do you see a need in the boot.core/by-meta
function which would filter TmpFiles based on the metadata?
Ah cool, thanks
it kind of breaks the convention with other by-name/re
filters by working on TmpFile instead of java.io.Files
@micha: What does it mean by the name of the pod in the :pod option?
@weavejester: you can use boot show -l
to get the pod names
Thanks, I see it. Looks like the pod name is āanonymousā if you create an anonymous pod. Could you tell me how I set the name?
.setName
on the pod
yeah it's anonymous if you create it from the repl because there isn't a namespace associated with it sometimes
Perfect, thanks
@martinklepsch: thanks for the electron pointer btw. no specific use in mind, just wanted to survey
Out of curiosity, does destroying a pod also kill off any threads it has? Itās in a separate classloader, right?
micha: Very nice
Yeah. In the same JVM there are always limits.
great! i was about to implement the above! ^
iām making a boot project that compiles both clojure and clojurescript in separate tasks. is there a way to make them use different :source-paths
? I tried calling set-env!
in each task but when I compose them into a single task this doesnāt seem to work.
hi group. does it make any sense to want to have my scss in a jar that could be brought in with checkout task? the idea is that I have this common css that I want to share between related projects. if it's not completely crazy, does anyone have any idea about how to make that happen?
@raywillig: Makes sense, but it requires that scss task reads imports from classpath or copies the files to a temp dir and passes that to scss compiler. Sass4clj does first.
Instead of boot-sassc yes, to ensure confusion, my task is also named boot-sass.