gloo 5.3.8 → 6.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 (88) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/CLAUDE.md +83 -0
  4. data/lib/VERSION +1 -1
  5. data/lib/VERSION_NOTES +14 -0
  6. data/lib/gloo/app/engine.rb +57 -13
  7. data/lib/gloo/app/engine_context.rb +1 -1
  8. data/lib/gloo/app/info.rb +0 -1
  9. data/lib/gloo/app/log.rb +1 -1
  10. data/lib/gloo/app/platform.rb +2 -2
  11. data/lib/gloo/app/prompt.rb +1 -0
  12. data/lib/gloo/app/settings.rb +0 -5
  13. data/lib/gloo/app/table.rb +1 -1
  14. data/lib/gloo/convert/nilclass_to_datetime.rb +1 -1
  15. data/lib/gloo/convert/nilclass_to_integer.rb +1 -3
  16. data/lib/gloo/convert/nilclass_to_string.rb +0 -2
  17. data/lib/gloo/convert/nilclass_to_time.rb +1 -1
  18. data/lib/gloo/convert/string_to_decimal.rb +1 -1
  19. data/lib/gloo/core/dictionary.rb +16 -22
  20. data/lib/gloo/core/event_manager.rb +19 -0
  21. data/lib/gloo/core/here.rb +2 -1
  22. data/lib/gloo/core/literal.rb +1 -1
  23. data/lib/gloo/core/obj.rb +5 -1
  24. data/lib/gloo/core/obj_finder.rb +0 -1
  25. data/lib/gloo/core/pn.rb +4 -2
  26. data/lib/gloo/exec/exec_env.rb +0 -2
  27. data/lib/gloo/exec/runner.rb +7 -2
  28. data/lib/gloo/expr/l_decimal.rb +1 -1
  29. data/lib/gloo/expr/l_string.rb +1 -1
  30. data/lib/gloo/expr/op_eq.rb +3 -1
  31. data/lib/gloo/expr/op_gt.rb +3 -0
  32. data/lib/gloo/expr/op_gteq.rb +3 -0
  33. data/lib/gloo/expr/op_ineq.rb +3 -0
  34. data/lib/gloo/expr/op_lt.rb +3 -0
  35. data/lib/gloo/expr/op_lteq.rb +3 -0
  36. data/lib/gloo/objs/basic/alias.rb +1 -1
  37. data/lib/gloo/objs/basic/boolean.rb +1 -1
  38. data/lib/gloo/objs/basic/decimal.rb +22 -1
  39. data/lib/gloo/objs/basic/integer.rb +19 -1
  40. data/lib/gloo/objs/basic/string_generator.rb +4 -7
  41. data/lib/gloo/objs/basic/untyped.rb +1 -1
  42. data/lib/gloo/objs/ctrl/each_child.rb +0 -2
  43. data/lib/gloo/objs/ctrl/function.rb +2 -5
  44. data/lib/gloo/objs/ctrl/repeat.rb +1 -2
  45. data/lib/gloo/objs/dt/datetime.rb +19 -8
  46. data/lib/gloo/objs/dt/dt_tools.rb +101 -21
  47. data/lib/gloo/objs/dt/time.rb +17 -1
  48. data/lib/gloo/objs/str_utils/cipher.rb +8 -11
  49. data/lib/gloo/objs/str_utils/outline.rb +0 -2
  50. data/lib/gloo/objs/system/erb.rb +5 -6
  51. data/lib/gloo/objs/system/file_handle.rb +18 -2
  52. data/lib/gloo/objs/system/system.rb +5 -11
  53. data/lib/gloo/objs/web/http_get.rb +6 -12
  54. data/lib/gloo/objs/web/http_post.rb +5 -31
  55. data/lib/gloo/objs/web/json.rb +1 -1
  56. data/lib/gloo/objs/web/uri.rb +2 -2
  57. data/lib/gloo/persist/disc_mech.rb +2 -2
  58. data/lib/gloo/persist/file_loader.rb +1 -1
  59. data/lib/gloo/persist/file_saver.rb +2 -2
  60. data/lib/gloo/persist/persist_man.rb +12 -8
  61. data/lib/gloo/plugin/callback.rb +1 -1
  62. data/lib/gloo/plugin/ext_manager.rb +1 -1
  63. data/lib/gloo/plugin/lib_manager.rb +1 -1
  64. data/lib/gloo/verbs/execute.rb +0 -6
  65. data/lib/gloo/verbs/files.rb +0 -1
  66. data/lib/gloo/verbs/help.rb +0 -16
  67. data/lib/gloo/verbs/list.rb +1 -1
  68. data/lib/gloo/verbs/load.rb +1 -1
  69. data/lib/gloo/verbs/show.rb +1 -1
  70. data/lib/gloo/verbs/throw.rb +55 -0
  71. data/test.gloo/ctrl/each.test.gloo +39 -0
  72. data/test.gloo/dt/date.test.gloo +1 -1
  73. data/test.gloo/dt/datetime.test.gloo +61 -0
  74. data/test.gloo/dt/time.test.gloo +14 -1
  75. data/test.gloo/lang/dt_comparisons.test.gloo +124 -0
  76. data/test.gloo/lang/exceptions.test.gloo +63 -0
  77. data/test.gloo/lang/gloo_sys.test.gloo +15 -0
  78. data/test.gloo/objs/alias.test.gloo +24 -0
  79. data/test.gloo/objs/decimal.test.gloo +38 -0
  80. data/test.gloo/objs/erb.test.gloo +35 -0
  81. data/test.gloo/objs/int.test.gloo +14 -0
  82. data/test.gloo/objs/string.test.gloo +44 -0
  83. data/test.gloo/verbs/create.test.gloo +14 -0
  84. data/test.gloo/verbs/invoke.test.gloo +20 -0
  85. data/test.gloo/verbs/unless.test.gloo +22 -0
  86. metadata +15 -4
  87. data/lib/gloo/utils/format.rb +0 -21
  88. data/lib/gloo/utils/words.rb +0 -19
@@ -0,0 +1,63 @@
1
+ #
2
+ # Exception handling tests (on_exception / throw)
3
+ #
4
+
5
+ tests [can] :
6
+ lang [can] :
7
+ exceptions [can] :
8
+
9
+ exc_fired [bool] : false
10
+ err_fired [bool] : false
11
+
12
+ on_exception [script] :
13
+ put true into ^.exc_fired
14
+
15
+ on_error [script] :
16
+ put true into ^.err_fired
17
+
18
+ exception_data [can] :
19
+ message [string] :
20
+ backtrace [string] :
21
+
22
+ error_data [can] :
23
+ message [string] :
24
+ backtrace [string] :
25
+
26
+ confirm_throw_fires_on_exception [test] :
27
+ description [string] : Confirm throw fires on_exception and populates exception_data, but does not fire on_error.
28
+ on_test [script] :
29
+ put false into ^^.exc_fired
30
+ put false into ^^.err_fired
31
+
32
+ throw "test message"
33
+
34
+ eval ^^.exc_fired = true
35
+ assert "expected on_exception to have fired"
36
+
37
+ eval ^^.err_fired = false
38
+ assert "expected on_error to NOT have fired for a thrown exception"
39
+
40
+ eval ^^.exception_data.message = "test message"
41
+ assert "expected exception_data.message to be populated"
42
+
43
+ confirm_execution_continues_after_throw [test] :
44
+ description [string] : Confirm execution continues with the next line after a throw.
45
+ on_test [script] :
46
+ throw "boom"
47
+ eval 2 + 2
48
+ eval it = 4
49
+ assert "expected execution to continue after throw"
50
+
51
+ confirm_on_error_still_works [test] :
52
+ description [string] : Confirm on_error still fires for a genuine gloo-level error, independent of on_exception.
53
+ on_test [script] :
54
+ put false into ^^.exc_fired
55
+ put false into ^^.err_fired
56
+
57
+ tell no_such_object_anywhere to run
58
+
59
+ eval ^^.err_fired = true
60
+ assert "expected on_error to have fired for a bad path"
61
+
62
+ eval ^^.exc_fired = false
63
+ assert "expected on_exception to NOT have fired for a gloo-level error"
@@ -89,3 +89,18 @@ tests [can] :
89
89
  put $.screen_cols into ^.i
90
90
  eval ^.i > 0
91
91
  assert "expected screen_cols to be greater than 0"
92
+
93
+ get_platform_os [test] :
94
+ description [string] : Get the platform OS.
95
+ on_test [script] :
96
+ eval $.platform_mac? = true
97
+ assert "expected platform_mac to be true"
98
+
99
+ eval $.platform_windows? = false
100
+ assert "expected platform_windows to be false"
101
+
102
+ eval $.platform_linux? = false
103
+ assert "expected platform_linux to be false"
104
+
105
+ eval $.platform_wsl? = false
106
+ assert "expected platform_wsl to be false"
@@ -0,0 +1,24 @@
1
+ #
2
+ # Alias tests
3
+ #
4
+
5
+ tests [can] :
6
+ objs [can] :
7
+ alias [can] :
8
+
9
+ s [string] : hello
10
+ ln [alias] : tests.objs.alias.s
11
+
12
+ follow_alias [test] :
13
+ description [string] : Follow an alias to the target value
14
+ on_test [script] :
15
+ put 'hello' into ^^.s
16
+ eval ^^.ln = 'hello'
17
+ assert "expected alias to resolve to 'hello'"
18
+
19
+ put_via_alias [test] :
20
+ description [string] : Put a value via an alias
21
+ on_test [script] :
22
+ put 'world' into ^^.ln
23
+ eval ^^.s = 'world'
24
+ assert "expected s to be updated via alias"
@@ -0,0 +1,38 @@
1
+ #
2
+ # Decimal tests
3
+ #
4
+
5
+ tests [can] :
6
+ objs [can] :
7
+ decimal [can] :
8
+
9
+ a [decimal] :
10
+
11
+ set_value [test] :
12
+ description [string] : Set a decimal value
13
+ on_test [script] :
14
+ put 3.14 into ^^.a
15
+ eval ^^.a = 3.14
16
+ assert "expected a to be 3.14"
17
+
18
+ round_decimal [test] :
19
+ description [string] : Round a decimal value
20
+ on_test [script] :
21
+ put 3.7 into ^^.a
22
+ tell ^^.a to round
23
+ eval ^^.a = 4.0
24
+ assert "expected a to be rounded to 4.0"
25
+
26
+ format_decimal [test] :
27
+ description [string] : Format a decimal
28
+ f [decimal] :
29
+ on_test [script] :
30
+ put 1234567.891 into ^.f
31
+ tell ^.f to format
32
+ eval it = '1,234,567.891'
33
+ assert "expected formatted decimal to match"
34
+
35
+ put 3.14159 into ^.f
36
+ tell ^.f to format ('%.2f')
37
+ eval it = '3.14'
38
+ assert "expected formatted decimal to match"
@@ -0,0 +1,35 @@
1
+ #
2
+ # ERB tests
3
+ #
4
+
5
+ tests [can] :
6
+ objs [can] :
7
+ erb [can] :
8
+
9
+ greeting [string] : <%= name %>!!
10
+
11
+ basic [erb] :
12
+ template [text] : <%= name %>
13
+ params [can] :
14
+ name [string] : world
15
+ result [text] :
16
+
17
+ aliased_template [erb] :
18
+ template [alias] : tests.objs.erb.greeting
19
+ params [can] :
20
+ name [string] : gloo
21
+ result [text] :
22
+
23
+ run_basic [test] :
24
+ description [string] : Render a template with a param
25
+ on_test [script] :
26
+ tell ^^.basic to run
27
+ eval ^^.basic.result = 'world'
28
+ assert "expected template to render with the param value"
29
+
30
+ run_with_aliased_template [test] :
31
+ description [string] : Render a template whose 'template' child is an alias to another object
32
+ on_test [script] :
33
+ tell ^^.aliased_template to run
34
+ eval ^^.aliased_template.result = 'gloo!!'
35
+ assert "expected alias to be resolved before rendering the template"
@@ -54,3 +54,17 @@ tests [can] :
54
54
  tell ^^.b to randomize (10000)
55
55
  eval ^^.a = ^^.b
56
56
  refute "expected them to not be equal"
57
+
58
+ format_int [test] :
59
+ description [string] : Format an integer
60
+ f [int] :
61
+ on_test [script] :
62
+ put 1234567 into ^.f
63
+ tell ^.f to format
64
+ eval it = '1,234,567'
65
+ assert "expected formatted integer to match"
66
+
67
+ put 42 into ^.f
68
+ tell ^.f to format ('%05d')
69
+ eval it = '00042'
70
+ assert "expected formatted integer to match"
@@ -0,0 +1,44 @@
1
+ #
2
+ # String tests
3
+ #
4
+
5
+ tests [can] :
6
+ objs [can] :
7
+ string [can] :
8
+
9
+ s [string] :
10
+
11
+ up_down [test] :
12
+ description [string] : Convert string case
13
+ on_test [script] :
14
+ put 'hello' into ^^.s
15
+ tell ^^.s to up
16
+ eval ^^.s = 'HELLO'
17
+ assert "expected string to be uppercase"
18
+ tell ^^.s to down
19
+ eval ^^.s = 'hello'
20
+ assert "expected string to be lowercase"
21
+
22
+ trim [test] :
23
+ description [string] : Trim whitespace from a string
24
+ on_test [script] :
25
+ put ' hello ' into ^^.s
26
+ tell ^^.s to trim
27
+ eval it = 'hello'
28
+ assert "expected trimmed string to equal 'hello'"
29
+
30
+ sub [test] :
31
+ description [string] : Substitute in a string
32
+ on_test [script] :
33
+ put 'hello world' into ^^.s
34
+ tell ^^.s to sub ('world' 'gloo')
35
+ eval it = 'hello gloo'
36
+ assert "expected substituted string to equal 'hello gloo'"
37
+
38
+ count_chars [test] :
39
+ description [string] : Count the characters in a string
40
+ on_test [script] :
41
+ put 'hello' into ^^.s
42
+ tell ^^.s to count_chars
43
+ eval it = 5
44
+ assert "expected 5 characters"
@@ -0,0 +1,14 @@
1
+ #
2
+ # Create verb tests
3
+ #
4
+
5
+ tests [can] :
6
+ verbs [can] :
7
+ create [can] :
8
+
9
+ create_str [test] :
10
+ description [string] : Create sets it to the initial value.
11
+ on_test [script] :
12
+ create cx as string : 'hello'
13
+ eval it = 'hello'
14
+ assert "expected it to equal the created value"
@@ -0,0 +1,20 @@
1
+ #
2
+ # Invoke verb tests
3
+ #
4
+
5
+ tests [can] :
6
+ verbs [can] :
7
+ invoke [can] :
8
+
9
+ f [ƒ] :
10
+ params [can] :
11
+ on_invoke [script] :
12
+ put 42 into ^.result
13
+ result [int] :
14
+
15
+ invoke_test [test] :
16
+ description [string] : Invoke a function and check the result.
17
+ on_test [script] :
18
+ invoke tests.verbs.invoke.f
19
+ eval it = 42
20
+ assert "expected it to be 42"
@@ -0,0 +1,22 @@
1
+ #
2
+ # Unless verb tests
3
+ #
4
+
5
+ tests [can] :
6
+ verbs [can] :
7
+ unless [can] :
8
+
9
+ b [bool] : false
10
+
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"
16
+
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"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloo
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.8
4
+ version: '6.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-24 00:00:00.000000000 Z
11
+ date: 2026-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -263,6 +263,7 @@ files:
263
263
  - ".ruby-gemset"
264
264
  - ".ruby-version"
265
265
  - ".travis.yml"
266
+ - CLAUDE.md
266
267
  - CODE_OF_CONDUCT.md
267
268
  - Gemfile
268
269
  - LICENSE.txt
@@ -384,8 +385,6 @@ files:
384
385
  - lib/gloo/plugin/callback.rb
385
386
  - lib/gloo/plugin/ext_manager.rb
386
387
  - lib/gloo/plugin/lib_manager.rb
387
- - lib/gloo/utils/format.rb
388
- - lib/gloo/utils/words.rb
389
388
  - lib/gloo/verbs/break.rb
390
389
  - lib/gloo/verbs/check.rb
391
390
  - lib/gloo/verbs/cls.rb
@@ -410,39 +409,51 @@ files:
410
409
  - lib/gloo/verbs/save.rb
411
410
  - lib/gloo/verbs/show.rb
412
411
  - lib/gloo/verbs/tell.rb
412
+ - lib/gloo/verbs/throw.rb
413
413
  - lib/gloo/verbs/unless.rb
414
414
  - lib/gloo/verbs/unload.rb
415
415
  - lib/gloo/verbs/version.rb
416
416
  - lib/gloo/verbs/wait.rb
417
417
  - lib/run.rb
418
418
  - test.gloo/basic.test.gloo
419
+ - test.gloo/ctrl/each.test.gloo
419
420
  - test.gloo/dt/date.test.gloo
421
+ - test.gloo/dt/datetime.test.gloo
420
422
  - test.gloo/dt/time.test.gloo
423
+ - test.gloo/lang/dt_comparisons.test.gloo
424
+ - test.gloo/lang/exceptions.test.gloo
421
425
  - test.gloo/lang/gloo_sys.test.gloo
422
426
  - test.gloo/lang/ops.test.gloo
423
427
  - test.gloo/math/add.test.gloo
424
428
  - test.gloo/math/div.test.gloo
425
429
  - test.gloo/math/mult.test.gloo
426
430
  - test.gloo/math/sub.test.gloo
431
+ - test.gloo/objs/alias.test.gloo
427
432
  - test.gloo/objs/bool.test.gloo
428
433
  - test.gloo/objs/can.test.gloo
434
+ - test.gloo/objs/decimal.test.gloo
435
+ - test.gloo/objs/erb.test.gloo
429
436
  - test.gloo/objs/int.test.gloo
430
437
  - test.gloo/objs/obj.test.gloo
431
438
  - test.gloo/objs/script.test.gloo
439
+ - test.gloo/objs/string.test.gloo
432
440
  - test.gloo/objs/text.test.gloo
433
441
  - test.gloo/objs/untyped.test.gloo
434
442
  - test.gloo/string/str.test.gloo
435
443
  - test.gloo/string/str_gen.test.gloo
436
444
  - test.gloo/verbs/break.test.gloo
437
445
  - test.gloo/verbs/check.test.gloo
446
+ - test.gloo/verbs/create.test.gloo
438
447
  - test.gloo/verbs/eval.test.gloo
439
448
  - test.gloo/verbs/exists.test.gloo
440
449
  - test.gloo/verbs/if.test.gloo
450
+ - test.gloo/verbs/invoke.test.gloo
441
451
  - test.gloo/verbs/log.test.gloo
442
452
  - test.gloo/verbs/move.test.gloo
443
453
  - test.gloo/verbs/put.test.gloo
444
454
  - test.gloo/verbs/run.test.gloo
445
455
  - test.gloo/verbs/tell.test.gloo
456
+ - test.gloo/verbs/unless.test.gloo
446
457
  homepage: http://github.com/ecrane/gloo
447
458
  licenses:
448
459
  - MIT
@@ -1,21 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # Formatting utilities
5
- #
6
-
7
- module Gloo
8
- module Utils
9
- class Format
10
-
11
- #
12
- # Format number, adding comma separators.
13
- # Ex: 1000 -> 1,000
14
- #
15
- def self.number( num )
16
- return num.to_s.reverse.scan( /.{1,3}/ ).join( ',' ).reverse
17
- end
18
-
19
- end
20
- end
21
- end
@@ -1,19 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Utilities related to words (strings).
5
- #
6
-
7
- require 'active_support/inflector'
8
-
9
- module Gloo
10
- module Utils
11
- class Words
12
-
13
- def self.pluralize( word )
14
- return word.pluralize
15
- end
16
-
17
- end
18
- end
19
- end