This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-29
Channels
- # announcements (7)
- # babashka (105)
- # beginners (67)
- # braveandtrue (11)
- # cider (8)
- # clojure (62)
- # clojure-conj (4)
- # clojure-poland (1)
- # clojure-spec (9)
- # clojure-uk (8)
- # clojurescript (49)
- # core-typed (11)
- # cursive (4)
- # emacs (1)
- # fulcro (1)
- # graalvm (24)
- # hoplon (10)
- # hyperfiddle (1)
- # off-topic (32)
- # re-frame (7)
- # reitit (1)
- # sql (1)
having a test library for babashka might be nice
trying to think about how to include tests in the same script in an unobtrusive way, though
Yes, I’ve already said earlier this week that I want to port clojure.test, but that will take some time
@nate_clojurians Added a test library for babashka: https://github.com/borkdude/spartan.test
oooh, nice!
than you!
@borkdude, maybe you should change your tagline to “we are borkdude, we create awesome tools” because I can’t imagine there is only one of you!
Made the output more like normal clojure.test:
FAIL in project.test/foo-test
expected: (= 2 (project/foo))
actual: (not (= 2 1))
Now I can finally test this giant babashka script... https://github.com/borkdude/deps.clj
should the installer for https://github.com/borkdude/deps.clj install it as deps.exe on macos?
sure looks like it
probably should fix the examples in the readme, then
@nate_clojurians Where do you see a mistake in the README?
it says to use the "deps.clj" script
huh, I'm confused then
deps.clj is just a text file that you can run with either clojure or babashka whereas deps.exe is a binary file
ah, I see
does deps.exe require java?
ah, yep
makes sense
I'm trying to make a babashka-focused project for more clojurish filesystem manipulation (since I keep copy/pasting the same stuff from script to script)
I rather like this project but I don't think babashka supports everything in there https://github.com/Raynes/fs/blob/master/src/me/raynes/fs.clj
and I was going to test that out now
thanks
it definitely makes sense 🙂
there are some things I don't like about that library, though
and handling zips isn't really something I commonly need
and it generally returns File objects instead of path as strings
but maybe that's a better choice?
I kind of want to always be dealing with one thing
and sometimes this returns strings and sometimes it returns files
I think I'll avoid the lisp curse and just get this working 🙂
first one:
Unable to resolve classname: .FilenameFilter
it uses it for globbing when filtering lists of files
cool, can you make an issue for it? (adding more to it as you discover more, is fine)
will do
Total results: 665, showing 1 - 24
maybe I should focus on using something like the clj-commons fs
oh, that's the same thing. ha!
File system utilities for Clojure. (forked from Raynes/fs)
ooooh
bonus feature of the testing lib:
WARNING: no assertions were made in test borkdude.deps-test/describe-test
nice!
I just found an issue
(require '[ :as io])
(defmacro ^:private predicate [s path]
`(if ~path
(. ~path ~s)
false))
(defn absolute?
"Return true if `path` is absolute."
[path]
(predicate isAbsolute (io/file path)))
(prn (absolute? "README.md"))
$ clj
false
$ bb
Don't know how to create ISeq from: clojure.lang.Symbol [at /Users/nsutton/Code/fs/test.bb, line 11, column 3]
some kind of macro issue, it seems
or maybe not
yep, I did
it works
@nate_clojurians This works:
(require '[ :as io])
(defmacro ^:private predicate [s path]
`(if ~path
(~(symbol (str "." s)) ~path)
false))
(defn absolute?
"Return true if `path` is absolute."
[path]
(predicate isAbsolute (io/file path)))
(prn (absolute? "README.md"))
okie doke
thanks
Kind of meta: deps.clj / deps.exe now uses itself in the tests to build the classpath with a testing library on it and then invokes clojure or babashka to run them
gah, the fs stuff relies on some apache stuff for zip so uhhh
I think I'll need to make my own fs lib
no, that's the thing
it has facilities for it but it feels orthogonal to the lib
or at least complementary but separate
there are some zip-related classes in bb: https://github.com/borkdude/babashka/blob/0a35971acac25e84cfb2a6fbbd8e8193345b76b2/src/babashka/impl/classes.clj#L78
this was added for clj-http-lite, because it needs to handle gzip compression I think
this is the bit that makes me want to nope out of this: https://github.com/clj-commons/fs/blob/master/src/me/raynes/fs/compression.clj#L6-L9
this bit is tricky, too
maybe a bug
it fails to run the script because it can't resolve those classes
but in clojure those seem to be resolved at runtime
or at least that code implies it
it seems like bb is checking that before it actually executes
and IllegalArgumentException isn't resolvable on its own like in clojure
you need java.lang in front of it
yeah, same
it's all a little nope
reify is missing
feel free to post more issues just in case I forgot. reify I'm not sure if I can make that work, haven't thought about it
this is the list I have so far
Add:
* .FilenameFilter
* java.nio.file.LinkOption
* java.nio.file.CopyOption
* java.nio.file.attribute.FileAttribute
* java.lang.IllegalArgumentException (needs fully qualified name in babashka whereas in clj you can just use IllegalArgumentException)
* reify
* clojure.java.shell/with-sh-dir
filed issues 200 and 199