Fork me on GitHub
#boot
<
2015-06-15
>
bsima01:06:29

are there any examples of a ClojureScript Nodejs repl with boot?

bcachet06:06:10

@bsima: You can create a task to start a NodeJS REPL this way:

(deftask noderepl []
  (comp
    (cljs.repl/repl (cljs.repl.node/repl-env) :watch "src")))

bcachet06:06:25

I started it using rlwrap to improve navigation in lines:

rlwrap boot noderepl

ragge08:06:38

I'm trying to add dependencies with an :extension other than jar. However, while the dependencies are downloaded properly, they are not made available on the classpath.

ragge08:06:46

Is this intended behaviour?

ragge08:06:58

(set-env!
 :repositories #(conj % ["rubygems-releases" ""])
 :dependencies '[[org.clojure/clojure       "1.7.0-RC1"  :scope "provided"]
                 [boot/core                 "2.1.2"      :scope "provided"]
                 [org.jruby/jruby-complete "1.7.20.1"]
                 [rubygems/ffi "1.9.8-java" :extension "gem"]
                 [rubygems/fpm "1.3.3" :extension "gem"]])

ragge08:06:22

Hmm... Never mind, they are shown in boot show -c

martinklepsch08:06:47

is a Maven compatible Rubygems proxy?

ragge08:06:07

with some quirks

ragge08:06:42

i'm working on a thing to use fpm from boot

ragge08:06:00

currently stuck on trying to get jruby to find the gems

ragge08:06:42

i've been able to require 'fpm' using some manual tweaking of classpath

ragge08:06:52

not been able to make it work like I want yet though

ragge09:06:15

using pod etc

alandipert11:06:06

@ragge: have you run across https://github.com/tobias/boot-jruby? might be helpful

alandipert11:06:10

sorr i didn't think to send it your way earlier. it uses https://github.com/tobias/clj.rb

ragge11:06:29

@alandipert: ooh, cheers, will have a look at that

ragge11:06:49

I can actually eval ruby perfectly fine, my current problem is just getting jruby to find the gems

ragge11:06:05

but clj.rb looks nice

alandipert12:06:28

iirc it has gem capabilities

mitchelkuijpers13:06:54

Hi Guys, I had some issues getting the reloaded pattern from stuartsierra working

Slackbot13:06:54

I think you mean gang...

mitchelkuijpers13:06:10

'(defn reset [] (let [reload-dirs (->> (or (try (require 'boot.core) ((resolve 'boot.core/get-env) :directories) (catch Exception _ nil)) (do (require 'clojure.tools.namespace.dir) ((resolve 'clojure.tools.namespace.dir/dirs-on-classpath)))) (remove #(.exists (io/file % ".no-reload"))))] (apply set-refresh-dirs reload-dirs)) (stop) (refresh :after 'user/go))'

mitchelkuijpers13:06:24

This is te way I got it working but it feels very dirty...

micha13:06:06

mitchelkuijpers: what's dirty about it?

mitchelkuijpers13:06:40

Hmm I used the wrong words I mean that this took me way to long to figure out. I found it in an example repo after an hour. You did have some documentation about it, but it was hard to figure out how to actually use this in your user.clj

mitchelkuijpers13:06:51

But I am pretty noob with boot so that might be the problem

micha13:06:52

it's kind of a component-system specific situation, no?

micha13:06:04

that thing does fancy things

mitchelkuijpers13:06:13

I use trapperkeeper but that does kind of the same thing

micha13:06:58

it's going to be weird using things that mutate a stateful environment like they do i think

mitchelkuijpers13:06:02

basically stop and start a system

micha13:06:03

because boot goes the other way

micha13:06:12

making environments immutable

micha13:06:17

via pods and filesets

mitchelkuijpers13:06:18

Ok what would be a good

mitchelkuijpers13:06:34

Oke so component and boot are not a very good fit?

micha13:06:42

no, i'm not saying that

micha13:06:54

but the interface will involve some evaling and whatnot

micha13:06:15

because boot doesn't necessarily expose just a single mutable environment in which everything runs

micha13:06:25

if that makes any sense

mitchelkuijpers13:06:01

Yeah that might be a much better fit

mitchelkuijpers13:06:14

I want to drop trapperkeeper anyway it's starting to get on my nerves

micha13:06:17

it has a lot of nice features

micha13:06:32

trapperkeeper is built on the component system right?

mitchelkuijpers13:06:28

No they built something themselves with some macro's

mitchelkuijpers13:06:46

But it's the same idea

mitchelkuijpers13:06:56

This is how you reference services

mitchelkuijpers13:06:08

And this is how you define them

mitchelkuijpers13:06:39

And you can use protocols with that services

mitchelkuijpers13:06:52

But i have also used component and I liked that more

danielsz13:06:12

mitchelkuijpers: If you try out system and you have a problem or a question, please do not hesitate to contact me.

mitchelkuijpers13:06:33

Thanx! It is kind of a big job, so I hope I get some time this week

danielsz13:06:42

Sure. there’s a tutorial that may be useful too. https://github.com/danielsz/holygrail

jeluard14:06:34

Looks like there is another boot plugin for component: https://github.com/IB5k/boot-component Not sure how mature it is.

jeluard14:06:34

@danielsz: looks like system boot plugin does not rely on set-refresh-dirs?

danielsz14:06:04

boot-component is for components that you want to orchestrate yourself, boot-system is for ready-made components, as it relies on the system library, one step higher on the abstraction ladder.

robert-stuttaford14:06:59

danielsz: i’ve been following system since you first published it, but we had already gone with trapperkeeper. curious if you had looked at TK before you wrote system and if so what drove you to roll your own?

danielsz14:06:11

boot-system indeed does not rely on set-refresh-dirs, I don’t remember why, maybe because of the immutable set, I just didn’t explore this avenue. If you feel there is an advantage to using it, you are welcome to do a pull request.

danielsz14:06:39

robert-stuttaford: hi Robert!

jeluard14:06:13

@danielsz: not sure about it, I was just wondering if there was some subtle difference

danielsz14:06:53

robert-stuttaford: I’m afraid to say that I haven’t looked at TK, sorry 😞

jeluard14:06:55

@danielsz: can I use my own components (or from other libs) with system?

robert-stuttaford14:06:49

ok, cool simple_smile another batteries-incl. Component framework which uses Prismatic’s Graph to do dependencies, and comes with a config and nrepl services and all the goodies for dev vs prod vs test

danielsz14:06:23

jeluard: sure you can.

danielsz14:06:50

jeluard: you can import your own components and namespaces, and use those when assembling a system. https://github.com/danielsz/system/blob/master/examples/boot/src/example/systems.clj

danielsz14:06:18

robert-stuttaford: very cool.

danielsz14:06:33

robert-stuttaford: there is also the folks from the UK.

danielsz14:06:41

what are they called?

danielsz14:06:01

did you try theirs?

robert-stuttaford14:06:15

yes, but a previous incarnation, aka jig

robert-stuttaford14:06:36

malcolm was in flux with it when we were getting going, and then TK came along

danielsz14:06:10

system came about when I was formalising my workflow with components.

danielsz14:06:26

there is nothing special about it, it’s very simple, it has no batteries.

jeluard14:06:40

Right the relative proximity of system and https://github.com/juxt/modular actually prevented me from using both.. simple_smile

danielsz14:06:18

boot-system is special in that it integrates with boot in a way that surprised me.

danielsz14:06:40

it allows for the the interactive environment of my dream

danielsz14:06:41

jeluard: I talked with malcolmsparks when I released system, we are aware of each other’s libraries

danielsz14:06:33

this repo demonstrates the workflow I’m referring to: https://github.com/danielsz/holygrail

jeluard14:06:09

@danielsz: Have you considered using modular components for system? Looks like it is their strong points while system apparently provides higher level features.

jeluard14:06:34

@danielsz: I've seen holygrail, not tried yet but looks really cool.

robert-stuttaford14:06:25

@danielsz: does system deal with the issue you get with tools.namespace if you reset with code that fails to compile?

robert-stuttaford14:06:40

i have an emacs binding which will invoke user/reset in the repl. i’m pretty close to writing one that recompiles user and resets afterwards, as i break it all the time!

danielsz14:06:02

robert-stuttaford: Ha! I remember that. The good old times. That was solved since then, I think in component.

danielsz14:06:20

reset works for me all the time

robert-stuttaford14:06:20

… i should update my deps

robert-stuttaford14:06:02

i have noticed that i don’t need to reset to use freshly recompiled defmethods now, too. is that new in 1.7?

danielsz14:06:03

but of course you can always have stale state, and I will occasionally reset the JVM, but not often

danielsz14:06:30

jeluard: modular components should be identical to system components. In reality they may diverge due to idiosyncrasies. But you can see that we’re dealing with the same beasts.

danielsz14:06:28

jeluard: Modular comprises :- a set of pre-written components a template system for creating new projects some optional utility libraries

danielsz14:06:34

this is from the README

danielsz14:06:54

system is only a set of pre-written components, + deep Boot integration

danielsz14:06:55

No one has a problem with syncing the components across libraries. We could do that.

jeluard14:06:45

@danielsz: exactly that's why it's difficult for a user to choose between both. I'd rather use both that pick one but because of the overlap it's not obvious. Now I understand I can actually do that.

jeluard14:06:54

@danielsz: or maybe introduce a third project only focused on components simple_smile

danielsz14:06:55

jeluard: yes! also compare the components. For example, http-kit is present in both. https://github.com/danielsz/system/blob/master/src/system/components/http_kit.clj

danielsz14:06:43

slightly divergent

danielsz14:06:22

they use a protocol WebRequestHandler, I don’t know why.

danielsz14:06:11

though I’m sure they have a reason.

danielsz14:06:32

Another comparison: Datomic

danielsz14:06:54

I think there is a trend.

danielsz14:06:09

There is extra functionality in modular.

danielsz14:06:15

system is minimalistic.

jeluard14:06:28

@danielsz: I feel like if there was a single set of 'official' components and both projects building on them it would help with adoption.

danielsz14:06:33

just the bare minimum to start and stop components.

ragge14:06:38

@danielsz: the boot integration in system looks really, nice thanks for sharing it

danielsz14:06:45

ragge: Cool!

ragge14:06:36

I'm of the exact opposite opinion re sharing components, everyone has their own quirks, wants to expose different levels of integration with underlying library. I don't think it's valuable to try and standardise.

ragge14:06:47

Also, components are usually very little code.

danielsz14:06:48

jeluard: I understand. But that is also the beauty of OSS. There’s room for many approaches.

ragge14:06:56

We have our own internal repo with components

ragge14:06:10

Even that has been difficult to use effectively

danielsz14:06:14

ragge: heh, nice!

ragge14:06:48

i think systems boot task is something that would better help adoption

ragge14:06:04

making it painless to get a reloadable system up and running

ragge14:06:12

nice lispy repl workflow

ragge14:06:46

just my opinion simple_smile

jeluard14:06:32

Right the boot task is awesome. Allows to remove all the boilerplate from component.

danielsz14:06:03

ragge: I’ve posted the announcement on the Clojure mailing list, and it seemed like people have noticed. But any other idea would be very welcome. I did a video tutorial and a repo tutorial (holygrail).

danielsz14:06:09

jeluard: thanks!

ragge14:06:37

@danielsz: just watched the video, nice

danielsz15:06:37

ragge: thanks!

ragge15:06:45

@danielsz: in system, the var you pass is required to be a fn of 0 args?

ragge15:06:50

that returns a new system

danielsz15:06:23

ragge: in boot-system?

ragge15:06:29

yes, sorry

danielsz15:06:14

#’dev-system or #’prod-system

danielsz15:06:20

in this case

danielsz15:06:58

defsystem is sugar for (component/system-map xs)

ragge15:06:26

was wondering how I could use that with a system that's parameterised, but I guess I can just do like in the example, have different system vars (with no params)

ragge15:06:16

(defn make-system [config] ...)

(defn prod [] (make-system prod-config))
(defn dev [] (make-system dev-config))

danielsz15:06:18

the system var is the "official” system à la Stuart Sierra https://github.com/stuartsierra/component#systems

danielsz15:06:03

ragge: if you want to paramaterize, use boot-environ

ragge15:06:22

oh, sure, my make-system would return a system-map

danielsz15:06:08

ragge: cool.

danielsz15:06:48

ragge: at the risk of saying something obvious, please note that when I assemble my components, we use an environment map instead of a hard-coded config.

danielsz15:06:23

For example, http port is read at runtime from the environment map .https://github.com/danielsz/system/blob/master/examples/boot/src/example/systems.clj

danielsz15:06:21

and how in build.boot we use this for maximum convenience: https://github.com/danielsz/system/blob/master/examples/boot/build.boot

danielsz15:06:34

(environ :env {:http-port 3000})

ragge15:06:02

@danielsz: yeah, I saw that. personally not a fan of using environment variables in that way for config... I know it goes against the 10 factor thing or whatever... I guess the nice thing is it's not forced upon me, so I can do what I want and people can ignore me simple_smile

danielsz15:06:04

those who have previous experience with the environ library by James Reeves will recognize the pattern.

danielsz15:06:20

Exactly, this is the 12factor pattern.

danielsz15:06:53

ragge: yes, you can absolutely do whatever is best for you;

martinklepsch15:06:45

Should tools.nrepl show up in the list of dependencies that’s printed? Or is that isolated through a pod?

martinklepsch19:06:34

current workflow: lein install; boot -d markdown-clj repl 😄

micha22:06:59

martinklepsch: :ballin: