yamlscript 0.1.66 → 0.1.67
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +4 -0
- data/ReadMe.md +29 -22
- data/lib/yamlscript/version.rb +1 -1
- data/lib/yamlscript.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0882f28f507724e4423834e89d19e74aaf8e1c2bf5d5bd8b3b800f12c54088f9'
|
4
|
+
data.tar.gz: 68162847a5259cc137f59f0542a18b1f9f580d5438da5a9ad6de1b6fbd91a5fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 601b7202c6555f91558f5e2603c7d62f17eb2bc8092c2818adb4efcb59298d3e24120315c906ea1a3ece4d1da55464e2e040e27fa9f6982538c5983cab86d4b8
|
7
|
+
data.tar.gz: 3b3b6ce700936675fde16c7e19d31a74b806310cb86cbcb5d5c1981d63baa82dc745ef3c6ff3bdfcd3d359b7f5b6a317c1e88915a6da3dbcdbe7b9895a8c38f4
|
data/ChangeLog.md
CHANGED
data/ReadMe.md
CHANGED
@@ -13,24 +13,30 @@ Load `file.yaml` with YAMLScript:
|
|
13
13
|
!yamlscript/v0/
|
14
14
|
|
15
15
|
=>:
|
16
|
-
names =:
|
17
|
-
"https://raw.githubusercontent.com/dominictarr/" +
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
names-url =:
|
17
|
+
("https://raw.githubusercontent.com/dominictarr/" +
|
18
|
+
"random-name/master/first-names.json")
|
19
|
+
|
20
|
+
name-list =: &first-names json/load(curl(names-url))
|
21
|
+
|
22
|
+
# Data object with literal keys and generated values:
|
23
|
+
name:: rand-nth(*first-names)
|
24
|
+
aka:: name-list.rand-nth()
|
25
|
+
age:: &num 2 * 3 * 7
|
26
|
+
color:: &hue qw(red green blue yellow)
|
27
|
+
.shuffle()
|
28
|
+
.first()
|
29
|
+
title:: "$(*num) shades of $(*hue)."
|
25
30
|
```
|
26
31
|
|
27
32
|
and get:
|
28
33
|
```json
|
29
34
|
{
|
30
|
-
"name": "
|
31
|
-
"aka": "
|
35
|
+
"name": "Dolores",
|
36
|
+
"aka": "Anita",
|
32
37
|
"age": 42,
|
33
|
-
"color": "
|
38
|
+
"color": "green",
|
39
|
+
"title": "42 shades of green."
|
34
40
|
}
|
35
41
|
```
|
36
42
|
|
@@ -43,7 +49,7 @@ clean YAML syntax.
|
|
43
49
|
YAMLScript can be used for enhancing ordinary [YAML](https://yaml.org) files
|
44
50
|
with functional operations, such as:
|
45
51
|
|
46
|
-
* Import parts of other YAML files to any node
|
52
|
+
* Import (parts of) other YAML files to any node
|
47
53
|
* String interpolation including function calls
|
48
54
|
* Data transforms including ones defined by you
|
49
55
|
|
@@ -64,18 +70,19 @@ YAMLScript is compiled to a native shared library (`libyamlscript.so`) that can
|
|
64
70
|
be used by any programming language that can load shared libraries.
|
65
71
|
|
66
72
|
To see the Clojure code that YAMLScript compiles to, you can use the YAMLScript
|
67
|
-
CLI binary
|
73
|
+
CLI binary `ys` to run:
|
68
74
|
|
69
75
|
```text
|
70
76
|
$ ys --compile file.ys
|
71
|
-
(def names
|
72
|
-
(
|
73
|
-
|
74
|
-
|
75
|
-
{"age" (*_
|
76
|
-
"aka" (_->
|
77
|
-
"color"
|
78
|
-
"name" (
|
77
|
+
(def names-url
|
78
|
+
(+_ "https://raw.githubusercontent.com/dominictarr/"
|
79
|
+
"random-name/master/first-names.json"))
|
80
|
+
(def name-list (_& 'first-names (json/load (curl names-url))))
|
81
|
+
{"age" (_& 'num (*_ 2 3 7)),
|
82
|
+
"aka" (_-> name-list (list rand-nth)),
|
83
|
+
"color" (_& 'hue (_-> (qw red green blue yellow) (list shuffle) (list first))),
|
84
|
+
"name" (rand-nth (_** 'first-names)),
|
85
|
+
"title" (str (_** 'num) " shades of " (_** 'hue) ".")}
|
79
86
|
```
|
80
87
|
|
81
88
|
|
data/lib/yamlscript/version.rb
CHANGED
data/lib/yamlscript.rb
CHANGED
@@ -16,7 +16,7 @@ class YAMLScript
|
|
16
16
|
# This value is automatically updated by 'make bump'.
|
17
17
|
# The version number is used to find the correct shared library file.
|
18
18
|
# We currently only support binding to an exact version of libyamlscript.
|
19
|
-
YAMLSCRIPT_VERSION = '0.1.
|
19
|
+
YAMLSCRIPT_VERSION = '0.1.67'
|
20
20
|
|
21
21
|
# A low-level interface to the native library
|
22
22
|
module LibYAMLScript
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yamlscript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.67
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ingy döt Net
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-07-
|
12
|
+
date: 2024-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|