Fork me on GitHub
#clojure
<
2019-07-26
>
GC01:07:50

Hey, I want to mock S3 for testing in clojure, what are the best recommended tools for this

GC01:07:05

I have researched but not quite sure what I should use

seancorfield01:07:28

@gagan.chohan It depends what you mean by "mock S3" -- if you have an abstraction for how you interact with S3, you can implement that abstraction as talking to S3 (for production code) and as talking to some in-memory state (for example, for testing).

borkdude06:07:16

@andy.fingerhut SO publishes a dump every so often, so scraping isn’t needed (see link posted earlier)

henrik06:07:25

Wouldn’t SO bring with it tons and tons of duplicates? It might get noisy.

henrik06:07:58

OTOH it might be good for SEO for Ask.

Adrian Smith09:07:45

Seems like QA site is down?

Adrian Smith09:07:57

Maybe we need a PHP -> Clojure rewrite 😛

andy.fingerhut09:07:22

It responded for me just a minute ago.

danielneal09:07:25

might be that you’re trying the http rather than https - that one’s not redirecting yet

Adrian Smith09:07:59

Yeah that was the problem, no idea how I ended up at http

danielneal09:07:49

think there was a link somehwere else on slack to http://ask.clojure.org and it defaulted to http

tianshu17:07:56

Hi, folks. I am considering to rewrite bunch of bash scripts. Currently available options for me are planck, joker and hy, which one will you suggest?

nenadalm08:07:28

I compiled small script using GraalVM's native-image. Didn't like joker because it's not really Clojure and hy for the same reason. Compiled ClojureScript was also slower, so I don't assume planck will be very fast.

mfikes17:07:33

Clojure and Lumo are also options

tianshu18:07:56

😢 so many options

tianshu18:07:16

clojure still have startup time there, eventhough it's must faster nowdays.

petterik18:07:41

I've been using clj.native-image with graal and it's awesome

souenzzo18:07:12

native image can't do simple things like pprint, spec due this issue (please vote 😅 ) https://ask.clojure.org/index.php/740/locking-macro-fails-bytecode-verification-native-runtime

ghadi19:07:44

it's not only this issue

ghadi19:07:12

fixing this issue will unlock new issues waiting behind it 🙂

sogaiu22:07:12

if you don't mind, please elaborate on this "unlocking"

petterik18:07:07

Takes some time to build the native-image though. ~20 seconds for a hello world IIRC

lukasz18:07:15

Is there a guide somewhere explaining what's possible and not when using Clojure and native-image ?

sogaiu00:07:30

i don't know of one, but it sounds like it could be handy. perhaps @U04V15CAJ and/or @taylor could be interviewed to create such a guide? (for the near term, perhaps studying borkdude's clj-kondo and/or jet aren't bad options -- also some of taylor's repositories)

tianshu18:07:51

@petterik That's very heavy thing, I'm looking for a lightweight, script way

petterik18:07:40

@doglooksgood what I do is develop the scripts with my editor and a REPL until it does what I want, then just compile it once such that it starts instantly. Or when I don’t want to have to deal with an editor + repl, I execute it with clj -m file.clj It can be non ideal when the script changes ever so often

tianshu19:07:50

yes, Sometimes I may want a little change to the script located on the test server. It's not quite convenient. but, of course, even joker and planck are not real clojure, may lacking something when using.

👍 4
sogaiu22:07:17

@doglooksgood don't know if closh would work for you, but fwiw: https://github.com/dundalek/closh

andy.fingerhut23:07:27

The Loom project: https://github.com/aysylu/loom uses Leiningen, and supports both Clojure and ClojureScript platforms. It has a dependency in its project.clj file for a ClojureScript-specific library called cljs-priority-map: https://github.com/tailrecursion/cljs-priority-map

andy.fingerhut23:07:55

When I use loom in a Clojure project that does not intend to use ClojureScript, cljs-priority-map shows up as a recursive dependency.

andy.fingerhut23:07:43

This isn't a deal-breaker or anything, but I was curious if there was a well-known different way for a project like Loom to declare its dependencies, such that if you depend upon Loom in a Clojure-only project, no ClojureScript-specific dependencies show up?

andy.fingerhut23:07:15

(and vice versa, if a ClojureScript-only project wanted to avoid Clojure/Java-specific dependencies)

andy.fingerhut23:07:22

hmmm, or perhaps this is something that dep exclusions can do

andy.fingerhut23:07:54

Answering my own question after some quick experiments, declaring :exclusions in my project's Leiningen project.clj file does eliminate that ClojureScript-specific project from the output of my project's lein deps :tree command.

duckie 12
andy.fingerhut23:07:50

I guess my original question I still do not know the answer to, though -- is there a way that somehow a project can specify "here are my Clojure/Java deps" vs. "here are my ClojureScript deps", and somehow those get automatically used?

noisesmith23:07:18

pom.xml supports conditionals / profiles right?

noisesmith23:07:42

and of course nothing stops you from having a separate deploy with a separate pom

noisesmith23:07:43

it would be cool if artifacts could have consistent flags (like "cljs" or even "javascript-vm") that would allow pruning programmatically