Fork me on GitHub
#clojure-uk
<
2018-04-28
>
otfrom08:04:25

I love how sci-fi that sounds. ๐Ÿ™‚

๐Ÿ’ฏ 8
yogidevbear08:04:02

Morning ๐Ÿ˜„

dominicm08:04:39

https://blog.burntsushi.net/transducers/ my article of the day

โค๏ธ 4
dominicm08:04:56

I'm alone today, so I have total quiet in the house to read it.

dominicm09:04:35

That looks useful, I'm going to try pick that up this afternoon I think

cddr14:04:05

Hey @dominicm, Iโ€™m playing around with mach and pack.alphaโ€ฆ How would you ensure that novelty in any file under src or deps.edn would trigger a rebuild

cddr14:04:05

Ah, the source in modified-since can be a collection. Think that solves my problem

๐Ÿ‘ 4
jonpither14:04:18

mach is due a port to clj, to move away from cljs..

cddr14:04:06

Someone wrote a nice blog about using clj to build from scratch. Iโ€™m making corresponding mach recipes https://oli.me.uk/2018-02-26-clojure-projects-from-scratch/

๐Ÿ‘ 8
cddr14:04:45

Does anyone use mach to build docker images?

cddr14:04:42

How do you determine when they need rebuilding?

dominicm15:04:38

@cddr I have a snippet for that

dominicm15:04:06

{image {novelty (first (for [images (clojure.string/split
                                          (let [child_process (js/require "child_process")]
                                               (str (.-stdout
                                                          (.spawnSync child_process
                                                                      "docker"
                                                                      (clj->js ["images" "--format" "{{.Repository}}\t{{.ID}}\t{{.CreatedAt}}"])))))
                                          #"\n")
                             :let [[repository id created-at] (clojure.string/split images #"\t")]
                             :when (= "kermit-reporting-db" repository)]
                            (some (partial mach.core/modified-since? (new js/Date created-at))
                                  ["Dockerfile" "001-init.sql" "002-olap-schema.sql" "003-permissions.sql"])))
        update! #$ ["docker" "build" "-t" "kermit-reporting-db" "."]}
 run {depends [image]
      update! #$ ["./run-image"]}}
It predates the async changes that were made to mach.

๐Ÿ‘ 4
dominicm15:04:02

Essentially it parses that date out of the docker command output, and then compares that date to now

cddr15:04:27

Aha sneaky. Thanks! ๐Ÿ™‚

otfrom19:04:41

@cddr I'd be interested in that blog post

cddr21:04:47

Not much of a blogger but I made a little git repo with my experiment: https://github.com/cddr/mach-clj-demo

๐Ÿ‘ 8