/
core.clj
24 lines (20 loc) · 927 Bytes
/
core.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(ns clojider-gatling-highcharts-reporter.core
(:require [clojider-gatling-highcharts-reporter.reporter :refer [csv-writer]]
[clojider-gatling-highcharts-reporter.generator :refer [create-chart]]
[clojure.java.io :as io])
(:import (java.io File)
(java.time ZonedDateTime)))
(defn- path-join [& paths]
(.getCanonicalPath (apply io/file paths)))
(defn start-time []
(ZonedDateTime/now))
(defn create-dir [dir]
(.mkdirs (File. ^String dir)))
(defn gatling-highcharts-reporter [results-dir]
(let [input-dir (path-join results-dir "input")]
(create-dir input-dir)
{:writer (partial csv-writer input-dir (start-time))
:generator (fn [_]
(println "Creating report from files in" results-dir)
(create-chart results-dir)
(println (str "Open " results-dir "/index.html with your browser to see a detailed report.")))}))