This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-23
Channels
- # arachne (3)
- # aws (1)
- # bangalore-clj (2)
- # beginners (19)
- # boot (151)
- # cider (72)
- # cljs-dev (9)
- # cljsjs (7)
- # cljsrn (37)
- # clojure (215)
- # clojure-austin (1)
- # clojure-denmark (2)
- # clojure-dev (68)
- # clojure-india (1)
- # clojure-ireland (2)
- # clojure-italy (4)
- # clojure-mke (1)
- # clojure-nl (4)
- # clojure-russia (4)
- # clojure-serbia (1)
- # clojure-spec (29)
- # clojure-uk (23)
- # clojurescript (23)
- # cursive (24)
- # datomic (71)
- # emacs (5)
- # events (1)
- # gsoc (11)
- # hoplon (20)
- # klipse (4)
- # lambdaisland (2)
- # leiningen (3)
- # luminus (3)
- # off-topic (30)
- # om (40)
- # om-next (1)
- # onyx (15)
- # pedestal (19)
- # perun (7)
- # planck (23)
- # proton (1)
- # protorepl (2)
- # re-frame (35)
- # reagent (21)
- # ring-swagger (38)
- # rum (19)
- # spacemacs (9)
- # untangled (11)
- # vim (5)
- # yada (4)
@mobileink i really spent too much time figuring that out š¢
hey guys, Iām trying to get powerlaces/boot-cljs-devtools to work, but failing. can someone advise?
@ag that should work, I am glad you solved, let me know if there is any other issue or open one on the repo ok?
@richiardiandrea of course! thanks!
Does anyone have a "best practices", minimal example of setting up a dual CLJS (browser) and CLJ (server) REPL? Right now I've added two tasks to my profile.boot: cljs-dev (which calls cider serve watch cljs-repl cljs) and clj-dev (which calls cider repl wait), but it seems "wrong" to have to pivot between these two manually when I cider-jack-in?
And putting tasks in profile.boot is problematic because I need to set dependencies (e.g. boot-cljs-repl) which are loaded for all other projects (I realize this is suboptimal)
@tmarble without cider but you can try tenzing. it gives you a repl that can be āturned into cljs modeā with (start-repl)
and you can switch between plain clojure and cljs
@martinklepsch IIUC once I have "nREPL server started on port 63518 on host 0.0.0.0" i can cider-connect to that from Emacs (or connect from Cursive, etc.), right?
Hmmm I appreciate the point about #noBackend, but in my project I already have a backend... So perhaps my classic "cider-jack-in" will work for the backend REPL?
the repl is a repl, if you have backend code itās not gonna say āIām not going to load this!ā š
anybody gotten squiggly to work via cider-connect with boot? adding it to default-dependencies just breaks cider-nrepl
@mobileink do you have an example for making http requests on app engine / boot-gae in the standard environment? i tried http-kit which gave me a security exception (?) and then i switched to http-clj and it raised
Uncaught exception from servlet
java.lang.NoClassDefFoundError: java.net.ProxySelector is a restricted class. Please see the Google App Engine developer's guide for more details.
iām probably missing something š@tosh did you try the greeter example? it responds to POST requests. the uploader example responds to POST.
see https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/urlfetch/URLFetchService and https://cloud.google.com/appengine/docs/java/issue-requests
iirc the gae standard environment is a bit restrictive (eg for the python runtime it took some time to write wrappers to make sure the http libs work)
see also https://github.com/migae/urlfetch - havenāt used it in months but it should work, i think.
gaeās urlfetch service works pretty well and is pretty simple. see e.g. http://www.programcreek.com/java-api-examples/index.php?api=com.google.appengine.api.urlfetch.HTTPMethod
i see i never got around to pushing migae/urlfetch to clojars. it was developed before i switched to boot. youāll have to clone and install it locally until I get around to pushing it, sorry.
when using clj + cljs with different dependency sets, do I create one boot file, or separate boot files for server/client ?
@qqq do you mean so that you donāt package dependencies for cljs in your clj code?
something like boot web uber -j war
but i don't see a recent example anywhere
i'll make one, we should have that
@qqq do you need to use cljs dependencies beyond your development/CI environment?
@alandipert : awesome, thanks!
@esanmiguelc : here's the XY problem I am writing an app where server side `= clojure on GAE client side = cljs I used to have a lein setup taht works fine (I still do) I am switching to boot and am trying to figure out how to make this all work on boot.
@qqq right, so typically when I deploy, I deploy the compiled cljs. So my cljs dependencies are only needed in my local development, I use mavenās scope https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope to control what gets bundled for my server. I donāt know if there is a boot version of profie dependency definitions
@esanmiguelc : oh right, yes, after my cljs is compield to js, I only care about the js libs it depends on, I don't care about the clojure libs used to generated the js
no worries
i'll add a dev
task that uses reload middleware in a sec
@alandipert : you're challenging my belief that all ad companies consist solely of dementors
it leans on lots of tasks built in boot
the little stack there ropes in probably a few thousands lines of clj
well, maybe a few hundred
this is a thing we do a lot, so there's already lots of code to support it and things like it
the difference here between boot and most other tools is that the integrations of the concerns happen with the fileset value
ie in and of themselves, these tasks are independent of one another, and can be used in user-supplied order
to continue beating this dead horse -- this is literally something that I can just type on the commandline, but what you have done is nicely packaged it into a single "task" right ? so I can type "boot build-war" instead of "boot web uber war :file "appwar" sift :include ... target" right?
it would be a little different like boot web --serve boot-war-example.core/serve war --file app.war sift --include app.war target
but yeah
there is a different protocol for supplying args at cli than in clj
the othre thing that's nicer, about the build.boot, is the deps
boot -r src/ -d org.clojure/clojure:1.8.0 -d ring:1.5.1 web --serve boot-war-example.core/serve war --file app.war sift --include app.war target
ā« ye whole thing
minus inferring clojure-version
@alandipert : thanks! this clarifies alot; I'm a big fan of how "explicit" and "compositional" (as opposed to "magical") boot is compared to lein
hehe yes
it's maximally dumb
boot.user=> (println (slurp "build.boot"))
(merge-env!
:resource-paths #{"src"}
:dependencies (template
[[org.clojure/clojure ~(clojure-version)]
[ring "1.5.1" :exclusions [org.clojure/clojure]]]))
(task-options!
uber {:as-jars true}
web {:serve 'boot-war-example.core/serve}
war {:file "app.war"})
(deftask build-war []
(comp
(web)
(uber)
(war :file "app.war")
(sift :include [#"app.war"] )
(target)))
nil
boot.user=> (load-file "build.boot")
deftask boot.user/build-war was overridden
#'boot.user/build-war
boot.user=> (build-war)
#object[clojure.core$comp$fn__4495 0x441eb9d3 "clojure.core$comp$fn__4495@441eb9d3"]
boot.user=>
I'm trying to run the build-war task directly from the repl. It does not appear to be working. What am I doing wrong How do I fix it?(boot (build-war))
I believe
Tasks are higher-order functions: they return a function that boot
can execute.
also i added local dev stuff: https://github.com/alandipert/boot-war-example#develop-locally
@seancorfield : got it working, thanks!
rm -rf tmp
mkdir tmp
cp config/* tmp
echo ""
echo "**********************************************"
echo "***** cleaning compiled js; building min *****"
echo "**********************************************"
echo ""
lein cljsbuild once min
echo ""
echo "*****************************************"
echo "***** clearning war; rebuilding war *****"
echo "*****************************************"
echo ""
# (cd tmp; mkdir src; (cd ../src; find . -name \*_s.clj -exec cp {} ../tmp/src); lein ring uberwar; rm -rf src)
(cd tmp; mkdir src; cp -R ../src/g src; mkdir resources; cp ../resources/cdn/index_prod.html resources/index.html; lein ring uberwar; rm -rf src)
echo ""
echo "*********************"
echo "***** uploading *****"
echo "*********************"
echo ""
(cd tmp; mkdir -p target/war;
cd target/war;
jar xf ../v1-0.1.0-SNAPSHOT-standalone.war;
cp ../../appengine-web.xml WEB-INF;
cp ../../web.xml WEB-INF;
mkdir -p static/cdn;
cp ../../../resources/cdn/index_prod.html static/index.html;
cp -R ../../../resources/cdn/hw static/cdn;
cp -R ../../../resources/cdn/prod-js static/cdn;
cp -R ../../../resources/cdn/index_prod.html static/cdn;
appcfg.sh update .)
^^ this is my curent build script (in bash) that uses lein to do "cljs build" and "ring uberwar"
with boot, in practice, I can get rid of the bash dependency, and write all of this entirely in clojure right ?so I can build boot task called pack-stuff-and-deploy-on-gae ... then do (boot (pack-stuff-and-deploy-on-gae)) from my boot repl -- and everything will just work
you could, whether or not its good depends on your team situation, what you want to spend time on, etc
whether it's a good idea to use it in the end, it's a good excuse to learn more boot š
but in general its good i think
it's nice for a build to require just one tool imo
using just one jvm / clojure is even better; I hate the delay in firing up new jvms / clojure
another bonus is, once you're happy with the clj you made to represent your process, you can make that a library and use it in other apps
oh, you mean "deply-to-gae" instead o being a externla bashscript, can now be a BOOT-LIBRARY
yeah, like deploy to acme/standard-deploy 1.0.0
so now that has a bunch of tasks $FUTURE_YOU can reuse
hehe yup
it's great fun
well it will be, as long as programming remains fun
which is always longer than the amount of time configuring is fun
Suppose CLJS depends on library REAGENT; but Clj/Server/GAE side does not depend on REAGENT. Suppose I do not want REAGENT to be in my WAR file. Does this mean I need to use 2 separate build.boot files with their own dependencies sections, or is there some way to do this in one build.boot file? The main thing is that my build-cljs task needs to use one set of dependencies, which includes REAGENT build-war task needs ot use another set of dependencies, which does NOT include REAGENT
@alandipert : ^^ one more help? š
kind of hinges on how critical it is that reagent isn't in your war
if it's critical to separate, the best path is probably to have 2 separate apps, one for frontend, one for backend. i know @jumblerg prefers this
so that you can upload it faster?
yeah, atleast in my experience, the puny 512MB machines that GAE spins up relaly doesn't like having lots of JARS around
and on my client side, I'm about to include datascript, re-frame, specter, http://thi.ng, some sound libraries, and who knows what else
so - one alternative
is to mark your cljs dependencies as :scope "test"
i did that for a few deps in the war example
oh nvm - i thought that would hide them from uber
but it didn't
oh wait, nvm, i was right š
uber has an :exclude-scope
option
i believe you can use this to trim your cljs deps from the war
i.e. dependencies that are in scope "test" are around at cljs compile and build time, but don't get included in the .war
hm, playing around, can't get it to work
StackOverflow mentions the same words as you, but I haven't found a working example yet either.
@alandipert : ah, https://github.com/cpmcdaniel/CanaryClojureLibrary/blob/master/build.boot#L4-L16 looks like it should work
ok so i've done some testing, inconclusive, but seems to work in the cases that matter
if you bring in some dep like [alandipert/hyperturbo "1.0.0" :scope "test"]
assume that's reagent or whatever
it's on the classpath for the duration of the boot run, like for your cljs build
but does not get picked up by uber, and does not go in the .war
according to (doc uber) deps in the "test" scope are not included by default
i don't think you can invent scopes
there's a closed set, defined by maven
we just overload their meanings
we've thought about it
i think we just need to put the shingle out
@qqq that's what gae services are for. break your app into services, maintain and upload independently. also gae uses war dirs, not war jars, so uber is unnecessary.
hello guys
does anyone know how to dynamically require another ns inside a deftask?
something like
(deftask dev-run
[]
(set-env! :source-paths #(conj % "env/dev/src"))
(require '[abc.api-proxy.boot :refer [proxy-serve]])
(comp
(serve :port 1112 :handler āabc-ui.catch/all)
(proxy-serve
ā¦
1. adding additional source paths for dev mode only and 2. require additional stuff (proxy in this case)
doesnt work and throws clojure.lang.ExceptionInfo: Unable to resolve symbol: proxy-serve in this context
any clues?
(require 'abc.api-proxy.boot) ((resolve 'abc.api-proxy.boot/proxy-serve) ...)
i think is the recipe you seek?
oh, no need to use set-env! ?
and what to place after the resolve fn? the comp block?
ah, https://github.com/boot-clj/boot/wiki/Run-time-requires-(within-task-definitions) helps
yup that's the one