This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-26
Channels
- # arachne (4)
- # beginners (70)
- # bigdata (1)
- # boot (373)
- # braid-chat (3)
- # cider (4)
- # cljs-dev (10)
- # cljsjs (6)
- # cljsrn (27)
- # clojars (11)
- # clojure (114)
- # clojure-austria (1)
- # clojure-czech (2)
- # clojure-dusseldorf (2)
- # clojure-greece (7)
- # clojure-italy (2)
- # clojure-nl (6)
- # clojure-russia (15)
- # clojure-serbia (11)
- # clojure-spec (92)
- # clojure-uk (5)
- # clojurescript (183)
- # component (9)
- # cursive (28)
- # datomic (36)
- # editors (4)
- # emacs (1)
- # garden (11)
- # hoplon (155)
- # lein-figwheel (7)
- # mount (47)
- # om (97)
- # onyx (25)
- # proton (3)
- # rdf (3)
- # re-frame (80)
- # reagent (9)
- # ring-swagger (9)
- # spacemacs (1)
- # untangled (145)
- # vim (2)
Sorry @micha - just saw your message. Thanks for your response but I already figured out what caused the issue: https://clojurians.slack.com/archives/boot/p1474805564003599
Is there a way of writing this in one statement?
(set-env! :dependencies #(conj % '[jsofra/data-scope "0.1.0"
:exclusions [clj-time
slingshot]]))
(set-env! :dependencies #(conj % '[clj-time "0.12.0"]))
(set-env! :dependencies #(conj % '[slingshot"0.12.2"]))
(set-env! :dependencies '[[jsofra/data-scope "0.1.0"
:exclusions [clj-time
slingshot]]
[clj-time "0.12.0"]
[slingshot "0.12.2"]])
@borkdude if you pass a function it's updating, if not (i.e. just a dependency vector) it's replacing
I want to restrict a set of values for an option. Is it achievable using boot task options DSL?
@manenko: I don't think so, you need to add an explicit assert
@borkdude it's not really possible to remove a jar from the classpath once it's been loaded
however, the :dependencies
vector is replaced when you do (set-env! :dependencies '[[foop "123"]])
I have a boot project, and I want to deploy it with jenkins. Should I find a plugin for jenkins or convert my project to a maven project?
I think this is better. I actually think I might be able to do some evil neat things with it
@doglooksgood never use plugins in jenkins
just use the shell build step and run boot dist
or whatever from there
don't get me wrong, I like jenkins, but there's absolutely zero reason to use jenkins plugins for anything unless it adds some sort of UI element
your goal should be to replicate what you do manually when you cut a release from your laptop, almost exactly
anyway, that's my opinion đ
How do I call a task from the REPL. E.g. (deftask foo [d dude bool âdude or notâ] (println d))
Iâm sorry. Itâs all documented! https://github.com/boot-clj/boot/wiki/Task-Options-DSL
@pesterhazy In this case, I have to install boot on all server. Is it possible to avoid this? I mean I may develop with boot, but dist with maven?
Installing boot on the server is a matter of installing a single shell script
You can even include it in your repo
having some difficulties with running boot after switching to latest cljs / clj releases
@dimovich namen/core.cljs is most probably missing some end parenthesis
@urbanslug which version of boot?
@juhoteperi yeah, you were right đ
boot.properties
BOOT_CLOJURE_VERSION=1.8.0
BOOT_VERSION=2.6.0
BOOT_EMIT_TARGET=no
build.boot
(set-env! :source-paths #{"src"}
:dependencies '[[adzerk/boot-cljs "1.7.170-3"]]
:resource-paths #{"html"}
:target-path "target")
;; makes the cljs task visible to the boot.
(require '[adzerk.boot-cljs :refer [cljs]])
@urbanslug the :target-path
key was removed in 2.6.0, there is a target
task instead
This is out of date https://github.com/boot-clj/boot/wiki/Target-Directory
the reason for this is because it's actually quite rare to write files to a target dir nowadays
@urbanslug (comp (foo) (bar) (target))
Pretty much only usecase for target task is when you need to get the Jar file for deployment etc.
well usually you will want to run tests or a local dev server or something when you're developing your application, and neither of those need files in a target dir (they use the classpath)
@micha Thanks for teaching me that. I want to ask so many questions rn but Iâll read the tutorial.
the purpose of it is to provide a level of abstraction above the resources your program needs
like the foo/core.clj
file could be in a jar file, it could be a file in a directory on your machine, or it even could be a http URL somewhere on the internet
so if you have a program that needs foo/core.clj
it doesn't need to know or care where it comes from or how it got there
it's called "classpath" because the JVM load classes from class files (the JVM compiled bytecode)
so if you have a class foo.Bar
, there will be a file on the classpath with the path foo/Bar.class
So the classpath is really just a single dir with all the modules/namespaces I require
it could be in a jar file, it could be somewhere on the internet, or it could be in a local file in the filesystem
the require
function looks at the foo.core
symbol and derives a path that is established by convention
the contents of those two directories will be "overlayed" and the files in there will be accessible on the classpath
ha! so the classpath is really just a set of paths to either source files or jar files
so like foo/core.clj
might map to the url file:/home/micha/.m2/repository/foobar/foobar-1.2.3.jar!foo/core.clj
When I download a dep itâs modules/namespaces will be added to the classpath for that project.
instead of being in a checkmate catch-22 situation you can isolate the two versions in different pods
the basic idea you probably need to know is that the classloader is where the resources your program needs will be
and the files will be found by the classloader in the classpath because I added them in the resource paths
if you're going to deploy to an uberjar you'll need to have your ring stack handle this for you though
I read the ring docs/wiki a while ago (a few months) so.. will have to get familiar with it.
Ok simple enough but too simple for what I want to learn. I want to have a html file that requires js that actually uses om next to render graphs using c3. and well ring for the controller
I hope to learn along the way how to get the repl working and stuff like uh whatever figwheel does
(ns app.serve)
(defn handler [req]
{:status 200
:headers {"content-type" "test/html"}
:body "i am alive"})
you can now make a build.boot file that incorporates the various command line args we use above:
Let me check the request because I downloaded a text file saying I am alive. Basically fetched.
your handler
function, it returns a map with the :headers {"content-type" "text/html"}
info?
so once that's going smoothly you can try making a build.boot file to incorporate the pattern you like
(set-env!
:resource-paths #{"src"}
:dependencies '[[pandeiro/boot-http "0.7.3"]])
(require '[pandeiro/boot-http :refer [serve]])
(deftask dev []
(comp (serve :handler 'app.serve/handler) (wait)))
Itâs weird that in boot files we require after set-env! I assume set-env is like a ns declaration
and read
takes a resolved resource URL, reads the file, and returns clojure data s-expressions
and if you're in the repl you can get help about how to use the task in clojure (like in your build.boot file)
@micha This should respond to boot serve -h
shouldnât it?
(set-env! :source-paths #{"src"}
:dependencies '[[adzerk/boot-cljs "1.7.170-3"]
[pandeiro/boot-http "0.7.3"]]
:resource-paths #{"html"})
(require '[[adzerk.boot-cljs :refer [cljs]] ; makes the cljs task visible to boot.
[pandeiro/boot-http :refer [serve]]])
Thanks đ you just made it really easy for me to get me to thinking about this immediate feedback thing and getting a cljs repl to work.
hey guys, if I just wanted to include a lib into my (clojurescript) output, and that lib has no external api, it just has a dependency on window.OtherLib
, where would I start?
Iâm thinking about using the cljsjs-packaging download
, but iâm not sure how to annotate the dependency on another lib. I suppose I could use deps-cljs and the :requires [âotherLibâ]
, which would probably do it?
i suppose my question is... normally if I were to make a separate cljsjs package out of this component, i would sift the files into the set, then pom + jar everything into a package. but in this case where its âinternalâ, whatâs the appropriate steps to get this lib into the fileset (as opposed to pom + jar) so that I can (:require [somelib.foo])
?
@lwhorton You could just add the JS files to your source dirs?
after downloading the file, then (sift :mode #{âfoo.jsâ} âsomewhere/in/source/foo.jsâ)
, will that make it available via a (:require [foo.js])
? Iâm not sure how the edn file is created me thinks đ
Hello everyone. I want to get full path to a file in a fileset so that I can read the file. Is the following correct way of doing this?
(defn ^:private input-file-by-name
[name fileset]
(let [f (first (boot/by-name [name] (boot/input-files fileset)))]
(io/file (:dir f) (:path f))))
@manenko the idea behind boot is that the âfull pathâ is never really known, itâs always some temporary object wrapper. you use (tmp-file f) or (tmp-path) to get a handle to the actual file object/path.
every operation interacting with a âboot fileâ (not a normal io/file) should do so through the boot file api, which provides an abstract interface
a very common patter I find myself writing is something like this:
(doseq [in files]
(let [in-file (c/tmp-file in)
in-path (c/tmp-path in)
out-path (.replaceAll in-path "\\.styl$" ".css")
out-file (io/file tmp out-path)]
I have a zip file I downloaded in the âprevious taskâ and I want to extract it. Are you saying I should use (tmp-file zip-filename-generated-by-other-task)
to read the file content?
the download task does come with an :unzip
, but iâm not sure where it dumps them (not sure if theyâre added to the fileset or not): https://github.com/cljsjs/boot-cljsjs/blob/master/src/cljsjs/boot_cljsjs/packaging.clj#L37
Yeah, Iâve seen that. The problem is that their unzip
doesnât preserve posix file permissions đ
hmm.. bummer. regardless, if you have your own task that adds them to the fileset, you would then do some fileset query to find the files youâre looking for
that would give you the boot files, and then use the file api to get the real files, but im not sure if that would preserve the metadata either.
np, it took me a long time to wrap my head around, and I still donât get 100% of it, but it sure beats the alternative imo.
@manenko there are also convenience functions: boot.core/tmp-file
and boot.core/tmp-path
It seems boot doesnât preserve files attributes (posix permissions, for example) when it copies them to target folder đ
@seancorfield In boot-new is it possible to get the version numbers auto filled in with the latest version instead of RELEASE?
Not at present â create an issue on GH with details of what functionality youâd like and Iâll take a look.
(my thinking was youâd just update the build.boot
file in the generated project)
The reason the templates use "RELEASE"
is so whatever project you generate will not be tied to whatever old version (of Clojure etc) happened to be current when I wrote the templates đ
Just thinking it'd be more convenient for it to be done automatically when boot-new generates the project
So youâd want the default version to match whatever version of Clojure was used to run boot-new
in the first place?
'k ⌠create an issue on GH for boot-new
and Iâll think about the best way to handle that (since I prefer the "RELEASE"
behavior by default đ )
But, more generally, I would want it to fetch the latest version of any library and replace the version number
Thatâs what "RELEASE"
does.
But boot-new
isnât going to go looking for libraries and trying to determine their version â itâs just processing text files.
So even if boot-new
defaults to writing the same Clojure version into the generated file as boot-new
itself was run with, it has no idea about any of the other libraries in a generated text file.
I was thinking you would need to write your deps in such a way that it would know to fetch the latest version and replace that string
Nope.
Boot new is just a text processor.
The templates are just text. They can have any text in them.
Yes, and there are lots of templates out there.
The built-in ones are "trivial" and only likely to be used for toy projects.
@kenny you can do it with boot-new if you want, like this: https://github.com/tailrecursion/hoplon-template/blob/master/src/leiningen/new/hoplon.clj#L5-L27
Right, an individual template can choose what versions to produce.
Note: Hoplon has a dependency on ancient-clj which Iâm not dragging into boot-new just for this đ
but yeah i agree with @seancorfield it's really easy to do it in your template
Just would be cool to have in there by default. For example:
(set-env! :resource-paths #{"src"}
:source-paths #{"test"}
:dependencies '[["{{dep}}org.clojure/clojure{{/dep}}"]])
It would replace {{dep}}{{/dep}}
with the symbol and its latest versionI donât think itâs worth doing for the built-in templates since theyâre so minimal (except perhaps for picking a specific Clojure version â and adzerk/boot-test is the only other dependency in the built-in templates and thatâs only for testing anyway so you probably do want to make sure you get the latest version).
(actually thereâs boot/core and seancorfield/boot-new in the task and template templates respectively⌠but I still donât think those are worth changing since the templates are so minimal and youâre going to be adding all sorts of your own dependencies anyway)
Defaulting the Clojure version in the generated templates is a bit of a moot point thoâ since the version that Boot starts will override it regardless â unless youâre generating an uberjar
If you feel strongly that itâs worth doing, feel free to put together a Pull Request (that doesnât drag in any external dependencies â since @micha says Boot already includes the functionality youâd need).
And remember, this is purely for the built-in templates â what any other template chooses to do is up to them.