This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-01
Channels
- # aleph (71)
- # aws (1)
- # bangalore-clj (4)
- # beginners (36)
- # boot (153)
- # cider (23)
- # clara (9)
- # cljs-dev (67)
- # cljsjs (2)
- # cljsrn (22)
- # clojure (348)
- # clojure-argentina (4)
- # clojure-austin (12)
- # clojure-berlin (9)
- # clojure-dusseldorf (6)
- # clojure-france (4)
- # clojure-italy (4)
- # clojure-russia (358)
- # clojure-spain (2)
- # clojure-spec (28)
- # clojure-uk (109)
- # clojurescript (130)
- # core-typed (1)
- # cursive (35)
- # datascript (6)
- # datomic (18)
- # emacs (12)
- # hoplon (4)
- # klipse (64)
- # lein-figwheel (13)
- # leiningen (3)
- # luminus (4)
- # lumo (51)
- # mount (22)
- # off-topic (83)
- # om (22)
- # om-next (8)
- # onyx (3)
- # pedestal (8)
- # perun (6)
- # portland-or (2)
- # re-frame (50)
- # ring (8)
- # ring-swagger (5)
- # untangled (10)
- # yada (9)
I don't think it does minification though
I haven't tried them
I think there was a question above from its author about it, so probably it is ok 😄
@arohner I have also just found out this: https://github.com/cljsjs/boot-cljsjs/blob/master/src/cljsjs/boot_cljsjs/packaging.clj#L134
also my library is boot-asset-fingerprint, not boot-fingerprint, which is unmaintained
hello guys - stuck here adding a new boot task dsl option. always throws "java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.String"
here the simplified code
(deftask dev
"Simple alias to run application in development mode"
[o optimizations LEVEL kw "The optimization level. May be :none, :simple or
:advanced. Note :none breaks source maps during
debugging."
p proxy-port int "Port number for proxy server which delegates API calls to backend."]
(comp (boot.util/info (str "proxy port what?" proxy-port))
(development :optimizations optimizations)
(run :proxy-port proxy-port)))
any ideas why it cannot print the proxy port when i run i.E. with boot dev -p 3452
but throws the above error?
Basically you are composing tasks with a info
call which does not return tasks @michael.heuberger
So you should do that outside the comp if you want it to be one-off
@richiardiandrea tried that before too, prints same error
Ah yes, so info accepts a format string and params similar to printf
So you actually need to fix two errors above
(deftask dev
[p proxy-port PROXY-PORT int "Port number for proxy server which delegates API calls to backend."]
(boot.util/info (str "proxy port what?" proxy-port)))
clojure.lang.ExceptionInfo: clojure.lang.PersistentVector cannot be cast to java.lang.String
Yes @michael.heuberger see above for the format of params in info
(deftask dev
[p proxy-port PROXY-PORT int "Port number for proxy server which delegates API calls to backend."]
(boot.util/info “blahblah”))
throws same error ??
Woah OK I finished my suggestions
yep, very weird - what can this be?
using v2.6 here
even weirder, with this code without OPTARGS
(deftask dev
[p proxy-port int "Port number for proxy server which delegates API calls to backend."]
(boot.util/info (str "proxy port what? " proxy-port "\n")))
you get this
~/c ❯❯❯ boot dev -p 343423
proxy port what? 1
clojure.lang.ExceptionInfo: No such task (343423)
data: {:file
"/var/folders/m7/r54_bcwj2ms2w5rpgdmvr6hh0000gn/T/boot.user244238939908557460.clj",
:line 143}
java.lang.IllegalArgumentException: No such task (343423)
boot.core/construct-tasks core.clj: 905
...
clojure.core/apply/invokeStatic core.clj: 646
clojure.core/apply core.clj: 641
boot.core/boot/fn core.clj: 949
clojure.core/binding-conveyor-fn/fn core.clj: 1938
…
Your task needs to return a function.
(deftask dev
[p proxy-port int "Port number for proxy server which delegates API calls to backend."]
(boot.util/info (str "proxy port what? " proxy-port “\n”))
identity)
oh man, thanks
Otherwise, the result of calling boot.util/info
will be treated as the task function to run...
nope, still does not work
(deftask dev
[p proxy-port int "Port number for proxy server which delegates API calls to backend."]
(boot.util/info (str "proxy port what? " proxy-port "\n"))
identity)
~/c/something ❯❯❯ boot dev -p 343423
proxy port what? 1
clojure.lang.ExceptionInfo: No such task (343423)
data: {:file
"/var/folders/m7/r54_bcwj2ms2w5rpgdmvr6hh0000gn/T/boot.user893364953168518953.clj",
:line 143}
java.lang.IllegalArgumentException: No such task (343423)
boot.core/construct-tasks core.clj: 905
...
clojure.core/apply/invokeStatic core.clj: 646
clojure.core/apply core.clj: 641
boot.core/boot/fn core.clj: 949
clojure.core/binding-conveyor-fn/fn core.clj: 1938
…
You’re still missing the placeholder variable from the argument definition...
(! 877)-> boot dev -p 343423
deftask boot.user/dev was overridden
proxy port what? 343423
Tue Jan 31 19:45:38
(sean)-(jobs:0)-(~/clojure/heuberger)
(! 878)-> tail -5 build.boot
(deftask dev
[p proxy-port PORT int "Port number for proxy server which delegates API calls to backend."]
(boot.util/info (str "proxy port what? " proxy-port "\n"))
identity)
Without the placeholder, you’re defining a counter-style flag so -p
sets it to 1, -ppp
sets it to 3.
(I’d missed that error first time around b/c the code you posted 30 mins ago did have PROXY-PORT
in it and then the code you posted afterward had removed it…)
Ah true ^ didn't notice that either
oh man, thanks guys
i think it behaves differently when there is a dash in the placeholder
PROXY
works but PROXY-PORT
is funny
Good to know... I don't think I've ever tried it with -
in it...
boot.util
logging functions probably shouldn't use format
Currently message with %
and no arguments throws exception
This is very problematic in print-ex
which tries to use fail
to display exception message if stacktrace is to be omited
Well they work like logf in clojure.tools.logging
In this case the exception kills whole Boot processes
You can just log ℅s
Except logging functions don't catastrophically fail if there are no arguments
And I'm not logging, but throwing exceptions
Whatever is calling dbug, warn etc should be using %s
I think?
hmm, ah the problem isn't about missing parameters, but the message contains "error at: 20%)" or something
print-ex should probably escape any %
I disabled the bootclj org webhook on github
@lxsameer: in the template dir you can run 'boot watch install' to continuously install to local maven cache. then in different directory run boot new
from repl maybe like (boot (new ....)) so you don't have to start up boot every time
I have A lib in the dependencies list of lib Z, when I use Z in my project I can't require A in my build.boot. is that normal ?
@micha I really can't understand the scopes. I read the maven docs, can you help me with them please ?
because when you're not using mvn
to build your project there is really only one aspect of scopes that is relevant to you
ok so if you had specified scope test
for the A dependency in the pom.xml for Z, that would tell maven to ignore A when you don't explicitly add it to your dependencies
@micha i have two other questions that I know that are silly but I never used JVM before
you don't want consumers of your library to pull that in transitively because they won't need it
@micha do you know any good article to learn more about compilation and stuff related to jars ?
i don't really know of anything offhand, if you find a good resource could you add it to the boot wiki?
Hello 😄 I had this problem with boot-cljs
, I was wondering if a patch for this is something you folks are open to:
https://github.com/cljsjs/boot-cljsjs/issues/44
(of course after polishing a bit)
@richiardiandrea If marking is not supported, I think it means that the archive contains single file
So instead of checking file extension, proper check would be to check .markSupported
and change decompress-file
logic based on that
I read this: > For the bzip2, gzip and xz formats a single compressed file may actually consist of several streams that will be concatenated by the command line utilities when decompressing them. Starting with Commons Compress 1.4 the *CompressorInputStreams for these formats support concatenating streams as well, but they won't do so by default. You must use the two-arg constructor and explicitly enable the support.
and I thought the single file was support by default
But yeah, PR is welcome, but don't try to use file extension to select the logic
you know the thing is that I am trying to make it more generic, but always failing
of course the extension trick is ugly
unless you can find something on commons-compress for this, .markSupported
should be good check
it looks like CompressorStreamFactory
always creates a stream where mark is not supported
yep and what to do if no .markSupported
?
the problem is the ArchiveStreamFactory
wants mark
similar to what you did in snippet you pasted on github
ArchiveStream is about splitting the multiple files from archive
if there is only single file, it is unncessary
Ok, but then if we will have another archive type that does not support marking, we are back at that again
(not sure if there exists another one, just speculating)
ok I will try one thing, I think I got what you mean
@juhoteperi worked, thanks for the hint, I will PR shortly
@richiardiandrea For cleanest patch, I recommend adding .markSupported
check to unpackage-stream
and .decompress-file
, then the with-open binding doesn't need to be touched at all
yeah but I have to do it earlier in order to avoid the exception, like so:
(defn decompress-file [in out-dir & [{:keys [compression-format archive-format]}]]
(with-open [is (-> (io/input-stream in)
(try-decompress-stream {:format compression-format}))]
(if (.markSupported is)
(with-open [is (unpackage-stream is {:format archive-format})]
(let [count (loop [i 0
entry (.getNextEntry is)]
(if entry
(if-not (.isDirectory entry)
(let [target (io/file out-dir (.getName entry))]
(io/make-parents target)
;; After .getNextEntry the stream points to the specific archive entry
(io/copy is target)
(recur (inc i) (.getNextEntry is)))
(recur i (.getNextEntry is)))
i))]
(util/info (format "Extracted %d files\n" count))))
(let [target (io/file out-dir (.getName (io/file in)))]
(println target)
(io/make-parents target)
(io/copy is target)))))
no need
(defn unpackage-stream [is & [{:keys [format]}]]
(if (.markSupported is)
(cond-> (ArchiveStreamFactory.)
format (.createArchiveInputStream format is)
(not format) (.createArchiveInputStream is))
is))
@juhoteperi no, wrong 😄 because the new stream then does not support .getEntry
calls
so I need the io/copy
if mark is not supported
Yes, so check markSupported again in decompress-file
ah ok you prefer two checks, ok then
I think it keeps the decompress-file
simplest when there is only single with-open
fair point
(string/replace (.getName (io/file in)) #"\.[^.]*$" "")
can be used to remove last file extension from name
.md.gz
-> .md
I think most compression formats follow this
.md.bz2
, .md.lzma
etc.
I found FileNameUtil
just checking everything is ok 😉
so weird that I have to specify the extensions myself lol