yamlscript 0.1.63 → 0.1.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog.md +12 -0
- data/Makefile +5 -0
- data/ReadMe.md +49 -21
- data/doc/authors.md +2 -0
- data/doc/readme.md +60 -0
- data/lib/yamlscript/version.rb +1 -1
- data/lib/yamlscript.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4898a2bea185c4fa8ae98c0fdcf7feeeea91c364d8f05f53223a91d0e2220154
|
4
|
+
data.tar.gz: e01d3805540211046aa6e7a03a41fdb152e404e33786b8c156a1f863507819ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b0019ed6ceb0d12b9f2944146ed68bec7f4f2cabaff8fc7c51ad0bc764e4254ece1b10d2def1f6880a4852ba4f83e946cee0d63ad4320cbeb0807f1d181d247
|
7
|
+
data.tar.gz: 0e100b1565aa7d0697656c00ee4f56d7a5c97f1a71bf3ef3fca598f833574cfcdc04ceb84326481f0466c210d4faa1f96e02c2f43f8d0c030acf267b8e08fbd2
|
data/ChangeLog.md
CHANGED
data/Makefile
CHANGED
data/ReadMe.md
CHANGED
@@ -1,37 +1,54 @@
|
|
1
|
+
<!-- DO NOT EDIT — THIS FILE WAS GENERATED -->
|
2
|
+
|
1
3
|
YAMLScript
|
2
4
|
==========
|
3
5
|
|
4
|
-
|
6
|
+
Add Logic to Your YAML Files
|
5
7
|
|
6
8
|
|
7
9
|
## Synopsis
|
8
10
|
|
11
|
+
Load `file.yaml` with YAMLScript:
|
9
12
|
```yaml
|
10
|
-
|
13
|
+
!yamlscript/v0/
|
14
|
+
|
15
|
+
=>:
|
16
|
+
names =: curl(
|
17
|
+
"https://raw.githubusercontent.com/dominictarr/" +
|
18
|
+
"random-name/master/first-names.json")
|
19
|
+
.json/load()
|
20
|
+
|
21
|
+
name:: names.rand-nth()
|
22
|
+
aka:: names.rand-nth()
|
23
|
+
age:: 6 * 7
|
24
|
+
color: yellow
|
25
|
+
```
|
11
26
|
|
12
|
-
|
13
|
-
|
27
|
+
and get:
|
28
|
+
```json
|
29
|
+
{
|
30
|
+
"name": "Anthea",
|
31
|
+
"aka": "Patrizia",
|
32
|
+
"age": 42,
|
33
|
+
"color": "yellow"
|
34
|
+
}
|
14
35
|
```
|
15
36
|
|
16
37
|
|
17
38
|
## Description
|
18
39
|
|
19
|
-
YAMLScript is a functional programming language with a
|
40
|
+
[YAMLScript](https://yamlscript.org) is a functional programming language with a
|
41
|
+
clean YAML syntax.
|
20
42
|
|
21
|
-
YAMLScript can be used for
|
43
|
+
YAMLScript can be used for enhancing ordinary [YAML](https://yaml.org) files
|
44
|
+
with functional operations, such as:
|
22
45
|
|
23
|
-
*
|
24
|
-
|
25
|
-
|
26
|
-
* Enhancing ordinary YAML files with new functional magics
|
27
|
-
* Import parts of other YAML files to any node
|
28
|
-
* String interpolation including function calls
|
29
|
-
* Any other functionality you can dream up!
|
30
|
-
* Writing reusable shared libraries
|
31
|
-
* High level code instead of C
|
32
|
-
* Bindable to almost any programming language
|
46
|
+
* Import parts of other YAML files to any node
|
47
|
+
* String interpolation including function calls
|
48
|
+
* Data transforms including ones defined by you
|
33
49
|
|
34
|
-
YAMLScript should be a drop-in replacement for your YAML
|
50
|
+
This YAMLScript library should be a drop-in replacement for your current YAML
|
51
|
+
loader!
|
35
52
|
|
36
53
|
Most existing YAML files are already valid YAMLScript files.
|
37
54
|
This means that YAMLScript works as a normal YAML loader, but can also evaluate
|
@@ -47,10 +64,18 @@ YAMLScript is compiled to a native shared library (`libyamlscript.so`) that can
|
|
47
64
|
be used by any programming language that can load shared libraries.
|
48
65
|
|
49
66
|
To see the Clojure code that YAMLScript compiles to, you can use the YAMLScript
|
50
|
-
|
67
|
+
CLI binary, `ys`, to run:
|
51
68
|
|
52
69
|
```text
|
53
70
|
$ ys --compile file.ys
|
71
|
+
(def names
|
72
|
+
(_-> (curl (+_ "https://raw.githubusercontent.com/dominictarr/"
|
73
|
+
"random-name/master/first-names.json"))
|
74
|
+
(list json/load)))
|
75
|
+
{"age" (*_ 6 7),
|
76
|
+
"aka" (_-> names (list rand-nth)),
|
77
|
+
"color" "yellow",
|
78
|
+
"name" (_-> names (list rand-nth))}
|
54
79
|
```
|
55
80
|
|
56
81
|
|
@@ -118,15 +143,18 @@ See https://github.com/yaml/yamlscript?#installing-yamlscript for more info.
|
|
118
143
|
|
119
144
|
## See Also
|
120
145
|
|
121
|
-
* [
|
122
|
-
* [
|
123
|
-
* [
|
146
|
+
* [YAMLScript Web Site](https://yamlscript.org)
|
147
|
+
* [YAMLScript Blog](https://yamlscript.org/blog)
|
148
|
+
* [YAMLScript Source Code](https://github.com/yaml/yamlscript)
|
149
|
+
* [YAMLScript Samples](https://github.com/yaml/yamlscript/tree/main/sample)
|
150
|
+
* [YAMLScript Programs](https://rosettacode.org/wiki/Category:YAMLScript)
|
124
151
|
* [YAML](https://yaml.org)
|
125
152
|
* [Clojure](https://clojure.org)
|
126
153
|
|
127
154
|
|
128
155
|
## Authors
|
129
156
|
|
157
|
+
|
130
158
|
* [Ingy döt Net](https://github.com/ingydotnet)
|
131
159
|
* [Delon R.Newman](https://github.com/delonnewman)
|
132
160
|
|
data/doc/authors.md
ADDED
data/doc/readme.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
## Ruby Usage
|
2
|
+
|
3
|
+
File `prog.rb`:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
require 'yamlscript'
|
7
|
+
input = IO.read('file.ys')
|
8
|
+
ys = YAMLScript.new
|
9
|
+
data = ys.load(input)
|
10
|
+
puts data
|
11
|
+
```
|
12
|
+
|
13
|
+
File `file.ys`:
|
14
|
+
|
15
|
+
```yaml
|
16
|
+
!yamlscript/v0
|
17
|
+
|
18
|
+
name =: "World"
|
19
|
+
|
20
|
+
=>::
|
21
|
+
foo: [1, 2, ! inc(41)]
|
22
|
+
bar:: load("other.yaml")
|
23
|
+
baz:: "Hello, $name!"
|
24
|
+
```
|
25
|
+
|
26
|
+
File `other.yaml`:
|
27
|
+
|
28
|
+
```yaml
|
29
|
+
oh: Hello
|
30
|
+
```
|
31
|
+
|
32
|
+
Run:
|
33
|
+
|
34
|
+
```text
|
35
|
+
$ ruby prog.rb
|
36
|
+
{"foo"=>[1, 2, 42], "bar"=>{"oh"=>"Hello"}, "baz"=>"Hello, World!"}
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
## Installation
|
41
|
+
|
42
|
+
You can install this module like any other Ruby module:
|
43
|
+
|
44
|
+
```bash
|
45
|
+
$ gem install yamlscript
|
46
|
+
```
|
47
|
+
|
48
|
+
but you will need to have a system install of `libyamlscript.so`.
|
49
|
+
|
50
|
+
One simple way to do that is with:
|
51
|
+
|
52
|
+
```bash
|
53
|
+
$ curl https://yamlscript.org/install | bash
|
54
|
+
```
|
55
|
+
|
56
|
+
> Note: The above command will install the latest version of the YAMLScript
|
57
|
+
command line utility, `ys`, and the shared library, `libyamlscript.so`, into
|
58
|
+
`~/local/bin` and `~/.local/lib` respectively.
|
59
|
+
|
60
|
+
See https://github.com/yaml/yamlscript?#installing-yamlscript for more info.
|
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.66'
|
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.66
|
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-
|
12
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -39,6 +39,8 @@ files:
|
|
39
39
|
- Makefile
|
40
40
|
- Rakefile
|
41
41
|
- ReadMe.md
|
42
|
+
- doc/authors.md
|
43
|
+
- doc/readme.md
|
42
44
|
- lib/yamlscript.rb
|
43
45
|
- lib/yamlscript/version.rb
|
44
46
|
- yamlscript.gemspec
|