Fork me on GitHub
#babashka
<
2021-03-11
>
borkdude14:03:15

@mkvlr They should both work.

mkvlr14:03:45

ok, so just a preference between rust & go?

mkvlr14:03:36

@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

borkdude14:03:58

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 😎

mkvlr14:03:36

yeah, I want to do a similar thing

borkdude14:03:39

@mkvlr I would use the pods lib as a deps.edn git dep if possible

mkvlr14:03:03

ah, makes sense

borkdude14:03:17

if you want to do something similar, fwiw, the above is done using bb

mkvlr14:03:32

but it should work in the jvm the same way?

mkvlr14:03:57

not getting anything back from fw/watch

borkdude14:03:09

should work yes, let me try

mkvlr14:03:01

looking for a way to stop the watch again

mkvlr14:03:00

I’m watching a file, not a while dir (in case that makes a difference)

mkvlr14:03:18

still getting nil back with a dir

borkdude14:03:06

@mkvlr

$ 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}

mkvlr14:03:18

@borkdude sorry I wasn’t clear: I am getting notifications, but no return value from fw/watch (like you) to stop the watch again

borkdude14:03:28

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

borkdude14:03:46

but in Rust I now figured it out as well, so might be supported there too one day.

borkdude14:03:24

The go pod's API might still change, so use with caution when upgrading: https://github.com/babashka/pod-babashka-fswatcher/issues/10

borkdude14:03:47

The name of unwatch will probably changed to stop in the future

👍 3
mkvlr14:03:42

and the brew install is optional, right?

mkvlr14:03:55

I mean loading the pod is enough

mkvlr14:03:14

alright, all working with the go version, thank you!

borkdude15:03:49

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

borkdude15:03:26

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)

👍 3
borkdude18:03:14

CircleCI has granted me linux arm64 access, so I guess we'll have raspberry binaries hopefully soon :)

🎉 21
🚀 21
grazfather19:03:44

raspberry pi still runs on 32 bit mode by default 🙂

borkdude19:03:20

yeah, only 64bit will and can be supported for now

grazfather19:03:46

I just happen to freshly be aware of it since I wanted BB for my pi already

pavlosmelissinos19:03:49

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?

borkdude19:03:26

@pavlos is tar.gz better for this platform?

pavlosmelissinos19:03:53

Ah, not sure, let me check

borkdude19:03:11

but if you do have 7z then sure, let's add it to the README

pavlosmelissinos19:03:11

tar is installed as well and it's more ubiquitous, so maybe it's a better choice indeed

borkdude19:03:11

@pavlos Even better, we can make the script detect unzip or 7z and handle it that way ;)

borkdude19:03:58

I think it might be breaking if we switch to targz now

grazfather19:03:20

I actually hit the unzip error

grazfather19:03:40

I was trying to install bb into a docker container and the ubuntu base image doesn’t start with unzip, but does have targz

grazfather19:03:00

might be better to detect tar vs unzip and download the appropriate file AFTER that’s determined?

borkdude19:03:10

ok, let's use tar gz then, for Windows I think zip is more used

🙏 6
borkdude19:03:23

feel free to post an issue and fix the circleci stuff

borkdude19:03:12

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

grazfather19:03:36

I will show a PR with my idea

grazfather19:03:33

oh, you don’t release as tgz 😞

borkdude19:03:50

my proposal is that we can switch to tgz but the script also needs to support installing older versions

grazfather19:03:58

yep, I understand now

grazfather19:03:24

nice trick: tar works on .zip

grazfather19:03:19

[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

3
borkdude19:03:00

but does it work ?

borkdude19:03:08

bb after extraction?

grazfather19:03:38

of course maybe not all versions of tar can do this

borkdude19:03:49

is there a minimum tar version which supports this?

grazfather19:03:55

that part I Don’t know

pavlosmelissinos20:03:59

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)

hkjels22:03:52

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?

hkjels22:03:56

The jar was made from a java project if that matters

borkdude22:03:05

@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.

borkdude22:03:21

Unless we add those classes to the babashka native image

hkjels22:03:19

Ahh, OK. Thanks