Any preferences between the two competing babashka file watchers? https://github.com/babashka/pod-babashka-fswatcher or https://github.com/babashka/pod-babashka-filewatcher?
@mkvlr They should both work.
ok, so just a preference between rust & go?
(rust)
yeah
@borkdude cool, thanks. Now I’m stuck trying to figure out what the latest https://github.com/babashka/pods version is. I want to use it from the JVM
I'm using the Rust one in the babashka book for watching changes: https://github.com/babashka/book/blob/master/script/watch.clj Together with etaoin to show the changes in a browser 😎
yeah, I want to do a similar thing
@mkvlr I would use the pods lib as a deps.edn git dep if possible
ah, makes sense
if you want to do something similar, fwiw, the above is done using bb
but it should work in the jvm the same way?
not getting anything back from fw/watch
should work yes, let me try
looking for a way to stop the watch again
I’m watching a file, not a while dir (in case that makes a difference)
still getting nil
back with a dir
$ clj
Clojure 1.10.1
user=> (require '[babashka.pods :as pods])
nil
user=> (pods/load-pod 'org.babashka/filewatcher "0.0.1")
#:pod{:id "pod.babashka.filewatcher"}
user=> (require '[pod.babashka.filewatcher :as fw])
nil
user=> (fw/watch "/tmp" prn)
nil
user=> (spit "/tmp/foo.txt" "hello")
nil
user=> {:path "/private/tmp/foo.txt", :type :create}
@borkdude sorry I wasn’t clear: I am getting notifications, but no return value from fw/watch
(like you) to stop the watch again
I guess that only works in the go version? https://github.com/babashka/pod-babashka-fswatcher#usage
ah yes, that's true. this was an issue with the Rust version: I couldn't figure out how to keep a global list of watchers, etc. This is supported in the go one
but in Rust I now figured it out as well, so might be supported there too one day.
The go pod's API might still change, so use with caution when upgrading: https://github.com/babashka/pod-babashka-fswatcher/issues/10
The name of unwatch will probably changed to stop in the future
and the brew install is optional, right?
yeah
I mean loading the pod is enough
correct
alright, all working with the go version, thank you!
btw, there is also pods/unload-pod
which will accept the return value from load-pod
, to tear down the pod itself. this might have worked with the Rust one as well
you will need to call load-pod again and also reload the namespaces associated with it, if you want to use it again (I think)
CircleCI has granted me linux arm64 access, so I guess we'll have raspberry binaries hopefully soon :)
raspberry pi still runs on 32 bit mode by default 🙂
yeah, only 64bit will and can be supported for now
I just happen to freshly be aware of it since I wanted BB for my pi already
FYI, I just tried to install babashka on a Synology NAS but the official install script doesn't work... DSM, Synology's OS, doesn't have a proper package manager and so unfortunately unzip can't be installed without going through hoops.
For some peculiar reason it does have 7z though, so changing https://github.com/babashka/babashka/blob/39284ae707451d59bf7eedc46bbd42a948511d14/install#L75 to 7z x "babashka-$version-$platform-amd64.zip"
seems to fix the problem.
I understand I'm in a niche minority but is there a chance this could somehow be added to the README?
@pavlos is tar.gz better for this platform?
Ah, not sure, let me check
but if you do have 7z then sure, let's add it to the README
tar is installed as well and it's more ubiquitous, so maybe it's a better choice indeed
@pavlos Even better, we can make the script detect unzip or 7z and handle it that way ;)
I think it might be breaking if we switch to targz now
I actually hit the unzip error
I was trying to install bb into a docker container and the ubuntu base image doesn’t start with unzip, but does have targz
might be better to detect tar vs unzip and download the appropriate file AFTER that’s determined?
ok, let's use tar gz then, for Windows I think zip is more used
certainly
feel free to post an issue and fix the circleci stuff
and also change the installer script (for next release). I think it would be best if the bash script does unzip or tar gz based on the extension, so it can still install older versions
I will show a PR with my idea
oh, you don’t release as tgz 😞
my proposal is that we can switch to tgz but the script also needs to support installing older versions
yep, I understand now
nice trick: tar
works on .zip
huh...?
[g ~/xx] $ tar xvf babashka-0.2.13-macos-amd64.zip
x bb
[g ~/xx] $ file *.zip
babashka-0.2.13-macos-amd64.zip: Zip archive data, at least v2.0 to extract
but does it work ?
bb after extraction?
of course
of course maybe not all versions of tar can do this
is there a minimum tar version which supports this?
that part I Don’t know
doesn't work on DSM (tar v1.28):
$ tar xvf babashka-0.2.13-linux-amd64.zip
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
nor fedora 33 (tar v1.32, same error as above)I’m trying to import a package from a jar that I have locally. I used add-classpath
to add the jar to class-path, but on import I get Unable to resolve classname
. I have verified that the classes I’m importing are in the jar and I’ve printed get-classpath
and verified that the jar is there. What can I be missing?
The jar was made from a java project if that matters
@hkjels Babashka isn't able to load arbitrary Java classes. It can only execute (a subset of) Clojure source code and classes that are already in the native-image.
Unless we add those classes to the babashka native image
Ahh, OK. Thanks