This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-03
Channels
- # admin-announcements (2)
- # beginners (18)
- # boot (118)
- # cider (12)
- # cljs-dev (12)
- # cljsrn (24)
- # clojure (142)
- # clojure-art (4)
- # clojure-bangladesh (3)
- # clojure-ireland (1)
- # clojure-italy (7)
- # clojure-norway (4)
- # clojure-poland (207)
- # clojure-russia (101)
- # clojurescript (108)
- # clojurewerkz (2)
- # core-async (6)
- # css (8)
- # data-science (23)
- # datomic (31)
- # devcards (2)
- # emacs (8)
- # funcool (25)
- # hoplon (34)
- # immutant (78)
- # ldnclj (7)
- # lein-figwheel (4)
- # leiningen (6)
- # luminus (35)
- # off-topic (1)
- # om (119)
- # onyx (43)
- # parinfer (29)
- # proton (11)
- # re-frame (25)
- # remote-jobs (1)
- # slack-help (1)
- # spacemacs (3)
- # yada (10)
Finally we are trying deraen.boot-less
.
When I change a .less
file, it gets recompiled nicely, BUT (cljs)
also kicks in AND recompiles AND reloads my Hoplon app unnecessarily.
Is there a simple way to get around this problem?
My pipeline looks like: (comp (serve) (from-cljsjs) (sift) (watch) (less) (hoplon) (reload) (cljs) (speak))
anyone built up tools for working with webjars? i'm looking for a form of sift -j
for exploding webjars deps into my resources
thusly computed:
(require '[boot.pod :as pod]
'[boot.core :as core]
'[boot.from.digest :as digest])
(core/deftask webjars
"Unpack all webjars into the fileset."
[]
(let [webjars (->> (pod/resolve-dependencies (core/get-env))
(filter #(= "org.webjars" (namespace (first (:dep %)))))
(map :jar))]
(with-pre-wrap [fs]
(reduce #(core/add-cached-resource
%1
(digest/md5 %2)
(partial pod/unpack-jar %2)
:include [#".*"]
:mergers pod/standard-jar-mergers)
fs
webjars))))
You know, it's s**t like this that makes me love Boot... It's all "just Clojure"...
When I was writing boot-new
there were several times where I was like "Wow, it was that easy?"...
@alandipert: it's funny u mentioned this webjar explode function because i was just thinking about utilizing the org.webjars.bower/semantic-ui "2.1.8"
instead of maintaining our own cljsjs package of it
yeah i'm working on emulating bower in boot basically
so we can use webjars and they get added to the classpath at /bower_components
definitely will share what i come up with
i'm doing it to more easily use polymer from hoplon
@onetom: doesn't work yet, but here's what i have so far : https://gist.github.com/alandipert/b100723aa2efb3502f59
the idea with the move-webjars task is that it identifies "bower webjars" and groups their files under /bower_components/<project>/<project-file> in the fileset
anyway now i must sleep, will pick it up later. also feel free to run with it
here, it says to add some boot tasks to my project: https://github.com/cljsjs/packages/tree/master/codemirror
@alandipert: That's a neat idea. Most people in the js world consider bower "dead" though.
Npm is supposed to be where it's at now, even for css. Which spins my head still a little.
Hi I have a question we recently moved our from leiningen to build. And our buildserver uses a SAN which seems to make boot very slow when creating a uberjar. Does anyone here has any ideas for creating some sort of uberjar with non unpaked jars and starting up with boot or something like that? Or is that a crazy idea?
Our build went from 4 minutes to 11 that kind of sucks 😞
@mitchelkuijpers: try capsule
Aha but they do have a leinigen plugin, thnx @dm3 might be an idea to create a boot plugin myself
also you can trade faster AOT compilation for slower startup by creating an empty main_aot
ns and delegating to the actual main
@dm3: So you guys are using this already but without boot?
Aha ok I will check out the leiningen plugin
i wonder about adding :dirs
as an alias
to the target task
@alandipert, just wondering, what do you guys use for ops? Provisioning, setting up servers, etc? Did you manage to sneak clojure into these processes too?
historically and still mostly today we use a mix of chef and AWS stuff but that's changing fast
micha has been working on a project to replace it all with a few small shell scripts
basically we're backing out of chef and most of the AWS stuff and falling back to haproxy, shell scripts, and EC2 API
i've been working on reporting and batch job type stuff and i've been making heavy use of lambda + clojure
oh a cool outcome of micha's work so far has been https://github.com/micha/json-table
we use that to gather information from AWS apis and process it in shell
yeah i used it way back, not a fan
What would you use now for a project from scratch ? (I used fabric in python at work, played a bit with ansible but none really convinced me)
it would depend on lots of things
does the following return a new fileset? the doc is not clear on this. (-> fileset (boot/add-resource tmp-dir) boot/commit!))
(with pm2
at work, since I am the only one doing Clojure, and pm2
is used by all the other node.js
servers)
@nha: are you on a team? also do you have more than one app deployed there?
@mobileink: correct, returns fileset
@alandipert: small team (2) and we have < 5 apps
but is it a new fileset? it looks like commit!
mutates its argument, and the doc is not clear on add-resource: "Add the contents of the java.io.File dir to the fileset's resources." I assume it returns a new fileset, just like clojure.core/assoc etc.
i've found that all the approaches are the same until the number of people, churn, and apps involved exceeds some magic number
then they all seem to fall down
@mobileink: the add-resource part returns a new fileset
@nha: yup! maybe a general thing to avoid is anything that claims to be one of comprehensive/declarative
regardless of scale, building your ops around programs you made and understand seems almost always better than building it around someone else's declarative framework
which is odd because that's exactly what all the devops marketing says is terrible
me also lol
but yeah i suppose it's less that boot is helping us do ops
and maybe more that experience failing at ops w/ frameworks helped inform the boot principle of Programming First
Neat. Really neat. I remember doing makefiles, then gruntfiles then gulpfiles in the .js world, but because of mutability those files quickly ended up being somewhat messy.
yeah, i suppose being able to program assumes you have the right primitives to build on, the fileset for whatever the domain is
i think micha's ops scripts are really clean because they build on AMIs, ELBs, ASGs, and EC2 instances, primitives provided by aws
he has identified the ASG as the principle collection abstraction, a first-class way to name a set of instances
speaking of, i need to deploy some things, bbl
it sucks to use chef atop AWS, since the chef abstractions aren't the real ones
it's like the ORM dirty-check problem kinda
in some way, pallet is a set of clojure functions yuo can use to drive whatever you want right?
i've definitely used it for the libraries it bundles
which was comprehensive last i checked
(deftask from-jars
[i imports IMPORT #{[sym str str]} "Tuples describing imports: [jar-symbol path-in-jar target-path]"]
(let [add-jar-args (into {} (for [[j p] imports] [j (re-pattern (str "^" p "$"))]))
move-args (into {} (for [[_ p t] imports] [(re-pattern (str "^" p "$")) t]))]
(util/dbug "Importing from jars: %s\n" (pr-str add-jar-args))
(util/dbug "Moving into locations: %s\n" (pr-str move-args))
(util/info "Importing %s files from jars...\n" (count imports))
(sift :add-jar add-jar-args
:move move-args)))
(deftask import-css []
(comp (from-jars :imports #{['org.webjars.npm/basscss "META-INF/resources/webjars/basscss/8.0.1/css/basscss.css" "_bass.scss"]
['org.webjars.npm/normalize.css "META-INF/resources/webjars/normalize.css/3.0.3/normalize.css" "_normalize.scss"]})))
@alandipert:@martinklepsch: nice, thanks
@alandipert: I move files into appropriate places and import them as partials in SASS/less liking it so far
yeah i got something similar kinda working for polymer "bower webjars" but there are just too many
so i need to do some computing to put all the jar contents in the right places
i guess the actual problem is i want to depend on webjars that have transitive dependencies that i also need to add to fs
one thing that's still annoying me is that webjars doesn't seem to build the deps of basscss
(npm) and so I'd have to do all of these manually 😕
that is lame 😞
@juhoteperi mentioned that webjars should build dependencies but doesn't seem to for me
@martinklepsch: Only tested in once with a bower package I think, I thought it did package deps but not sure
hi folks. is there any way to build a pipeline dynamically in a task? i've been trying but I'm stumped. here's an abbreviated version:
(boot/deftask meta-config [p pkg-mgrs PGKMGRS #{kw} "package mgr keywords, :bower, :npm :polymer, :webjars; default is all"] (let [pkg-mgrs (if pkg-mgrs pkg-mgrs #{:bower :npm :polymer :webjars})] (for [pkg-mgr pkg-mgrs] (meta-config-impl :pkg-mgr pkg-mgr))))
meta-config-impl
is a private task. this for loop does not work. it does work if I call meta-config-imple once at the top level
a recur loop to pass the fileset? is there a standard way to do this? some bit of clojure that's hiding from me, prolly.
Task must return a function. for
returns a sequence.
yeah, that for loop is just to illustrate what i want to do - run the task once for each keyword, so it can default to running all of them
Just combine the functions with apply comp
or such.
sorry for being dense, but I don't see how to get the args. generically, i have one function f that i want to compose, once for each of n args: (comp (f a) (f b) ...) but my n args are in a set. i can't see how to do it. not a boot-specific question i guess, maybe i'll try on the general mailing list...
`(boot/deftask meta-config [p pkg-mgrs PGKMGRS #{kw} "package mgr keywords, :bower, :npm :polymer, :webjars; default is all"] (let [pkg-mgrs (if pkg-mgrs pkg-mgrs #{:bower :npm :polymer :webjars})] (apply comp (map #(meta-config-impl :pkg-mgr %) pkg-mgrs))))`
@alandipert: FYI you might find it worth a few minutes to look at the webjars support i've added to https://github.com/mobileink/boot-bowdlerize. Doco's out of date, but see the webjars
testapp for an example, it's pretty straightforward. My approach is a bit different, the idea is that we use edn files (one per pkg mgr) to construct a master edn file (bowdlerize.edn) that gets passed through the pipeline. Installation is then a separate task that is driven by the master edn, not the pkg mgr edns. So to installing webjars looks like this: $ boot b/meta-config -o webjars b/install-webjars target
Creating bowdlerize.edn
Elaborating bowdlerize.edn with :webjars stanza
Writing target dir(s)...`
installation unpacks the webjars into a global boot cache but first checks to see if they're already there and skips unpacking if so.
the nice thing also is that the config files can be extended and used in other tasks. man, i love boot!
fwiw the code is still a work in progress but I welcome any critique/comment/advice.
ps. an entry in webjars.edn
looks like this: {polymer.paper {button [org.webjars.bower/github-com-PolymerElements-paper-button "1.0.11"] card [org.webjars.bower/github-com-PolymerElements-paper-card "1.0.8"]}}
pps. i'm not sure i'm using pods optimally. i'm at the stage where i do stuff just because i see its possible and i want to see how it works, like making a ->pkg-mgr-pod
that makes a pod based on data in an edn file. very interested in advice as to how best to use pods...
@mobileink: that looks great! i'll dig in later