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
@@ -7,29 +7,22 @@
7
7
  # next one starts clean.
8
8
  #
9
9
 
10
- tests [can] :
11
- verbs [can] :
12
- save [can] :
13
- f [file] : /tmp/gloo_save_test.gloo
14
- g [file] : /tmp/gloo_save_test_2.gloo
15
- to_target [file] : /tmp/gloo_save_test_to.gloo
16
- out [string] : BEGIN
17
- #
18
- # a comment above demo
19
- #
20
- demo [container] :
21
- msg [string] : hello
22
- END
23
- err [bool] : false
10
+ tests.verbs.save [can] :
24
11
 
25
- on_error [script] :
26
- put true into ^.err
12
+ f [file] : /tmp/gloo_save_test.gloo
13
+ g [file] : /tmp/gloo_save_test_2.gloo
14
+ to_target [file] : /tmp/gloo_save_test_to.gloo
15
+ out [string] :
16
+ err [bool] : false
27
17
 
28
- #
29
- # The fixture used by most tests: two comments, a changed-in-place
30
- # value, and an untouched sibling.
31
- #
32
- fixture [text] : BEGIN
18
+ on_error [script] :
19
+ put true into ^.err
20
+
21
+ #
22
+ # The fixture used by most tests: two comments, a changed-in-place
23
+ # value, and an untouched sibling.
24
+ #
25
+ fixture [text] : BEGIN
33
26
  #
34
27
  # a comment above demo
35
28
  #
@@ -39,77 +32,80 @@ demo [container] :
39
32
  other [string] : world
40
33
  END
41
34
 
42
- round_trip_preserves_comments_and_untouched_lines [test] :
43
- description [string] : load, change one value, save -- comments and the untouched sibling survive.
44
- on_test [script] :
45
- put false into ^^.err
46
- tell ^^.f to write ( ^^.fixture )
47
- load /tmp/gloo_save_test.gloo
48
- put 'changed' into demo.msg
49
- save demo
50
- eval ^^.err = false
51
- assert "save should not error"
52
- tell ^^.f to read ( ^^.out )
53
- check ^^.out for substring? ( "# a comment above demo" )
54
- assert "the leading comment block should survive"
55
- check ^^.out for substring? ( "# a comment above other" )
56
- assert "the inner comment should survive"
57
- check ^^.out for substring? ( "msg [string] : changed" )
58
- assert "the changed value should be written"
59
- check ^^.out for substring? ( "other [string] : world" )
60
- assert "the untouched sibling should be unchanged"
61
- tell demo to unload
62
- tell ^^.f to delete
63
- unchanged_file_round_trips_byte_for_byte [test] :
64
- description [string] : load then save with no change reproduces the file exactly.
65
- on_test [script] :
66
- tell ^^.f to write ( ^^.fixture )
67
- load /tmp/gloo_save_test.gloo
68
- save demo
69
- tell ^^.f to read ( ^^.out )
70
- eval ^^.out = ^^.fixture
71
- assert "an unchanged save should reproduce the original text"
72
- tell demo to unload
73
- tell ^^.f to delete
74
- deleting_an_object_drops_its_line [test] :
75
- description [string] : removing a child and saving drops just that declaration.
76
- on_test [script] :
77
- tell ^^.f to write ( ^^.fixture )
78
- load /tmp/gloo_save_test.gloo
79
- tell demo.other to unload
80
- save demo
81
- tell ^^.f to read ( ^^.out )
82
- check ^^.out for substring? ( "msg [string] : hello" )
83
- assert "the kept sibling should still be there"
84
- check ^^.out for substring? ( "other [string]" )
85
- refute "the removed child's line should be gone"
86
- tell demo to unload
87
- tell ^^.f to delete
88
- save_to_a_new_path_creates_the_file [test] :
89
- description [string] : save {obj} to {path} writes a new file and registers it.
90
- on_test [script] :
91
- tell ^^.f to write ( ^^.fixture )
92
- load /tmp/gloo_save_test.gloo
93
- save demo to /tmp/gloo_save_test_to
94
- check ^^.to_target for exists?
95
- assert "save ... to should create the target file"
96
- tell ^^.to_target to read ( ^^.out )
97
- check ^^.out for substring? ( "msg [string] : hello" )
98
- assert "the new file should hold the object"
99
- tell demo to unload
100
- tell ^^.f to delete
101
- tell ^^.to_target to delete
102
- reload_discards_unsaved_changes [test] :
103
- description [string] : reload throws away edits that were not saved.
104
- on_test [script] :
105
- tell ^^.f to write ( ^^.fixture )
106
- load /tmp/gloo_save_test.gloo
107
- put 'not saved' into demo.msg
108
- eval demo.msg = 'not saved'
109
- assert "sanity: the edit landed"
110
- tell demo to reload
111
- eval demo.msg = 'hello'
112
- assert "reload should restore the on-disk value"
113
- tell demo to unload
114
- tell ^^.f to delete
35
+ round_trip_preserves_comments_and_untouched_lines [test] :
36
+ description [string] : load, change one value, save -- comments and the untouched sibling survive.
37
+ on_test [script] :
38
+ put false into ^^.err
39
+ tell ^^.f to write ( ^^.fixture )
40
+ load /tmp/gloo_save_test.gloo
41
+ put 'changed' into demo.msg
42
+ save demo
43
+ eval ^^.err = false
44
+ assert "save should not error"
45
+ tell ^^.f to read ( ^^.out )
46
+ check ^^.out for substring? ( "# a comment above demo" )
47
+ assert "the leading comment block should survive"
48
+ check ^^.out for substring? ( "# a comment above other" )
49
+ assert "the inner comment should survive"
50
+ check ^^.out for substring? ( "msg [string] : changed" )
51
+ assert "the changed value should be written"
52
+ check ^^.out for substring? ( "other [string] : world" )
53
+ assert "the untouched sibling should be unchanged"
54
+ tell demo to unload
55
+ tell ^^.f to delete
56
+
57
+ unchanged_file_round_trips_byte_for_byte [test] :
58
+ description [string] : load then save with no change reproduces the file exactly.
59
+ on_test [script] :
60
+ tell ^^.f to write ( ^^.fixture )
61
+ load /tmp/gloo_save_test.gloo
62
+ save demo
63
+ tell ^^.f to read ( ^^.out )
64
+ eval ^^.out = ^^.fixture
65
+ assert "an unchanged save should reproduce the original text"
66
+ tell demo to unload
67
+ tell ^^.f to delete
68
+
69
+ deleting_an_object_drops_its_line [test] :
70
+ description [string] : removing a child and saving drops just that declaration.
71
+ on_test [script] :
72
+ tell ^^.f to write ( ^^.fixture )
73
+ load /tmp/gloo_save_test.gloo
74
+ tell demo.other to unload
75
+ save demo
76
+ tell ^^.f to read ( ^^.out )
77
+ check ^^.out for substring? ( "msg [string] : hello" )
78
+ assert "the kept sibling should still be there"
79
+ check ^^.out for substring? ( "other [string]" )
80
+ refute "the removed child's line should be gone"
81
+ tell demo to unload
82
+ tell ^^.f to delete
83
+
84
+ save_to_a_new_path_creates_the_file [test] :
85
+ description [string] : save {obj} to {path} writes a new file and registers it.
86
+ on_test [script] :
87
+ tell ^^.f to write ( ^^.fixture )
88
+ load /tmp/gloo_save_test.gloo
89
+ save demo to /tmp/gloo_save_test_to
90
+ check ^^.to_target for exists?
91
+ assert "save ... to should create the target file"
92
+ tell ^^.to_target to read ( ^^.out )
93
+ check ^^.out for substring? ( "msg [string] : hello" )
94
+ assert "the new file should hold the object"
95
+ tell demo to unload
96
+ tell ^^.f to delete
97
+ tell ^^.to_target to delete
115
98
 
99
+ reload_discards_unsaved_changes [test] :
100
+ description [string] : reload throws away edits that were not saved.
101
+ on_test [script] :
102
+ tell ^^.f to write ( ^^.fixture )
103
+ load /tmp/gloo_save_test.gloo
104
+ put 'not saved' into demo.msg
105
+ eval demo.msg = 'not saved'
106
+ assert "sanity: the edit landed"
107
+ tell demo to reload
108
+ eval demo.msg = 'hello'
109
+ assert "reload should restore the on-disk value"
110
+ tell demo to unload
111
+ tell ^^.f to delete
@@ -2,36 +2,34 @@
2
2
  # Show verb tests
3
3
  #
4
4
 
5
- tests [can] :
6
- verbs [can] :
7
- show [can] :
5
+ tests.verbs.show [can] :
8
6
 
9
- msg [string] : hello
7
+ msg [string] : hello
10
8
 
11
- show_literal [test] :
12
- description [string] : Show a literal sets it to that literal.
13
- on_test [script] :
14
- show 'hello'
15
- eval it = 'hello'
16
- assert "expected it to be 'hello'"
9
+ show_literal [test] :
10
+ description [string] : Show a literal sets it to that literal.
11
+ on_test [script] :
12
+ show 'hello'
13
+ eval it = 'hello'
14
+ assert "expected it to be 'hello'"
17
15
 
18
- show_object [test] :
19
- description [string] : Show an object sets it to the object's value.
20
- on_test [script] :
21
- show ^^.msg
22
- eval it = 'hello'
23
- assert "expected it to be the value of msg"
16
+ show_object [test] :
17
+ description [string] : Show an object sets it to the object's value.
18
+ on_test [script] :
19
+ show ^^.msg
20
+ eval it = 'hello'
21
+ assert "expected it to be the value of msg"
24
22
 
25
- show_expression [test] :
26
- description [string] : Show evaluates an expression before showing it.
27
- on_test [script] :
28
- show 3 + 4
29
- eval it = 7
30
- assert "expected it to be 7"
23
+ show_expression [test] :
24
+ description [string] : Show evaluates an expression before showing it.
25
+ on_test [script] :
26
+ show 3 + 4
27
+ eval it = 7
28
+ assert "expected it to be 7"
31
29
 
32
- show_concat [test] :
33
- description [string] : Show evaluates a string concatenation.
34
- on_test [script] :
35
- show 'a' + 'b'
36
- eval it = 'ab'
37
- assert "expected it to be 'ab'"
30
+ show_concat [test] :
31
+ description [string] : Show evaluates a string concatenation.
32
+ on_test [script] :
33
+ show 'a' + 'b'
34
+ eval it = 'ab'
35
+ assert "expected it to be 'ab'"
@@ -2,15 +2,13 @@
2
2
  # Tell verb tests
3
3
  #
4
4
 
5
- tests [can] :
6
- verbs [can] :
7
- tell [can] :
5
+ tests.verbs.tell [can] :
8
6
 
9
- s [string] : abc123d
7
+ s [string] : abc123d
10
8
 
11
- tell [test] :
12
- description [string] : Tell verb sets value to it
13
- on_test [script] :
14
- tell ^^.s to count_chars
15
- eval it = 7
16
- assert "expected it to be 7"
9
+ tell [test] :
10
+ description [string] : Tell verb sets value to it
11
+ on_test [script] :
12
+ tell ^^.s to count_chars
13
+ eval it = 7
14
+ assert "expected it to be 7"
@@ -9,36 +9,34 @@
9
9
  # the console by design.
10
10
  #
11
11
 
12
- tests [can] :
13
- verbs [can] :
14
- throw [can] :
15
-
16
- on_exception [script] :
17
- put ^.exception_data.message into ^.caught
18
-
19
- exception_data [can] :
20
- message [string] :
21
- backtrace [string] :
22
-
23
- caught [string] :
24
-
25
- default_message [test] :
26
- description [string] : bare throw uses the default message and execution continues.
27
- on_test [script] :
28
- put '' into tests.verbs.throw.caught
29
- eval false
30
-
31
- throw
32
- eval true
33
- assert "expected execution to continue after a bare throw"
34
-
35
- eval tests.verbs.throw.caught = 'Thrown by throw verb'
36
- assert "expected the default thrown message"
37
-
38
- custom_message [test] :
39
- description [string] : throw evaluates its argument as the message.
40
- on_test [script] :
41
- put '' into tests.verbs.throw.caught
42
- throw 'boom ' + '42'
43
- eval tests.verbs.throw.caught = 'boom 42'
44
- assert "expected the evaluated custom message"
12
+ tests.verbs.throw [can] :
13
+
14
+ on_exception [script] :
15
+ put ^.exception_data.message into ^.caught
16
+
17
+ exception_data [can] :
18
+ message [string] :
19
+ backtrace [string] :
20
+
21
+ caught [string] :
22
+
23
+ default_message [test] :
24
+ description [string] : bare throw uses the default message and execution continues.
25
+ on_test [script] :
26
+ put '' into tests.verbs.throw.caught
27
+ eval false
28
+
29
+ throw
30
+ eval true
31
+ assert "expected execution to continue after a bare throw"
32
+
33
+ eval tests.verbs.throw.caught = 'Thrown by throw verb'
34
+ assert "expected the default thrown message"
35
+
36
+ custom_message [test] :
37
+ description [string] : throw evaluates its argument as the message.
38
+ on_test [script] :
39
+ put '' into tests.verbs.throw.caught
40
+ throw 'boom ' + '42'
41
+ eval tests.verbs.throw.caught = 'boom 42'
42
+ assert "expected the evaluated custom message"
@@ -2,21 +2,19 @@
2
2
  # Unless verb tests
3
3
  #
4
4
 
5
- tests [can] :
6
- verbs [can] :
7
- unless [can] :
5
+ tests.verbs.unless [can] :
8
6
 
9
- b [bool] : false
7
+ b [bool] : false
10
8
 
11
- unless_false [test] :
12
- description [string] : Unless false, do block runs.
13
- on_test [script] :
14
- unless ^^.b do eval true
15
- assert "expected do block to run when condition is false"
9
+ unless_false [test] :
10
+ description [string] : Unless false, do block runs.
11
+ on_test [script] :
12
+ unless ^^.b do eval true
13
+ assert "expected do block to run when condition is false"
16
14
 
17
- unless_true [test] :
18
- description [string] : Unless true, do block is skipped.
19
- on_test [script] :
20
- eval false
21
- unless true do eval true
22
- refute "expected do block to be skipped when condition is true"
15
+ unless_true [test] :
16
+ description [string] : Unless true, do block is skipped.
17
+ on_test [script] :
18
+ eval false
19
+ unless true do eval true
20
+ refute "expected do block to be skipped when condition is true"
@@ -5,17 +5,15 @@
5
5
  # unit tests). Per-object unload is the 'unload' message, tested here.
6
6
  #
7
7
 
8
- tests [can] :
9
- verbs [can] :
10
- unload [can] :
8
+ tests.verbs.unload [can] :
11
9
 
12
- unload_removes_object [test] :
13
- description [string] : sending 'unload' to an object removes it from the tree.
14
- on_test [script] :
15
- create tests.verbs.unload.temp as string : 'x'
16
- exists? instance tests.verbs.unload.temp
17
- assert "temp should exist after create"
10
+ unload_removes_object [test] :
11
+ description [string] : sending 'unload' to an object removes it from the tree.
12
+ on_test [script] :
13
+ create tests.verbs.unload.temp as string : 'x'
14
+ exists? instance tests.verbs.unload.temp
15
+ assert "temp should exist after create"
18
16
 
19
- tell tests.verbs.unload.temp to unload
20
- exists? instance tests.verbs.unload.temp
21
- refute "temp should be gone after unload"
17
+ tell tests.verbs.unload.temp to unload
18
+ exists? instance tests.verbs.unload.temp
19
+ refute "temp should be gone after unload"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloo
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.0
4
+ version: 6.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane