This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-02
Channels
- # aws-lambda (1)
- # beginners (46)
- # boot (190)
- # cider (12)
- # clara (6)
- # cljs-dev (9)
- # cljsjs (8)
- # clojure (152)
- # clojure-austin (3)
- # clojure-berlin (3)
- # clojure-finland (2)
- # clojure-france (5)
- # clojure-italy (3)
- # clojure-russia (92)
- # clojure-serbia (4)
- # clojure-spec (7)
- # clojure-uk (190)
- # clojurescript (115)
- # cursive (20)
- # datomic (20)
- # dirac (4)
- # emacs (9)
- # gsoc (5)
- # hoplon (1)
- # jobs (1)
- # klipse (4)
- # lein-figwheel (1)
- # leiningen (6)
- # lumo (2)
- # mount (18)
- # off-topic (57)
- # om (68)
- # om-next (14)
- # onyx (33)
- # perun (32)
- # portland-or (4)
- # re-frame (21)
- # reagent (85)
- # ring (6)
- # ring-swagger (23)
- # schema (1)
- # uncomplicate (1)
- # untangled (13)
- # vim (7)
hey folks, how to use boot.core/cp
? how can I get the destination tmp-file?
@richiardiandrea it's really for copying the contents of one tmpfile to another
uhm, I have a java.io.File
and a tmp dir, can I use that to copy a file in there?
like
...
prod-file (io/file tmp (str prod-dir prod-name))
dev-file (io/file tmp (str dev-dir dev-name))
(c/cp fileset prod-file dev-file)
(let [prod-file (io/file tmp prod-dir prod-name)
dev-file (->> fileset input-files (by-ext [".foop"]) first)]
(cp fileset prod-file dev-file))
uhm understand, so it must already exist on the fileset
can I create an "empty" TmpFile and use cp
with it?
or maybe I can sift :move
a file that I don't care about and overwrite it
uhm, ok I found I could use this: https://github.com/boot-clj/boot/blob/ac835cea8c18e926bb843e01579b86e3f30458d2/boot/pod/src/boot/file.clj#L167
I basically have one file in tmp-dir
and i want to copy it to another path in the same tmp-dir
uhm
java.nio.file.NoSuchFileException: /home/arichiardi/.boot/cache/tmp/home/arichiardi/git/packages/intersections/nbe/np8ovp/cljsjs/intersections/development/intersections.inc.js397310969257207322.tmp
file: "/home/arichiardi/.boot/cache/tmp/home/arichiardi/git/packages/intersections/nbe/np8ovp/cljsjs/intersections/development/intersections.inc.js397310969257207322.tmp"
clojure.lang.ExceptionInfo: /home/arichiardi/.boot/cache/tmp/home/arichiardi/git/packages/intersections/nbe/np8ovp/cljsjs/intersections/development/intersections.inc.js397310969257207322.tmp
file: "/tmp/boot.user275995671676653650.clj"
ah ok I was missing a io/make-parents
😄
Are there any people here who have run boot-http
with -`-ssl`?
When I try to load something I get a Illegal character 0x16 error
Hi Guys,
I have been reading the instructions RE setting a clojure version on:
https://github.com/boot-clj/boot/wiki/Setting-Clojure-version
But I'm still not 100% clear on best practice for defining a Clojure dependency in a boot project.
In my ClojureScript project I have a local boot.properties
file that sets:
BOOT_CLOJURE_VERSION=1.9.0-alpha14`.
In my project build.boot
file I have a dependency specified for clojure:
[org.clojure/clojure "1.7.0"]
Ideally I would like to have the version of Clojure dictated by the version specified in boot.properties
.
If I run boot.repl
in my project the version of Clojure is reported as Clojure 1.9.0-alpha14
- which appears to be what I want. Is this the boot version that all my project boot tasks will run against?
If I run boot show -d | grep org.clojure/clojure
I see that the dependency is listed as [org.clojure/clojure "1.7.0"]
, is this pretty much irrelevant providing my app is transpiled via a boot task?
Thankswhy not specify the correct version of clojure in build.boot?
also boot 2.7.1. improves this sort of reporting
@pesterhazy I'm only setting a diff version in build.boot
to test which version takes presedence
@pesterhazy: I see the improved reporting in 2.7.1 which states the following when I run a boot task:
Classpath conflict: org.clojure/clojure version 1.9.0-alpha14 already loaded, NOT loading version 1.7.0
I guess this confirms that the version specified in boot.properties
takes presedence.you're welcome
I'm still unclear if I should be using :scope provided
for my Clojure dependency in build.boot
:
[org.clojure/clojure "1.7.0" :scope "provided"]
This seemingly acts as documentation that we expect the Clojure version to be controlled by the container (boot?). But apart from that it doesn't seem to have any effect. @minikomi I use Dirac from powerlaces/boot-cljs-devtools
Saw this, might apply to those running macos Sierra: http://stackoverflow.com/questions/39636792/jvm-takes-a-long-time-to-resolve-ip-address-for-localhost might make startup much faster
@mf this is one way to specify the clojure version only in the boot.properties
file https://github.com/boot-clj/boot-war-example/blob/master/build.boot#L4
Is it possible to get the output from dosh
as a string? I’ve tried this with no success:
(with-out-str (dosh “pwd”))
@geoffs: I have tried following in build.boot
:
[org.clojure/clojure ~(clojure-version)]
but I get the following exception when I run a boot task:
java.lang.IllegalArgumentException: Bad artifact coordinates org.clojure:clojure:jar:(clojure.core/unquote (clojure-version)), expected format is <groupId>:<artifactId>[:<e
xtension>[:<classifier>]]:<version>
FYI my project is a ClojureScript project, not sure if this is relevant@micha Yeah, my real case is a bit more complex where shell is reasonable, used pwd
here for an easy example 🙂
@alandipert is there a reason that you use template
instead of the syntax-quote?
i didn't want to resolve symbols to vars
@geoffs Thanks for bringing this to my attention, I had previously given up on using (clojure-version)
@geoffs @alandipert Are there circumstances when using template
over syntax-quote will be problematic?
boot.user=> (defmacro foop [x] (template (inc ~x)))
#'boot.user/foop
boot.user=> (foop 100)
101
boot.user=> (let [inc dec] (foop 100))
99
boot.user=> (defmacro foop [x] `(inc ~x))
#'boot.user/foop
boot.user=> (foop 100)
101
boot.user=> (let [inc dec] (foop 100))
101
boot.user=> (defmacro foop [x] `(inc ~x))
#'boot.user/foop
boot.user=> (macroexpand '(foop 100))
(clojure.core/inc 100)
boot.user=> (defmacro foop [x] (template (inc ~x)))
#'boot.user/foop
boot.user=> (macroexpand '(foop 100))
(inc 100)
template
is mostly useful for manipulating data that has symbols in it, but that you won't be evaluating
like {:foop (template (a list of symbols we dont want to evaluate with ~some ~we ~do))}
@micha thanks so much for the detailed answer. So in the use case of using template
in the build.boot
to enable the use of (clojure-version)
, if I follow correctly clojure-version
won't be resolved until after the macro has been expanded.
well in that case you actually have like (template [[org.clojure/clojure ~(clojure-version)] ...
right?
ok yeah so ~(clojure-version)
is evaluating the expression (clojure-version)
during macroexpansion
I thought template was a macro: https://github.com/boot-clj/boot/blob/b89738e9891cc1c18c5996c4d8b23a0df6af5979/boot/core/src/boot/core.clj#L1163
boot.user=> (template [[org.clojure/clojure (clojure-version)]])
[[org.clojure/clojure (clojure-version)]]
boot.user=> (template [[org.clojure/clojure ~(clojure-version)]])
[[org.clojure/clojure "1.8.0"]]
boot.user=> `[[org.clojure/clojure ~(clojure-version)]]
[[org.clojure/clojure "1.8.0"]]
boot.user=> `[[clojure ~(clojure-version)]]
[[boot.user/clojure "1.8.0"]]
the best way to get a handle on this macro business is just to try different things and develop some kind of intuition for how it should behave
@micha yeah [[org.clojure/clojure ~(clojure-version)]]
works in the repl, but boot blows up when I do this in build.boot
.
boot.user=> [[org.clojure/clojure ~(clojure-version)]]
java.lang.ClassNotFoundException: org.clojure
clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: org.clojure, compiling:(/tmp/boot.user7789718177828493815.clj:7:1)
well anyway, syntax quote would do weird stuff like for dependencies without namespaces
syntax-quote kind of assumes that symbols refer to names in namespaces or the environment
Yeah I guess up until now I have put macros on the back-burner, mainly because I feared there use makes it harder for others to grok what's going on in your code (i.e. a bit magical) e.g. when code-reviewing etc.
But then again if everyone understands the problem that the macro is solving then I suppose it's not an issue
my personal principle is that macros only do syntactic transformations, like just rearranging expressions so they can call functions to do the real work
i mean except for macros you use to do computing at compile time for optimization purposes
like anything you do with a macro should be possible to do by calling the functions the macro expands to, just with some more boilerplate typing
boot.user=> (source future)
(defmacro future
"Takes a body of expressions and yields a future object that will
invoke the body in another thread, and will cache the result and
return it on all subsequent calls to deref/@. If the computation has
not yet finished, calls to deref/@ will block, unless the variant of
deref with timeout is used. See also - realized?."
{:added "1.1"}
[& body] `(future-call (^{:once true} fn* [] ~@body)))
I will try and follow your principal of letting the macros call out to functions that do the real work
since the real feature was implemented as a function people don't need to use the macro if they don't want to
and the ~ "unquotes" x
in this case, so that the value of x
is passed in when the macro expands
boot.user=> (defmacro foo
#_=> [x]
#_=> `(fn [y#] (+ ~x y#)))
#'boot.user/foo
boot.user=> (foo 5)
#object[boot.user$eval7797$fn__7798 0x6d1edab9 "boot.user$eval7797$fn__7798@6d1edab9"]
boot.user=> ((foo 5) 6)
11
boot.user=>
@U0AHJUHJN just saw your thread.... So yeah I can pass the expanded version of foo
to a higher-order-function:
((comp (foo 5) inc) 6)
;; => 12
So in this case add
kinda acts like a partially applied function:
(defmacro add
[x]
`(fn [y#] (+ ~x y#)))
((comp (add 1) inc) 1) ;; => 3
((comp (partial + 1) inc) 1) ;; => 3
@U0AHJUHJN really appreciate your input, thanks 🙂
boot.user=> (doc eval)
-------------------------
clojure.core/eval
([form])
Evaluates the form data structure (not text!) and returns the result.
@micha I said I wasn't going to take up all your time 🙂 You've got me eager to play with macros now!
Hi. I am using boot-cljs with boot-reload. Works fine, when changing source files in the app. But I also have a library, which runs with watch pom jar install
. And when I make changes to source files there, the changes do not get hot-loaded into my app. I have to restart my app boot and then I have to reload my page. Is there a trick to also hot-reload dependencies?
@witek have you specified the library as a checkout dependency? https://github.com/boot-clj/boot/issues/154
@geoffs Thank you for this info. Seams the task is deprecated. Now there is the -c option to boot itself. Will try this...
Is there a way to activate the -c
option inside my build.boot
file instead of having to pass it as a parameter on the command line?
anybody have a boot/new tutorial? i would like to create a template for my project, but the docs at https://github.com/boot-clj/boot-new are totally useless.