gloo 6.4.0 → 6.5.0

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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/docs/application.md +9 -0
  3. data/docs/language_objects.md +40 -0
  4. data/docs/objects.md +1 -1
  5. data/docs/verbs.md +9 -0
  6. data/lib/VERSION +1 -1
  7. data/lib/VERSION_NOTES +7 -0
  8. data/lib/gloo/app/engine.rb +5 -1
  9. data/lib/gloo/app/log.rb +5 -5
  10. data/lib/gloo/app/settings.rb +4 -1
  11. data/lib/gloo/core/obj.rb +21 -1
  12. data/lib/gloo/persist/file_loader.rb +7 -0
  13. data/lib/gloo/persist/persist_man.rb +35 -3
  14. data/lib/gloo/persist/source/obj_node.rb +41 -0
  15. data/lib/gloo/verbs/list.rb +24 -2
  16. data/lib/gloo/verbs/load.rb +4 -1
  17. data/test.gloo/ctrl/each.test.gloo +28 -30
  18. data/test.gloo/dt/date.test.gloo +69 -71
  19. data/test.gloo/dt/datetime.test.gloo +55 -57
  20. data/test.gloo/dt/time.test.gloo +70 -72
  21. data/test.gloo/lang/continuation.test.gloo +25 -27
  22. data/test.gloo/lang/convert.test.gloo +50 -52
  23. data/test.gloo/lang/dt_comparisons.test.gloo +87 -89
  24. data/test.gloo/lang/exceptions.test.gloo +42 -44
  25. data/test.gloo/lang/gloo_sys.test.gloo +100 -102
  26. data/test.gloo/lang/here.test.gloo +32 -34
  27. data/test.gloo/lang/it.test.gloo +27 -29
  28. data/test.gloo/lang/literal.test.gloo +55 -57
  29. data/test.gloo/lang/load_lib_directive.test.gloo +18 -20
  30. data/test.gloo/lang/naming.test.gloo +28 -30
  31. data/test.gloo/lang/ops.test.gloo +53 -55
  32. data/test.gloo/lang/shorthand.test.gloo +15 -17
  33. data/test.gloo/math/add.test.gloo +40 -42
  34. data/test.gloo/math/div.test.gloo +23 -25
  35. data/test.gloo/math/mult.test.gloo +23 -25
  36. data/test.gloo/math/sub.test.gloo +23 -25
  37. data/test.gloo/objs/alias.test.gloo +15 -17
  38. data/test.gloo/objs/bool.test.gloo +54 -56
  39. data/test.gloo/objs/can.test.gloo +33 -35
  40. data/test.gloo/objs/cipher.test.gloo +39 -41
  41. data/test.gloo/objs/decimal.test.gloo +27 -29
  42. data/test.gloo/objs/erb.test.gloo +47 -49
  43. data/test.gloo/objs/file.test.gloo +68 -70
  44. data/test.gloo/objs/function.test.gloo +37 -39
  45. data/test.gloo/objs/int.test.gloo +54 -56
  46. data/test.gloo/objs/json.test.gloo +56 -58
  47. data/test.gloo/objs/obj.test.gloo +68 -48
  48. data/test.gloo/objs/outline.test.gloo +48 -50
  49. data/test.gloo/objs/password.test.gloo +34 -36
  50. data/test.gloo/objs/repeat.test.gloo +42 -44
  51. data/test.gloo/objs/script.test.gloo +13 -15
  52. data/test.gloo/objs/string.test.gloo +82 -84
  53. data/test.gloo/objs/text.test.gloo +90 -92
  54. data/test.gloo/objs/untyped.test.gloo +36 -38
  55. data/test.gloo/objs/uri.test.gloo +37 -39
  56. data/test.gloo/verbs/break.test.gloo +12 -14
  57. data/test.gloo/verbs/check.test.gloo +22 -24
  58. data/test.gloo/verbs/context.test.gloo +11 -13
  59. data/test.gloo/verbs/create.test.gloo +7 -9
  60. data/test.gloo/verbs/eval.test.gloo +10 -12
  61. data/test.gloo/verbs/exists.test.gloo +43 -45
  62. data/test.gloo/verbs/if.test.gloo +8 -10
  63. data/test.gloo/verbs/invoke.test.gloo +73 -75
  64. data/test.gloo/verbs/list.test.gloo +21 -23
  65. data/test.gloo/verbs/load.test.gloo +27 -21
  66. data/test.gloo/verbs/log.test.gloo +7 -9
  67. data/test.gloo/verbs/move.test.gloo +12 -14
  68. data/test.gloo/verbs/put.test.gloo +10 -12
  69. data/test.gloo/verbs/reload.test.gloo +30 -32
  70. data/test.gloo/verbs/run.test.gloo +8 -10
  71. data/test.gloo/verbs/save.test.gloo +90 -94
  72. data/test.gloo/verbs/show.test.gloo +26 -28
  73. data/test.gloo/verbs/tell.test.gloo +8 -10
  74. data/test.gloo/verbs/throw.test.gloo +31 -33
  75. data/test.gloo/verbs/unless.test.gloo +13 -15
  76. data/test.gloo/verbs/unload.test.gloo +10 -12
  77. metadata +1 -1
@@ -6,67 +6,65 @@
6
6
  # child is the id and whose second child is the name.
7
7
  #
8
8
 
9
- tests [can] :
10
- objs [can] :
11
- outline [can] :
9
+ tests.objs.outline [can] :
12
10
 
13
- src [container] :
14
- 1 [container] :
15
- id [int] : 1
16
- name [string] : a/b/c
17
- 2 [container] :
18
- id [int] : 2
19
- name [string] : a/b/d
20
- 3 [container] :
21
- id [int] : 3
22
- name [string] : top
11
+ src [container] :
12
+ 1 [container] :
13
+ id [int] : 1
14
+ name [string] : a/b/c
15
+ 2 [container] :
16
+ id [int] : 2
17
+ name [string] : a/b/d
18
+ 3 [container] :
19
+ id [int] : 3
20
+ name [string] : top
23
21
 
24
- dotted [container] :
25
- 1 [container] :
26
- id [int] : 9
27
- name [string] : x.y.z
22
+ dotted [container] :
23
+ 1 [container] :
24
+ id [int] : 9
25
+ name [string] : x.y.z
28
26
 
29
- linked [outline] :
30
- object_source [alias] : tests.objs.outline.src
31
- entity_path [string] : /entity/
32
- separator_char [string] : /
33
- data [string] :
27
+ linked [outline] :
28
+ object_source [alias] : tests.objs.outline.src
29
+ entity_path [string] : /entity/
30
+ separator_char [string] : /
31
+ data [string] :
34
32
 
35
- plain [outline] :
36
- object_source [alias] : tests.objs.outline.dotted
37
- separator_char [string] : .
38
- data [string] :
33
+ plain [outline] :
34
+ object_source [alias] : tests.objs.outline.dotted
35
+ separator_char [string] : .
36
+ data [string] :
39
37
 
40
- builds_nested_html_with_links [test] :
41
- description [string] : generate nests shared path segments and links leaves that have an id.
42
- on_test [script] :
43
- tell ^^.linked to generate
38
+ builds_nested_html_with_links [test] :
39
+ description [string] : generate nests shared path segments and links leaves that have an id.
40
+ on_test [script] :
41
+ tell ^^.linked to generate
44
42
 
45
- check ^^.linked.data for starts_with? ( "<ul>" )
46
- assert "expected the outline to start with <ul>"
43
+ check ^^.linked.data for starts_with? ( "<ul>" )
44
+ assert "expected the outline to start with <ul>"
47
45
 
48
- check ^^.linked.data for substring? ( "<li>a</li>" )
49
- assert "expected a shared 'a' segment as a plain node"
46
+ check ^^.linked.data for substring? ( "<li>a</li>" )
47
+ assert "expected a shared 'a' segment as a plain node"
50
48
 
51
- check ^^.linked.data for substring? ( "<li>b</li>" )
52
- assert "expected a shared 'b' segment as a plain node"
49
+ check ^^.linked.data for substring? ( "<li>b</li>" )
50
+ assert "expected a shared 'b' segment as a plain node"
53
51
 
54
- check ^^.linked.data for substring? ( "<a href='/entity/1'>c</a>" )
55
- assert "expected leaf 'c' to be linked with its id and entity_path"
52
+ check ^^.linked.data for substring? ( "<a href='/entity/1'>c</a>" )
53
+ assert "expected leaf 'c' to be linked with its id and entity_path"
56
54
 
57
- check ^^.linked.data for substring? ( "<a href='/entity/3'>top</a>" )
58
- assert "expected the top-level 'top' item to be linked"
55
+ check ^^.linked.data for substring? ( "<a href='/entity/3'>top</a>" )
56
+ assert "expected the top-level 'top' item to be linked"
59
57
 
60
- custom_separator_and_no_links [test] :
61
- description [string] : separator_char sets the split char; with no entity_path leaves are plain.
62
- on_test [script] :
63
- tell ^^.plain to generate
58
+ custom_separator_and_no_links [test] :
59
+ description [string] : separator_char sets the split char; with no entity_path leaves are plain.
60
+ on_test [script] :
61
+ tell ^^.plain to generate
64
62
 
65
- check ^^.plain.data for substring? ( "<li>x</li>" )
66
- assert "expected '.' to split x.y.z so 'x' is its own node"
63
+ check ^^.plain.data for substring? ( "<li>x</li>" )
64
+ assert "expected '.' to split x.y.z so 'x' is its own node"
67
65
 
68
- check ^^.plain.data for substring? ( "<li>z</li>" )
69
- assert "expected leaf 'z' rendered plain (no entity_path)"
66
+ check ^^.plain.data for substring? ( "<li>z</li>" )
67
+ assert "expected leaf 'z' rendered plain (no entity_path)"
70
68
 
71
- check ^^.plain.data for substring? ( "href" )
72
- refute "expected no links when entity_path is not set"
69
+ check ^^.plain.data for substring? ( "href" )
70
+ refute "expected no links when entity_path is not set"
@@ -2,39 +2,37 @@
2
2
  # Password object tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- password [can] :
8
-
9
- hash_and_check [test] :
10
- description [string] : check succeeds for the right password and fails for the wrong one.
11
- on_test [script] :
12
- create tests.objs.password.p as password
13
- put 'user-1' into tests.objs.password.p.salt
14
- put 's3cret' into tests.objs.password.p.password
15
- tell tests.objs.password.p to hash
16
-
17
- check tests.objs.password.p.hash for blank?
18
- refute "expected hash to be populated"
19
-
20
- tell tests.objs.password.p to check
21
- assert "expected check to pass for the original password"
22
-
23
- put 'not the password' into tests.objs.password.p.password
24
- tell tests.objs.password.p to check
25
- refute "expected check to fail for a wrong password"
26
-
27
- generate_length [test] :
28
- description [string] : generate makes a password of the requested length and puts it in it.
29
- on_test [script] :
30
- create tests.objs.password.g as password
31
-
32
- tell tests.objs.password.g to generate
33
- tell tests.objs.password.g.password to size
34
- eval it = 7
35
- assert "expected the default generated length to be 7"
36
-
37
- tell tests.objs.password.g to generate ( 20 )
38
- tell tests.objs.password.g.password to size
39
- eval it = 20
40
- assert "expected the generated length to be 20"
5
+ tests.objs.password [can] :
6
+
7
+ hash_and_check [test] :
8
+ description [string] : check succeeds for the right password and fails for the wrong one.
9
+ on_test [script] :
10
+ create tests.objs.password.p as password
11
+ put 'user-1' into tests.objs.password.p.salt
12
+ put 's3cret' into tests.objs.password.p.password
13
+ tell tests.objs.password.p to hash
14
+
15
+ check tests.objs.password.p.hash for blank?
16
+ refute "expected hash to be populated"
17
+
18
+ tell tests.objs.password.p to check
19
+ assert "expected check to pass for the original password"
20
+
21
+ put 'not the password' into tests.objs.password.p.password
22
+ tell tests.objs.password.p to check
23
+ refute "expected check to fail for a wrong password"
24
+
25
+ generate_length [test] :
26
+ description [string] : generate makes a password of the requested length and puts it in it.
27
+ on_test [script] :
28
+ create tests.objs.password.g as password
29
+
30
+ tell tests.objs.password.g to generate
31
+ tell tests.objs.password.g.password to size
32
+ eval it = 7
33
+ assert "expected the default generated length to be 7"
34
+
35
+ tell tests.objs.password.g to generate ( 20 )
36
+ tell tests.objs.password.g.password to size
37
+ eval it = 20
38
+ assert "expected the generated length to be 20"
@@ -2,47 +2,45 @@
2
2
  # Repeat object tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- repeat [can] :
8
-
9
- count [int] : 0
10
- seen [string] :
11
-
12
- loop [repeat] :
13
- times [integer] : 4
14
- index [integer] : 0
15
- do [script] :
16
- put tests.objs.repeat.count + 1 into tests.objs.repeat.count
17
- put tests.objs.repeat.seen + tests.objs.repeat.loop.index into tests.objs.repeat.seen
18
-
19
- zero [repeat] :
20
- times [integer] : 0
21
- index [integer] : 0
22
- do [script] :
23
- put tests.objs.repeat.count + 100 into tests.objs.repeat.count
24
-
25
- runs_the_do_script_n_times [test] :
26
- description [string] : run executes 'do' once per 'times', and 'index' walks 0..times-1.
27
- on_test [script] :
28
- put 0 into ^^.count
29
- put '' into ^^.seen
30
-
31
- tell ^^.loop to run
32
-
33
- eval ^^.count = 4
34
- assert "expected the do script to run 4 times"
35
-
36
- eval ^^.seen = '0123'
37
- assert "expected index to be 0,1,2,3 across the iterations"
38
-
39
- eval ^^.loop.index = 3
40
- assert "expected index to be left at times-1 after the run"
41
-
42
- zero_times_does_nothing [test] :
43
- description [string] : run with times = 0 never executes 'do'.
44
- on_test [script] :
45
- put 0 into ^^.count
46
- tell ^^.zero to run
47
- eval ^^.count = 0
48
- assert "expected the do script not to run when times is 0"
5
+ tests.objs.repeat [can] :
6
+
7
+ count [int] : 0
8
+ seen [string] :
9
+
10
+ loop [repeat] :
11
+ times [integer] : 4
12
+ index [integer] : 0
13
+ do [script] :
14
+ put tests.objs.repeat.count + 1 into tests.objs.repeat.count
15
+ put tests.objs.repeat.seen + tests.objs.repeat.loop.index into tests.objs.repeat.seen
16
+
17
+ zero [repeat] :
18
+ times [integer] : 0
19
+ index [integer] : 0
20
+ do [script] :
21
+ put tests.objs.repeat.count + 100 into tests.objs.repeat.count
22
+
23
+ runs_the_do_script_n_times [test] :
24
+ description [string] : run executes 'do' once per 'times', and 'index' walks 0..times-1.
25
+ on_test [script] :
26
+ put 0 into ^^.count
27
+ put '' into ^^.seen
28
+
29
+ tell ^^.loop to run
30
+
31
+ eval ^^.count = 4
32
+ assert "expected the do script to run 4 times"
33
+
34
+ eval ^^.seen = '0123'
35
+ assert "expected index to be 0,1,2,3 across the iterations"
36
+
37
+ eval ^^.loop.index = 3
38
+ assert "expected index to be left at times-1 after the run"
39
+
40
+ zero_times_does_nothing [test] :
41
+ description [string] : run with times = 0 never executes 'do'.
42
+ on_test [script] :
43
+ put 0 into ^^.count
44
+ tell ^^.zero to run
45
+ eval ^^.count = 0
46
+ assert "expected the do script not to run when times is 0"
@@ -2,22 +2,20 @@
2
2
  # Script tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- script [can] :
5
+ tests.objs.script [can] :
8
6
 
9
- a [script] :
10
- b [boolean] : true
7
+ a [script] :
8
+ b [boolean] : true
11
9
 
12
- run_script [test] :
13
- description [string] : Set the value of the script
14
- on_test [script] :
15
- put "eval 2 + 5" into ^^.a
16
- tell ^^.a to run
17
- eval it = 7
18
- assert "expected it to be 7"
10
+ run_script [test] :
11
+ description [string] : Set the value of the script
12
+ on_test [script] :
13
+ put "eval 2 + 5" into ^^.a
14
+ tell ^^.a to run
15
+ eval it = 7
16
+ assert "expected it to be 7"
19
17
 
20
- put "eval ^.b = true" into ^^.a
21
- run ^^.a
22
- assert "expected it to be true"
18
+ put "eval ^.b = true" into ^^.a
19
+ run ^^.a
20
+ assert "expected it to be true"
23
21
 
@@ -2,97 +2,95 @@
2
2
  # String tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- string [can] :
5
+ tests.objs.string [can] :
8
6
 
9
- s [string] :
10
- dst [can] :
7
+ s [string] :
8
+ dst [can] :
11
9
 
12
- up_down [test] :
13
- description [string] : Convert string case
14
- on_test [script] :
15
- put 'hello' into ^^.s
16
- tell ^^.s to up
17
- eval ^^.s = 'HELLO'
18
- assert "expected string to be uppercase"
19
- tell ^^.s to down
20
- eval ^^.s = 'hello'
21
- assert "expected string to be lowercase"
10
+ up_down [test] :
11
+ description [string] : Convert string case
12
+ on_test [script] :
13
+ put 'hello' into ^^.s
14
+ tell ^^.s to up
15
+ eval ^^.s = 'HELLO'
16
+ assert "expected string to be uppercase"
17
+ tell ^^.s to down
18
+ eval ^^.s = 'hello'
19
+ assert "expected string to be lowercase"
22
20
 
23
- trim [test] :
24
- description [string] : Trim whitespace from a string
25
- on_test [script] :
26
- put ' hello ' into ^^.s
27
- tell ^^.s to trim
28
- eval it = 'hello'
29
- assert "expected trimmed string to equal 'hello'"
21
+ trim [test] :
22
+ description [string] : Trim whitespace from a string
23
+ on_test [script] :
24
+ put ' hello ' into ^^.s
25
+ tell ^^.s to trim
26
+ eval it = 'hello'
27
+ assert "expected trimmed string to equal 'hello'"
30
28
 
31
- sub [test] :
32
- description [string] : Substitute in a string
33
- on_test [script] :
34
- put 'hello world' into ^^.s
35
- tell ^^.s to sub ('world' 'gloo')
36
- eval it = 'hello gloo'
37
- assert "expected substituted string to equal 'hello gloo'"
29
+ sub [test] :
30
+ description [string] : Substitute in a string
31
+ on_test [script] :
32
+ put 'hello world' into ^^.s
33
+ tell ^^.s to sub ('world' 'gloo')
34
+ eval it = 'hello gloo'
35
+ assert "expected substituted string to equal 'hello gloo'"
38
36
 
39
- count_chars [test] :
40
- description [string] : Count the characters in a string
41
- on_test [script] :
42
- put 'hello' into ^^.s
43
- tell ^^.s to count_chars
44
- eval it = 5
45
- assert "expected 5 characters"
37
+ count_chars [test] :
38
+ description [string] : Count the characters in a string
39
+ on_test [script] :
40
+ put 'hello' into ^^.s
41
+ tell ^^.s to count_chars
42
+ eval it = 5
43
+ assert "expected 5 characters"
46
44
 
47
- split [test] :
48
- description [string] : Get a substring between two indexes
49
- on_test [script] :
50
- put 'one two three' into ^^.s
51
- tell ^^.s to split (4 7)
52
- eval it = 'two'
53
- assert "expected split (4 7) to equal 'two'"
54
- eval ^^.s = 'one two three'
55
- assert "expected split to leave the string unchanged"
45
+ split [test] :
46
+ description [string] : Get a substring between two indexes
47
+ on_test [script] :
48
+ put 'one two three' into ^^.s
49
+ tell ^^.s to split (4 7)
50
+ eval it = 'two'
51
+ assert "expected split (4 7) to equal 'two'"
52
+ eval ^^.s = 'one two three'
53
+ assert "expected split to leave the string unchanged"
56
54
 
57
- splitl [test] :
58
- description [string] : Get the substring to the left of an index
59
- on_test [script] :
60
- put 'one two three' into ^^.s
61
- tell ^^.s to splitl (7)
62
- eval it = 'one two'
63
- assert "expected splitl (7) to equal 'one two'"
55
+ splitl [test] :
56
+ description [string] : Get the substring to the left of an index
57
+ on_test [script] :
58
+ put 'one two three' into ^^.s
59
+ tell ^^.s to splitl (7)
60
+ eval it = 'one two'
61
+ assert "expected splitl (7) to equal 'one two'"
64
62
 
65
- splitr [test] :
66
- description [string] : Get the substring from an index to the end
67
- on_test [script] :
68
- put 'one two three' into ^^.s
69
- tell ^^.s to splitr (4)
70
- eval it = 'two three'
71
- assert "expected splitr (4) to equal 'two three'"
63
+ splitr [test] :
64
+ description [string] : Get the substring from an index to the end
65
+ on_test [script] :
66
+ put 'one two three' into ^^.s
67
+ tell ^^.s to splitr (4)
68
+ eval it = 'two three'
69
+ assert "expected splitr (4) to equal 'two three'"
72
70
 
73
- split_out_of_range [test] :
74
- description [string] : Out-of-range split indexes clamp to the string's bounds
75
- on_test [script] :
76
- put 'one two three' into ^^.s
77
- tell ^^.s to split (-5 4)
78
- eval it = 'one '
79
- assert "expected split (-5 4) to clamp to 'one '"
80
- tell ^^.s to split (8 100)
81
- eval it = 'three'
82
- assert "expected split (8 100) to clamp to 'three'"
71
+ split_out_of_range [test] :
72
+ description [string] : Out-of-range split indexes clamp to the string's bounds
73
+ on_test [script] :
74
+ put 'one two three' into ^^.s
75
+ tell ^^.s to split (-5 4)
76
+ eval it = 'one '
77
+ assert "expected split (-5 4) to clamp to 'one '"
78
+ tell ^^.s to split (8 100)
79
+ eval it = 'three'
80
+ assert "expected split (8 100) to clamp to 'three'"
83
81
 
84
- split_list [test] :
85
- description [string] : Split a string into children of a target container
86
- on_test [script] :
87
- put 'one,two,three' into ^^.s
88
- tell ^^.s to split_list (',' ^^.dst)
89
- eval it = 3
90
- assert "expected split_list to put the part count into it"
91
- eval ^^.dst.1 = 'one'
92
- assert "expected dst.1 to equal 'one'"
93
- eval ^^.dst.2 = 'two'
94
- assert "expected dst.2 to equal 'two'"
95
- eval ^^.dst.3 = 'three'
96
- assert "expected dst.3 to equal 'three'"
97
- eval ^^.s = 'one,two,three'
98
- assert "expected split_list to leave the string unchanged"
82
+ split_list [test] :
83
+ description [string] : Split a string into children of a target container
84
+ on_test [script] :
85
+ put 'one,two,three' into ^^.s
86
+ tell ^^.s to split_list (',' ^^.dst)
87
+ eval it = 3
88
+ assert "expected split_list to put the part count into it"
89
+ eval ^^.dst.1 = 'one'
90
+ assert "expected dst.1 to equal 'one'"
91
+ eval ^^.dst.2 = 'two'
92
+ assert "expected dst.2 to equal 'two'"
93
+ eval ^^.dst.3 = 'three'
94
+ assert "expected dst.3 to equal 'three'"
95
+ eval ^^.s = 'one,two,three'
96
+ assert "expected split_list to leave the string unchanged"