[#263] add yaml library
This commit is contained in:
parent
c9c359e251
commit
5f914cedd1
7 changed files with 29 additions and 6 deletions
|
|
@ -225,7 +225,8 @@ enumerated explicitly.
|
|||
- [`clojure.data.csv`](https://github.com/clojure/data.csv) aliased as `csv`
|
||||
- [`cheshire.core`](https://github.com/dakrone/cheshire) aliased as `json`
|
||||
- [`cognitect.transit`](https://github.com/cognitect/transit-clj) aliased as `transit`
|
||||
- [`bencode.core`](https://github.com/nrepl/bencode) aliased as `bencode`: `read-bencode`, `write-bencode`.
|
||||
- [`clj-yaml.core`](https://github.com/clj-commons/clj-yaml) alias as `yaml`
|
||||
- [`bencode.core`](https://github.com/nrepl/bencode) aliased as `bencode`: `read-bencode`, `write-bencode`
|
||||
|
||||
A selection of java classes are available, see `babashka/impl/classes.clj`.
|
||||
|
||||
|
|
|
|||
5
deps.edn
5
deps.edn
|
|
@ -9,9 +9,8 @@
|
|||
org.clojure/data.csv {:mvn/version "1.0.0"},
|
||||
cheshire {:mvn/version "5.10.0"}
|
||||
fipp {:mvn/version "0.6.22"}
|
||||
com.cognitect/transit-clj {:mvn/version "1.0.324"}
|
||||
;; nrepl/bencode {:mvn/version "1.0.0"}
|
||||
}
|
||||
clj-commons/clj-yaml {:mvn/version "0.7.1"}
|
||||
com.cognitect/transit-clj {:mvn/version "1.0.324"}}
|
||||
:aliases {:main
|
||||
{:main-opts ["-m" "babashka.main"]}
|
||||
:profile
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ $ BABASHKA_XMX="-J-Xmx4g" script/compile
|
|||
|
||||
Keep notes here about how adding libraries and classes to Babashka affects the binary size.
|
||||
|
||||
2020/03/29 Added clj-yaml for parsing and generating yaml.
|
||||
45196996 - 42626884 = 2570kb added.
|
||||
|
||||
2020/03/28 Added java.nio.file.FileSystem(s) to support extracting zip files
|
||||
42562284 - 42021244 = 541kb added.
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
[org.clojure/data.csv "1.0.0"]
|
||||
[cheshire "5.10.0"]
|
||||
[fipp "0.6.22"]
|
||||
[com.cognitect/transit-clj "1.0.324"]
|
||||
#_[nrepl/bencode "1.0.0"]]
|
||||
[clj-commons/clj-yaml "0.7.1"]
|
||||
[com.cognitect/transit-clj "1.0.324"]]
|
||||
:profiles {:test {:dependencies [[clj-commons/conch "0.9.2"]
|
||||
[com.clojure-goes-fast/clj-async-profiler "0.4.0"]]}
|
||||
:uberjar {:global-vars {*assert* false}
|
||||
|
|
|
|||
11
src/babashka/impl/yaml.clj
Normal file
11
src/babashka/impl/yaml.clj
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
(ns babashka.impl.yaml
|
||||
{:no-doc true}
|
||||
(:require [clj-yaml.core :as yaml]
|
||||
[sci.impl.namespaces :refer [copy-var]]
|
||||
[sci.impl.vars :as vars]))
|
||||
|
||||
(def yns (vars/->SciNamespace 'clj-yaml.core nil))
|
||||
|
||||
(def yaml-namespace
|
||||
{'generate-string (copy-var yaml/generate-string yns)
|
||||
'parse-string (copy-var yaml/parse-string yns)})
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
[clojure.java.io :as io]
|
||||
[clojure.stacktrace :refer [print-stack-trace]]
|
||||
[clojure.string :as str]
|
||||
[babashka.impl.yaml :refer [yaml-namespace]]
|
||||
[sci.addons :as addons]
|
||||
[sci.core :as sci]
|
||||
[sci.impl.interpreter :refer [eval-string*]]
|
||||
|
|
@ -246,6 +247,7 @@ Everything after that is bound to *command-line-args*."))
|
|||
async clojure.core.async
|
||||
csv clojure.data.csv
|
||||
json cheshire.core
|
||||
yaml clj-yaml.core
|
||||
curl babashka.curl
|
||||
transit cognitect.transit
|
||||
bencode bencode.core})
|
||||
|
|
@ -279,6 +281,7 @@ Everything after that is bound to *command-line-args*."))
|
|||
'clojure.repl {'demunge demunge}
|
||||
'clojure.test t/clojure-test-namespace
|
||||
'babashka.classpath {'add-classpath add-classpath*}
|
||||
'clj-yaml.core yaml-namespace
|
||||
'clojure.pprint pprint-namespace
|
||||
'babashka.curl curl-namespace
|
||||
'cognitect.transit transit-namespace
|
||||
|
|
|
|||
|
|
@ -402,6 +402,12 @@
|
|||
(bb nil (format "(.deleteOnExit (io/file \"%s\"))" p))
|
||||
(is (false? (.exists f))))))
|
||||
|
||||
|
||||
(deftest yaml-test
|
||||
(is (str/starts-with?
|
||||
(bb nil "(yaml/generate-string [{:name \"John Smith\", :age 33} {:name \"Mary Smith\", :age 27}])")
|
||||
"-")))
|
||||
|
||||
(deftest statsd-client-test
|
||||
(is (= :success (bb nil "
|
||||
(load-file (io/file \"test-resources\" \"babashka\" \"statsd.clj\"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue