gloo 6.5.1 → 6.7.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.
- checksums.yaml +4 -4
- data/docs/application.md +2 -0
- data/docs/verbs.md +6 -2
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +12 -0
- data/lib/gloo/app/engine.rb +17 -1
- data/lib/gloo/app/settings.rb +40 -0
- data/lib/gloo/core/tokens.rb +8 -2
- data/lib/gloo/docs/help_shell.rb +46 -1
- data/lib/gloo/objs/basic/string_msgs.rb +20 -0
- data/lib/gloo/objs/basic/word_wrap.rb +58 -0
- data/lib/gloo/persist/file_loader.rb +16 -12
- data/lib/gloo/persist/file_storage.rb +20 -3
- data/lib/gloo/persist/persist_man.rb +31 -1
- data/lib/gloo/persist/source/source_doc.rb +36 -0
- data/lib/gloo/persist/subtree_extractor.rb +184 -0
- data/lib/gloo/persist/trivia_buffer.rb +120 -0
- data/lib/gloo/verbs/if.rb +18 -8
- data/lib/gloo/verbs/list.rb +36 -4
- data/lib/gloo/verbs/save.rb +24 -4
- data/lib/gloo/verbs/unless.rb +13 -4
- data/test.gloo/objs/string.test.gloo +17 -0
- data/test.gloo/objs/text.test.gloo +9 -0
- data/test.gloo/verbs/if.test.gloo +21 -0
- data/test.gloo/verbs/save.test.gloo +86 -0
- data/test.gloo/verbs/unless.test.gloo +21 -0
- metadata +9 -4
- data/lib/gloo/persist/comment_buffer.rb +0 -58
|
@@ -32,6 +32,27 @@ demo [container] :
|
|
|
32
32
|
other [string] : world
|
|
33
33
|
END
|
|
34
34
|
|
|
35
|
+
#
|
|
36
|
+
# Regression fixture: a blank line between a container's own
|
|
37
|
+
# declaration and its first child (not between two siblings, which
|
|
38
|
+
# already worked) used to land one level too shallow.
|
|
39
|
+
#
|
|
40
|
+
blank_before_first_child_fixture [text] : BEGIN
|
|
41
|
+
#
|
|
42
|
+
# The main app container.
|
|
43
|
+
#
|
|
44
|
+
app [can] :
|
|
45
|
+
|
|
46
|
+
# Core settings live here.
|
|
47
|
+
core [can] :
|
|
48
|
+
|
|
49
|
+
# Some other core thing.
|
|
50
|
+
other [string] : hi
|
|
51
|
+
|
|
52
|
+
# Something unrelated at the app level.
|
|
53
|
+
name [string] : My App
|
|
54
|
+
END
|
|
55
|
+
|
|
35
56
|
round_trip_preserves_comments_and_untouched_lines [test] :
|
|
36
57
|
description [string] : load, change one value, save -- comments and the untouched sibling survive.
|
|
37
58
|
on_test [script] :
|
|
@@ -66,6 +87,18 @@ END
|
|
|
66
87
|
tell demo to unload
|
|
67
88
|
tell ^^.f to delete
|
|
68
89
|
|
|
90
|
+
blank_before_first_child [test] :
|
|
91
|
+
description [string] : An unchanged save reproduces blank lines before a container's first child too.
|
|
92
|
+
on_test [script] :
|
|
93
|
+
tell ^^.f to write ( ^^.blank_before_first_child_fixture )
|
|
94
|
+
load /tmp/gloo_save_test.gloo
|
|
95
|
+
save app
|
|
96
|
+
tell ^^.f to read ( ^^.out )
|
|
97
|
+
eval ^^.out = ^^.blank_before_first_child_fixture
|
|
98
|
+
assert "an unchanged save should reproduce the original text, blank lines included"
|
|
99
|
+
tell app to unload
|
|
100
|
+
tell ^^.f to delete
|
|
101
|
+
|
|
69
102
|
deleting_an_object_drops_its_line [test] :
|
|
70
103
|
description [string] : removing a child and saving drops just that declaration.
|
|
71
104
|
on_test [script] :
|
|
@@ -96,6 +129,59 @@ END
|
|
|
96
129
|
tell ^^.f to delete
|
|
97
130
|
tell ^^.to_target to delete
|
|
98
131
|
|
|
132
|
+
extracting_a_subtree_moves_it_to_the_new_file [test] :
|
|
133
|
+
description [string] : save {nested obj} to {path} moves its declaration (and its own comment) out of the old file into the new one.
|
|
134
|
+
on_test [script] :
|
|
135
|
+
tell ^^.f to write ( ^^.fixture )
|
|
136
|
+
load /tmp/gloo_save_test.gloo
|
|
137
|
+
save demo.other to /tmp/gloo_save_test_to
|
|
138
|
+
check ^^.to_target for exists?
|
|
139
|
+
assert "extraction should create the target file"
|
|
140
|
+
|
|
141
|
+
tell ^^.to_target to read ( ^^.out )
|
|
142
|
+
check ^^.out for substring? ( "demo.other [string] : world" )
|
|
143
|
+
assert "the target file should declare the moved object under its full dotted path"
|
|
144
|
+
check ^^.out for substring? ( "# a comment above other" )
|
|
145
|
+
assert "the moved object's own comment should travel with it"
|
|
146
|
+
|
|
147
|
+
tell ^^.f to read ( ^^.out )
|
|
148
|
+
check ^^.out for substring? ( "other [string]" )
|
|
149
|
+
refute "the old file should no longer declare the moved object"
|
|
150
|
+
check ^^.out for substring? ( "msg [string] : hello" )
|
|
151
|
+
assert "the old file should keep everything else"
|
|
152
|
+
|
|
153
|
+
# a later plain save of demo must not resurrect the moved object
|
|
154
|
+
save demo
|
|
155
|
+
tell ^^.f to read ( ^^.out )
|
|
156
|
+
check ^^.out for substring? ( "other" )
|
|
157
|
+
refute "a later save of the old root should not re-add the moved object"
|
|
158
|
+
|
|
159
|
+
tell demo.other to unload
|
|
160
|
+
tell demo to unload
|
|
161
|
+
tell ^^.f to delete
|
|
162
|
+
tell ^^.to_target to delete
|
|
163
|
+
|
|
164
|
+
extracting_a_subtree_spanning_multiple_files_is_an_error [test] :
|
|
165
|
+
description [string] : save {obj} to {path} refuses when obj's own subtree has declarations in more than one file.
|
|
166
|
+
on_test [script] :
|
|
167
|
+
put false into ^^.err
|
|
168
|
+
tell ^^.f to write ( ^^.fixture )
|
|
169
|
+
load /tmp/gloo_save_test.gloo
|
|
170
|
+
# a second file adds its own child under the same 'demo' container --
|
|
171
|
+
# a namespace pattern applied inside the subtree we'll try to extract
|
|
172
|
+
tell ^^.g to write ( "demo [container] :\n extra [string] : too\n" )
|
|
173
|
+
load /tmp/gloo_save_test_2.gloo
|
|
174
|
+
|
|
175
|
+
save demo to /tmp/gloo_save_test_to
|
|
176
|
+
eval ^^.err = true
|
|
177
|
+
assert "extraction should refuse a subtree spanning multiple files"
|
|
178
|
+
check ^^.to_target for exists?
|
|
179
|
+
refute "the target file should not have been created"
|
|
180
|
+
|
|
181
|
+
tell demo to unload
|
|
182
|
+
tell ^^.f to delete
|
|
183
|
+
tell ^^.g to delete
|
|
184
|
+
|
|
99
185
|
reload_discards_unsaved_changes [test] :
|
|
100
186
|
description [string] : reload throws away edits that were not saved.
|
|
101
187
|
on_test [script] :
|
|
@@ -18,3 +18,24 @@ tests.verbs.unless [can] :
|
|
|
18
18
|
eval false
|
|
19
19
|
unless true do eval true
|
|
20
20
|
refute "expected do block to be skipped when condition is true"
|
|
21
|
+
|
|
22
|
+
unless_then [test] :
|
|
23
|
+
description [string] : 'then' is a synonym for 'do'
|
|
24
|
+
on_test [script] :
|
|
25
|
+
eval false
|
|
26
|
+
unless ^^.b then eval true
|
|
27
|
+
assert "expected 'then' to work the same as 'do'"
|
|
28
|
+
|
|
29
|
+
unless_do_else [test] :
|
|
30
|
+
description [string] : else runs when the condition is true
|
|
31
|
+
on_test [script] :
|
|
32
|
+
eval false
|
|
33
|
+
unless true do eval false else eval true
|
|
34
|
+
assert "expected else to run when the condition is true"
|
|
35
|
+
|
|
36
|
+
unless_then_else [test] :
|
|
37
|
+
description [string] : else works the same with the 'then' synonym
|
|
38
|
+
on_test [script] :
|
|
39
|
+
eval false
|
|
40
|
+
unless true then eval false else eval true
|
|
41
|
+
assert "expected else to run after a 'then' action"
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gloo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Crane
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-09-13 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: bundler
|
|
@@ -361,6 +362,7 @@ files:
|
|
|
361
362
|
- lib/gloo/objs/basic/string_msgs.rb
|
|
362
363
|
- lib/gloo/objs/basic/text.rb
|
|
363
364
|
- lib/gloo/objs/basic/untyped.rb
|
|
365
|
+
- lib/gloo/objs/basic/word_wrap.rb
|
|
364
366
|
- lib/gloo/objs/ctrl/each.rb
|
|
365
367
|
- lib/gloo/objs/ctrl/each_child.rb
|
|
366
368
|
- lib/gloo/objs/ctrl/each_dir.rb
|
|
@@ -384,7 +386,6 @@ files:
|
|
|
384
386
|
- lib/gloo/objs/web/http_post.rb
|
|
385
387
|
- lib/gloo/objs/web/json.rb
|
|
386
388
|
- lib/gloo/objs/web/uri.rb
|
|
387
|
-
- lib/gloo/persist/comment_buffer.rb
|
|
388
389
|
- lib/gloo/persist/declaration_ledger.rb
|
|
389
390
|
- lib/gloo/persist/disc_mech.rb
|
|
390
391
|
- lib/gloo/persist/file_loader.rb
|
|
@@ -400,6 +401,8 @@ files:
|
|
|
400
401
|
- lib/gloo/persist/source/directive_node.rb
|
|
401
402
|
- lib/gloo/persist/source/obj_node.rb
|
|
402
403
|
- lib/gloo/persist/source/source_doc.rb
|
|
404
|
+
- lib/gloo/persist/subtree_extractor.rb
|
|
405
|
+
- lib/gloo/persist/trivia_buffer.rb
|
|
403
406
|
- lib/gloo/plugin/base.rb
|
|
404
407
|
- lib/gloo/plugin/callback.rb
|
|
405
408
|
- lib/gloo/plugin/ext_manager.rb
|
|
@@ -505,6 +508,7 @@ licenses:
|
|
|
505
508
|
- MIT
|
|
506
509
|
metadata:
|
|
507
510
|
documentation_uri: https://github.com/ecrane/gloo
|
|
511
|
+
post_install_message:
|
|
508
512
|
rdoc_options: []
|
|
509
513
|
require_paths:
|
|
510
514
|
- lib
|
|
@@ -519,7 +523,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
519
523
|
- !ruby/object:Gem::Version
|
|
520
524
|
version: '0'
|
|
521
525
|
requirements: []
|
|
522
|
-
rubygems_version:
|
|
526
|
+
rubygems_version: 3.5.16
|
|
527
|
+
signing_key:
|
|
523
528
|
specification_version: 4
|
|
524
529
|
summary: Gloo scripting language. A scripting language built on ruby.
|
|
525
530
|
test_files: []
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
|
2
|
-
# Copyright:: Copyright (c) 2026 Eric Crane. All rights reserved.
|
|
3
|
-
#
|
|
4
|
-
# Buffers a run of consecutive whole-line comments while the loader
|
|
5
|
-
# decides whether they become a declaration's leading_doc or float as
|
|
6
|
-
# their own comment nodes.
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
module Gloo
|
|
10
|
-
module Persist
|
|
11
|
-
class CommentBuffer
|
|
12
|
-
|
|
13
|
-
#
|
|
14
|
-
# Set up an empty buffer.
|
|
15
|
-
#
|
|
16
|
-
def initialize
|
|
17
|
-
@pending = []
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
#
|
|
21
|
-
# Buffer one comment line. raw is the full source line (minus
|
|
22
|
-
# its trailing newline); tabs is its indentation level.
|
|
23
|
-
#
|
|
24
|
-
def push( raw, tabs )
|
|
25
|
-
@pending << { :raw => raw, :tabs => tabs }
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
# Detach the buffered run as floating comment nodes, appended in
|
|
30
|
-
# order to the given children array.
|
|
31
|
-
#
|
|
32
|
-
def flush_into( children )
|
|
33
|
-
return if @pending.empty?
|
|
34
|
-
|
|
35
|
-
@pending.each { |c| children << Source::CommentNode.new( c[ :raw ] ) }
|
|
36
|
-
@pending = []
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
#
|
|
40
|
-
# If the buffered run sits at the same indent as line_tabs, claim
|
|
41
|
-
# it as a leading_doc (raw, newline-joined) and clear the buffer.
|
|
42
|
-
# Otherwise flush it into children as floating comments first, so
|
|
43
|
-
# document order is kept, and return nil.
|
|
44
|
-
#
|
|
45
|
-
def take_leading_doc( line_tabs, children )
|
|
46
|
-
if !@pending.empty? && @pending.last[ :tabs ] == line_tabs
|
|
47
|
-
doc = @pending.map { |c| c[ :raw ] }.join( "\n" )
|
|
48
|
-
@pending = []
|
|
49
|
-
return doc
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
flush_into( children )
|
|
53
|
-
return nil
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|